diff -Nru astrometry.net-0.65+dfsg/catalogs/brightstars-data.c astrometry.net-0.67+dfsg/catalogs/brightstars-data.c --- astrometry.net-0.65+dfsg/catalogs/brightstars-data.c 2015-12-12 19:02:27.000000000 +0000 +++ astrometry.net-0.67+dfsg/catalogs/brightstars-data.c 2016-01-25 16:20:00.000000000 +0000 @@ -147,7 +147,7 @@ { "", "", 13.4079, -62.8714, 5.7 }, { "36And", "", 13.7417, 23.6283, 5.4 }, { "", "", 13.9267, -7.3472, 5.8 }, -{ "\xce\xb3""Cas", "", 14.1771, 60.7167, 2.4 }, +{ "\xce\xb3""Cas", "Navi", 14.1771, 60.7167, 2.4 }, { "\xcf\x85""2Cas", "", 14.1658, 59.1811, 4.6 }, { "", "", 14.1963, 60.3628, 5.5 }, { "\xcf\x86""3Cet", "", 14.0062, -11.2667, 5.3 }, @@ -304,7 +304,7 @@ { "2Per", "", 28.0392, 50.7928, 5.7 }, { "\xce\xb6""Cet", "Baten Kaitos", 27.8650, -10.3350, 3.7 }, { "", "", 27.7271, -50.2061, 5.9 }, -{ "\xce\xb5""Cas", "Navi", 28.5987, 63.6700, 3.3 }, +{ "\xce\xb5""Cas", "", 28.5987, 63.6700, 3.3 }, { "55And", "", 28.3221, 40.7297, 5.4 }, { "\xce\xb1""Tri", "Mothallah", 28.2704, 29.5789, 3.4 }, { "\xce\xb3""1Ari", "", 28.3825, 19.2958, 4.8 }, diff -Nru astrometry.net-0.65+dfsg/debian/changelog astrometry.net-0.67+dfsg/debian/changelog --- astrometry.net-0.65+dfsg/debian/changelog 2016-01-07 12:56:17.000000000 +0000 +++ astrometry.net-0.67+dfsg/debian/changelog 2016-01-25 20:18:15.000000000 +0000 @@ -1,3 +1,15 @@ +astrometry.net (0.67+dfsg-1) unstable; urgency=low + + * New upstream version + + -- Ole Streicher Mon, 25 Jan 2016 21:17:52 +0100 + +astrometry.net (0.66+dfsg-1) unstable; urgency=low + + * New upstream version + + -- Ole Streicher Mon, 18 Jan 2016 09:45:01 +0100 + astrometry.net (0.65+dfsg-2) unstable; urgency=low * Update build dependencies for libpng, change libpng1.2-dev to libpng-dev. diff -Nru astrometry.net-0.65+dfsg/include/astrometry/resort-xylist.h astrometry.net-0.67+dfsg/include/astrometry/resort-xylist.h --- astrometry.net-0.65+dfsg/include/astrometry/resort-xylist.h 2015-12-12 19:02:27.000000000 +0000 +++ astrometry.net-0.67+dfsg/include/astrometry/resort-xylist.h 2016-01-25 16:20:00.000000000 +0000 @@ -5,6 +5,14 @@ #ifndef RESORT_XYLIST_H #define RESORT_XYLIST_H +/* + Sorts the xylist in *infn*, writing the output to *outfn*. + + The sorting order is strange. The algorithm first performs two + indirect sorts, by flux and by flux+background. It then interleaves + these two results, without duplication. This can be useful if you + don't really trust the background subtraction... + */ int resort_xylist(const char* infn, const char* outfn, const char* fluxcol, const char* backcol, int ascending); diff -Nru astrometry.net-0.65+dfsg/Makefile astrometry.net-0.67+dfsg/Makefile --- astrometry.net-0.65+dfsg/Makefile 2015-12-14 21:13:35.000000000 +0000 +++ astrometry.net-0.67+dfsg/Makefile 2016-01-25 16:27:26.000000000 +0000 @@ -171,7 +171,7 @@ $(MAKE) -C util config .PHONY: config -RELEASE_VER := 0.65 +RELEASE_VER := 0.67 RELEASE_DIR := astrometry.net-$(RELEASE_VER) RELEASE_RMDIRS := net @@ -186,7 +186,7 @@ (cd $(RELEASE_DIR)/blind && swig -python -I. -I../util -I../include/astrometry plotstuff.i) (cd $(RELEASE_DIR)/sdss && swig -python -I. cutils.i) cat $(RELEASE_DIR)/util/makefile.common | sed "s/AN_GIT_REVISION .=.*/AN_GIT_REVISION := $$(git describe)/" | sed "s/AN_GIT_DATE .=.*/AN_GIT_DATE := $$(git log -n 1 --format=%cd | sed 's/ /_/g')/" > $(RELEASE_DIR)/util/makefile.common.x && mv $(RELEASE_DIR)/util/makefile.common.x $(RELEASE_DIR)/util/makefile.common - cat $(RELEASE_DIR)/Makefile | sed "s/RELEASE_VER := 0.65 + cat $(RELEASE_DIR)/Makefile | sed "s/RELEASE_VER := 0.67 tar cf $(RELEASE_DIR).tar $(RELEASE_DIR) gzip --best -c $(RELEASE_DIR).tar > $(RELEASE_DIR).tar.gz bzip2 --best $(RELEASE_DIR).tar diff -Nru astrometry.net-0.65+dfsg/.travis.yml astrometry.net-0.67+dfsg/.travis.yml --- astrometry.net-0.65+dfsg/.travis.yml 2015-12-12 19:02:27.000000000 +0000 +++ astrometry.net-0.67+dfsg/.travis.yml 2016-01-25 16:20:00.000000000 +0000 @@ -1,6 +1,6 @@ # Travis-CI.org build script -# try the new containerized infrastructure +# use the new containerized infrastructure sudo: false language: c diff -Nru astrometry.net-0.65+dfsg/util/anwcs.c astrometry.net-0.67+dfsg/util/anwcs.c --- astrometry.net-0.65+dfsg/util/anwcs.c 2015-12-12 19:02:27.000000000 +0000 +++ astrometry.net-0.67+dfsg/util/anwcs.c 2016-01-25 16:20:00.000000000 +0000 @@ -248,6 +248,7 @@ double imgcrd[], double phi[], double theta[], double world[], int stat[]); */ + if (code) { //ERROR("Wcslib's wcsp2s() failed: code=%i, status=%i (%s); (x,y)=(%g,%g)", code, status, wcs_errmsg[status], px, py); logverb("Wcslib's wcsp2s() failed: code=%i, status=%i (%s); (x,y)=(%g,%g)", code, status, wcs_errmsg[status], px, py); diff -Nru astrometry.net-0.65+dfsg/util/c.py astrometry.net-0.67+dfsg/util/c.py --- astrometry.net-0.65+dfsg/util/c.py 2015-12-14 21:13:33.000000000 +0000 +++ astrometry.net-0.67+dfsg/util/c.py 2016-01-25 16:27:24.000000000 +0000 @@ -1910,7 +1910,9 @@ def fitsio_to_qfits_header(hdr): hdrstr = '' for rec in hdr.records(): - cardstr = rec['card'] + cardstr = rec.get('card', None) + if cardstr is None: + cardstr = hdr._record2card(rec) # pad cardstr = cardstr + ' '*(80 - len(cardstr)) hdrstr += cardstr @@ -2672,6 +2674,15 @@ _real_sip_t_init = sip_t.__init__ def my_sip_t_init(self, *args, **kwargs): +# fitsio header: check for '.records()' function. + if len(args) == 1 and hasattr(args[0], 'records'): + try: + hdr = args[0] + qhdr = fitsio_to_qfits_header(hdr) + args = [qhdr] + except: + pass + _real_sip_t_init(self, *args, **kwargs) if self.this is None: raise RuntimeError('Duck punch!') @@ -2899,12 +2910,14 @@ def anwcs_t_pixelxy2radec(self, x, y): - return anwcs_xy2rd_wrapper(self.this, x, y) + ok,r,d = anwcs_xy2rd_wrapper(self.this, x, y) + return (ok == 0),r,d anwcs_t.pixelxy2radec_single = anwcs_t.pixelxy2radec anwcs_t.pixelxy2radec = anwcs_t_pixelxy2radec def anwcs_t_radec2pixelxy(self, r, d): - return anwcs_rd2xy_wrapper(self.this, r, d) + ok,x,y = anwcs_rd2xy_wrapper(self.this, r, d) + return (ok == 0),x,y anwcs_t.radec2pixelxy_single = anwcs_t.radec2pixelxy anwcs_t.radec2pixelxy = anwcs_t_radec2pixelxy @@ -2929,6 +2942,15 @@ _real_tan_t_init = tan_t.__init__ def my_tan_t_init(self, *args, **kwargs): +# fitsio header: check for '.records()' function. + if len(args) == 1 and hasattr(args[0], 'records'): + try: + hdr = args[0] + qhdr = fitsio_to_qfits_header(hdr) + args = [qhdr] + except: + pass + _real_tan_t_init(self, *args, **kwargs) if self.this is None: raise RuntimeError('Duck punch!') diff -Nru astrometry.net-0.65+dfsg/util/makefile.common astrometry.net-0.67+dfsg/util/makefile.common --- astrometry.net-0.65+dfsg/util/makefile.common 2015-12-14 21:13:35.000000000 +0000 +++ astrometry.net-0.67+dfsg/util/makefile.common 2016-01-25 16:27:26.000000000 +0000 @@ -280,6 +280,12 @@ FLAGS_DEF += -Winline + +# If user set FLAGS, use those rather than FLAGS_DEF. +ifneq ($(origin FLAGS),undefined) + FLAGS_DEF := $(FLAGS) +endif + # fold in the user's CFLAGS, if set... CFLAGS_DEF := $(CFLAGS) $(FLAGS_DEF) CFLAGS_DEF += -I$(INCLUDE_BASE_DIR) @@ -318,8 +324,8 @@ # Provide for executable programs and FITS headers # GIT fields: revision, date and url via CFLAGS. # These fields replace the deprecated SVN fields. -AN_GIT_REVISION := 0.65 -AN_GIT_DATE := Sat_Dec_12_14:02:27_2015_-0500 +AN_GIT_REVISION := 0.67 +AN_GIT_DATE := Mon_Jan_25_11:20:00_2016_-0500 AN_GIT_URL := https://github.com/dstndstn/astrometry.net CFLAGS_DEF += -DAN_GIT_REVISION='"$(AN_GIT_REVISION)"' diff -Nru astrometry.net-0.65+dfsg/util/permutedsort.c astrometry.net-0.67+dfsg/util/permutedsort.c --- astrometry.net-0.65+dfsg/util/permutedsort.c 2015-12-12 19:02:27.000000000 +0000 +++ astrometry.net-0.67+dfsg/util/permutedsort.c 2016-01-25 16:20:00.000000000 +0000 @@ -94,6 +94,11 @@ //printf("d1=%g, d2=%g\n", d1, d2); +#define INTCOMPARE(i1, i2, op1, op2) \ + if (i1 op1 i2) return -1; \ + if (i1 op2 i2) return 1; \ + return 0; + int compare_doubles_asc(const void* v1, const void* v2) { const double d1 = *(double*)v1; const double d2 = *(double*)v2; @@ -120,15 +125,15 @@ } int compare_int64_asc(const void* v1, const void* v2) { - int64_t f1 = *(int64_t*)v1; - int64_t f2 = *(int64_t*)v2; - COMPARE(f1, f2, <, >); + int64_t i1 = *(int64_t*)v1; + int64_t i2 = *(int64_t*)v2; + INTCOMPARE(i1, i2, <, >); } int compare_int64_desc(const void* v1, const void* v2) { - int64_t f1 = *(int64_t*)v1; - int64_t f2 = *(int64_t*)v2; - COMPARE(f1, f2, >, <); + int64_t i1 = *(int64_t*)v1; + int64_t i2 = *(int64_t*)v2; + INTCOMPARE(i1, i2, >, <); } // Versions for use with QSORT_R @@ -139,6 +144,7 @@ #undef COMPARE +#undef INTCOMPARE int compare_ints_asc(const void* v1, const void* v2) { const int d1 = *(int*)v1; diff -Nru astrometry.net-0.65+dfsg/util/plotutils.py astrometry.net-0.67+dfsg/util/plotutils.py --- astrometry.net-0.65+dfsg/util/plotutils.py 2015-12-12 19:02:27.000000000 +0000 +++ astrometry.net-0.67+dfsg/util/plotutils.py 2016-01-25 16:20:00.000000000 +0000 @@ -1,5 +1,6 @@ # This file is part of the Astrometry.net suite. # Licensed under a 3-clause BSD style license - see LICENSE +from __future__ import print_function import matplotlib.cm import matplotlib.colors import matplotlib.patches @@ -103,6 +104,7 @@ else: self.suffixes = suffixes self.pattern = self.basefn + '-%s.%s' + self.printfn = True def skip(self, n=1): self.ploti += n @@ -126,7 +128,8 @@ import pylab as plt for fn in self.getnextlist(): plt.savefig(fn, **kwargs) - print 'saved', fn + if self.printfn: + print('saved', fn) def loghist(x, y, nbins=100, hot=True, doclf=True, docolorbar=True, lo=0.3, @@ -150,7 +153,7 @@ if not (np.all(np.isfinite(x)) and np.all(np.isfinite(y))): K = np.flatnonzero(np.isfinite(x) * np.isfinite(y)) - print 'loghist: cutting to', len(K), 'of', len(x), 'finite values' + print('loghist: cutting to', len(K), 'of', len(x), 'finite values') x = x[K] y = y[K] @@ -466,7 +469,7 @@ X = np.arange(25.).reshape((5,5)) X[2:4,3:4] = np.nan - print X + print(X) plt.clf() imshow_nan(X, interpolation='nearest') diff -Nru astrometry.net-0.65+dfsg/util/resample.py astrometry.net-0.67+dfsg/util/resample.py --- astrometry.net-0.65+dfsg/util/resample.py 2015-12-12 19:02:27.000000000 +0000 +++ astrometry.net-0.67+dfsg/util/resample.py 2016-01-25 16:20:00.000000000 +0000 @@ -85,6 +85,7 @@ x0,y0 = np.round(XY.min(axis=0)).astype(int) x1,y1 = np.round(XY.max(axis=0)).astype(int) + if spline: # Now we build a spline that maps "target" pixels to "input" pixels # spline inputs: pixel coords in the 'target' image @@ -134,14 +135,34 @@ # spline outputs -- pixel coords in the 'input' image # (XX, YY) # We use vectorized radec <-> pixelxy functions here - ok,XX,YY = wcs.radec2pixelxy( - *(targetwcs.pixelxy2radec( - xx[np.newaxis,:] + 1, - yy[:,np.newaxis] + 1)[-2:])) + + R = targetwcs.pixelxy2radec(xx[np.newaxis,:] + 1, + yy[:,np.newaxis] + 1) + if len(R) == 3: + ok = R[0] + assert(np.all(ok)) + ok,XX,YY = wcs.radec2pixelxy(*(R[-2:])) + del R XX -= 1. YY -= 1. + assert(np.all(ok)) del ok - + + # ok,XX,YY = wcs.radec2pixelxy( + # *(targetwcs.pixelxy2radec( + # xx[np.newaxis,:] + 1, + # yy[:,np.newaxis] + 1)[-2:])) + # XX -= 1. + # YY -= 1. + # del ok + + # print 'Spline inputs:' + # print xx + # print yy + # print 'Spline outputs:' + # print XX + # print YY + if ps: plt.clf() plt.plot(Xo, Yo, 'b.') @@ -204,6 +225,7 @@ # ok,ra,dec R = R[1:] ok,fxi,fyi = wcs.radec2pixelxy(*R) + assert(np.all(ok)) # ok,fxi,fyi = wcs.radec2pixelxy( # *targetwcs.pixelxy2radec(ixo[np.newaxis,:] + 1., # iyo[:,np.newaxis] + 1.)) diff -Nru astrometry.net-0.65+dfsg/util/sip.c astrometry.net-0.67+dfsg/util/sip.c --- astrometry.net-0.65+dfsg/util/sip.c 2015-12-12 19:02:27.000000000 +0000 +++ astrometry.net-0.67+dfsg/util/sip.c 2016-01-25 16:20:00.000000000 +0000 @@ -355,12 +355,12 @@ for (p=0; p<=sip->a_order; p++) for (q=0; q<=sip->a_order; q++) - //if ((p+q > 0) && (p+q <= sip->a_order)) + // We include all terms, even the constant and linear ones; the standard + // isn't clear on whether these are allowed or not. if (p+q <= sip->a_order) fuv += sip->a[p][q] * powu[p] * powv[q]; for (p=0; p<=sip->b_order; p++) for (q=0; q<=sip->b_order; q++) - //if ((p+q > 0) && (p+q <= sip->b_order)) if (p+q <= sip->b_order) guv += sip->b[p][q] * powu[p] * powv[q]; @@ -412,10 +412,12 @@ for (p=0; p<=sip->ap_order; p++) for (q=0; q<=sip->ap_order; q++) - fUV += sip->ap[p][q] * powu[p] * powv[q]; + if (p+q <= sip->ap_order) + fUV += sip->ap[p][q] * powu[p] * powv[q]; for (p=0; p<=sip->bp_order; p++) for (q=0; q<=sip->bp_order; q++) - gUV += sip->bp[p][q] * powu[p] * powv[q]; + if (p+q <= sip->bp_order) + gUV += sip->bp[p][q] * powu[p] * powv[q]; *u = U + fUV; *v = V + gUV; diff -Nru astrometry.net-0.65+dfsg/util/util.i astrometry.net-0.67+dfsg/util/util.i --- astrometry.net-0.65+dfsg/util/util.i 2015-12-12 19:02:27.000000000 +0000 +++ astrometry.net-0.67+dfsg/util/util.i 2016-01-25 16:20:00.000000000 +0000 @@ -1091,7 +1091,9 @@ def fitsio_to_qfits_header(hdr): hdrstr = '' for rec in hdr.records(): - cardstr = rec['card'] + cardstr = rec.get('card', None) + if cardstr is None: + cardstr = hdr._record2card(rec) # pad cardstr = cardstr + ' '*(80 - len(cardstr)) hdrstr += cardstr @@ -1222,6 +1224,11 @@ return t; } + sip_t(const qfits_header* hdr) { + sip_t* t = sip_read_header(hdr, NULL); + return t; + } + ~sip_t() { free($self); } sip_t* get_subimage(int x0, int y0, int w, int h) { @@ -1497,6 +1504,15 @@ _real_sip_t_init = sip_t.__init__ def my_sip_t_init(self, *args, **kwargs): + # fitsio header: check for '.records()' function. + if len(args) == 1 and hasattr(args[0], 'records'): + try: + hdr = args[0] + qhdr = fitsio_to_qfits_header(hdr) + args = [qhdr] + except: + pass + _real_sip_t_init(self, *args, **kwargs) if self.this is None: raise RuntimeError('Duck punch!') @@ -1551,6 +1567,11 @@ return t; } + tan_t(const qfits_header* hdr) { + tan_t* t = tan_read_header(hdr, NULL); + return t; + } + ~tan_t() { free($self); } void set(double crval1, double crval2, double crpix1, double crpix2, @@ -2068,7 +2089,7 @@ char **dataptrarray; npy_intp* strideptr; PyArray_Descr* dtypes[5]; - npy_intp i, N; + int j; // we'll do the inner loop ourselves flags = NPY_ITER_EXTERNAL_LOOP; @@ -2097,9 +2118,9 @@ op_flags[0] = NPY_ITER_READONLY | NPY_ITER_NBO; op_flags[1] = NPY_ITER_READONLY | NPY_ITER_NBO; - op_flags[2] = NPY_ITER_WRITEONLY | NPY_ITER_ALLOCATE | NPY_ITER_NBO; - op_flags[3] = NPY_ITER_WRITEONLY | NPY_ITER_ALLOCATE | NPY_ITER_NBO; - op_flags[4] = NPY_ITER_WRITEONLY | NPY_ITER_ALLOCATE | NPY_ITER_NBO; + op_flags[2] = NPY_ITER_WRITEONLY | NPY_ITER_ALLOCATE | NPY_ITER_NBO | NPY_ITER_CONTIG | NPY_ITER_ALIGNED; + op_flags[3] = NPY_ITER_WRITEONLY | NPY_ITER_ALLOCATE | NPY_ITER_NBO | NPY_ITER_CONTIG | NPY_ITER_ALIGNED; + op_flags[4] = NPY_ITER_WRITEONLY | NPY_ITER_ALLOCATE | NPY_ITER_NBO | NPY_ITER_CONTIG | NPY_ITER_ALIGNED; dtypes[0] = PyArray_DescrFromType(NPY_DOUBLE); dtypes[1] = PyArray_DescrFromType(NPY_DOUBLE); @@ -2109,8 +2130,8 @@ iter = NpyIter_MultiNew(5, op, flags, NPY_KEEPORDER, NPY_SAFE_CASTING, op_flags, dtypes); - for (i=0; i<5; i++) - Py_DECREF(dtypes[i]); + for (j=0; j<5; j++) + Py_DECREF(dtypes[j]); if (!iter) return NULL; @@ -2123,17 +2144,23 @@ dataptrarray = NpyIter_GetDataPtrArray(iter); do { + npy_intp i, N; + char* src1 = dataptrarray[0]; + char* src2 = dataptrarray[1]; + double* dout1 = (double*)(dataptrarray[2]); + double* dout2 = (double*)(dataptrarray[3]); + int* ok = (int*)dataptrarray[4]; + N = *innersizeptr; + + //printf("2to2i: N=%i, strides %i,%i\n", N, strideptr[0], strideptr[1]); + // are the inputs contiguous? (Outputs will be, since we // allocated them) if ((strideptr[0] == sizeof(double)) && (strideptr[1] == sizeof(double))) { // printf("Contiguous inputs; going fast\n"); - double* din1 = (double*)(dataptrarray[0]); - double* din2 = (double*)(dataptrarray[1]); - double* dout1 = (double*)(dataptrarray[2]); - double* dout2 = (double*)(dataptrarray[3]); - int* ok = (int*)dataptrarray[4]; - N = *innersizeptr; + double* din1 = (double*)src1; + double* din2 = (double*)src2; while (N--) { *ok = func(baton, *din1, *din2, dout1, dout2); ok++; @@ -2146,14 +2173,7 @@ // printf("Non-contiguous inputs; going slow\n"); npy_intp stride1 = strideptr[0]; npy_intp stride2 = strideptr[1]; - npy_intp size = *innersizeptr; - char* src1 = dataptrarray[0]; - char* src2 = dataptrarray[1]; - double* dout1 = (double*)dataptrarray[2]; - double* dout2 = (double*)dataptrarray[3]; - int* ok = (int*)dataptrarray[4]; - - for (i=0; icrval[0] = crval1; @@ -4430,6 +4434,10 @@ memcpy(&(t->wcstan), other, sizeof(tan_t)); return t; } +SWIGINTERN sip_t *new_sip_t__SWIG_4(qfits_header const *hdr){ + sip_t* t = sip_read_header(hdr, NULL); + return t; + } SWIGINTERN void delete_sip_t(sip_t *self){ free(self); } SWIGINTERN sip_t *sip_t_get_subimage(sip_t *self,int x0,int y0,int w,int h){ sip_t* sub = malloc(sizeof(sip_t)); @@ -4940,7 +4948,7 @@ char **dataptrarray; npy_intp* strideptr; PyArray_Descr* dtypes[5]; - npy_intp i, N; + int j; // we'll do the inner loop ourselves flags = NPY_ITER_EXTERNAL_LOOP; @@ -4969,9 +4977,9 @@ op_flags[0] = NPY_ITER_READONLY | NPY_ITER_NBO; op_flags[1] = NPY_ITER_READONLY | NPY_ITER_NBO; - op_flags[2] = NPY_ITER_WRITEONLY | NPY_ITER_ALLOCATE | NPY_ITER_NBO; - op_flags[3] = NPY_ITER_WRITEONLY | NPY_ITER_ALLOCATE | NPY_ITER_NBO; - op_flags[4] = NPY_ITER_WRITEONLY | NPY_ITER_ALLOCATE | NPY_ITER_NBO; + op_flags[2] = NPY_ITER_WRITEONLY | NPY_ITER_ALLOCATE | NPY_ITER_NBO | NPY_ITER_CONTIG | NPY_ITER_ALIGNED; + op_flags[3] = NPY_ITER_WRITEONLY | NPY_ITER_ALLOCATE | NPY_ITER_NBO | NPY_ITER_CONTIG | NPY_ITER_ALIGNED; + op_flags[4] = NPY_ITER_WRITEONLY | NPY_ITER_ALLOCATE | NPY_ITER_NBO | NPY_ITER_CONTIG | NPY_ITER_ALIGNED; dtypes[0] = PyArray_DescrFromType(NPY_DOUBLE); dtypes[1] = PyArray_DescrFromType(NPY_DOUBLE); @@ -4981,8 +4989,8 @@ iter = NpyIter_MultiNew(5, op, flags, NPY_KEEPORDER, NPY_SAFE_CASTING, op_flags, dtypes); - for (i=0; i<5; i++) - Py_DECREF(dtypes[i]); + for (j=0; j<5; j++) + Py_DECREF(dtypes[j]); if (!iter) return NULL; @@ -4995,17 +5003,23 @@ dataptrarray = NpyIter_GetDataPtrArray(iter); do { + npy_intp i, N; + char* src1 = dataptrarray[0]; + char* src2 = dataptrarray[1]; + double* dout1 = (double*)(dataptrarray[2]); + double* dout2 = (double*)(dataptrarray[3]); + int* ok = (int*)dataptrarray[4]; + N = *innersizeptr; + + //printf("2to2i: N=%i, strides %i,%i\n", N, strideptr[0], strideptr[1]); + // are the inputs contiguous? (Outputs will be, since we // allocated them) if ((strideptr[0] == sizeof(double)) && (strideptr[1] == sizeof(double))) { // printf("Contiguous inputs; going fast\n"); - double* din1 = (double*)(dataptrarray[0]); - double* din2 = (double*)(dataptrarray[1]); - double* dout1 = (double*)(dataptrarray[2]); - double* dout2 = (double*)(dataptrarray[3]); - int* ok = (int*)dataptrarray[4]; - N = *innersizeptr; + double* din1 = (double*)src1; + double* din2 = (double*)src2; while (N--) { *ok = func(baton, *din1, *din2, dout1, dout2); ok++; @@ -5018,14 +5032,7 @@ // printf("Non-contiguous inputs; going slow\n"); npy_intp stride1 = strideptr[0]; npy_intp stride2 = strideptr[1]; - npy_intp size = *innersizeptr; - char* src1 = dataptrarray[0]; - char* src2 = dataptrarray[1]; - double* dout1 = (double*)dataptrarray[2]; - double* dout2 = (double*)dataptrarray[3]; - int* ok = (int*)dataptrarray[4]; - - for (i=0; i