Skip to content

Commit

Permalink
fix some issues encountered in numpy 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin Lang committed Sep 5, 2024
1 parent 9fa3ba0 commit c0348b8
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions py/legacypipe/coadds.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ class Duck(object):
goodpix = 1
else:
# include SATUR pixels if no other pixels exists
okbits = 0
okbits = np.uint16(0)
for bitname in ['satur']:
okbits |= DQ_BITS[bitname]
brightpix = ((dq & okbits) != 0)
Expand Down Expand Up @@ -854,7 +854,7 @@ def _make_coadds_plots_1(im, band, mods, mo, iv, unweighted,
if unweighted and (dq is not None):

# HACK -- copy-n-pasted code from below.
okbits = 0
okbits = np.uint16(0)
#for bitname in ['satur', 'bleed']:
for bitname in ['satur']:
okbits |= DQ_BITS[bitname]
Expand Down
2 changes: 1 addition & 1 deletion py/legacypipe/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ def saddle_level(Y):
plt.axis(ax)
plt.title('SED %s: hot blobs' % sedname)
plt.figlegend((p3[0],p1[0],p2[0]), ('Existing', 'Keep', 'Drop'),
'upper left')
loc='upper left')
ps.savefig()

return hotblobs, px, py, aper, peakval
Expand Down
2 changes: 1 addition & 1 deletion py/legacypipe/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -2260,7 +2260,7 @@ def from_fits_row(cls, Ti):
if nswap:
info('Swapping in SKY_JOHN values for', nswap, 'splinesky cells;', Ti.sky_med, '->', Ti.sky_john)
gridvals[gridvals == Ti.sky_med] = Ti.sky_john
sky = cls(Ti.xgrid, Ti.ygrid, gridvals, order=Ti.order)
sky = cls(Ti.xgrid, Ti.ygrid, gridvals, order=int(Ti.order))
sky.shift(Ti.x0, Ti.y0)
return sky

Expand Down
5 changes: 3 additions & 2 deletions py/legacypipe/runbrick.py
Original file line number Diff line number Diff line change
Expand Up @@ -2983,8 +2983,9 @@ def stage_wise_forced(

# Look up mask values for sources
WISE.wise_mask = np.zeros((len(cat), 2), np.uint8)
WISE.wise_mask[T.in_bounds,0] = wise_mask_maps[0][T.iby[T.in_bounds], T.ibx[T.in_bounds]]
WISE.wise_mask[T.in_bounds,1] = wise_mask_maps[1][T.iby[T.in_bounds], T.ibx[T.in_bounds]]
if wise_mask_maps is not None:
WISE.wise_mask[T.in_bounds,0] = wise_mask_maps[0][T.iby[T.in_bounds], T.ibx[T.in_bounds]]
WISE.wise_mask[T.in_bounds,1] = wise_mask_maps[1][T.iby[T.in_bounds], T.ibx[T.in_bounds]]

# Unpack time-resolved results...
WISE_T = None
Expand Down
4 changes: 2 additions & 2 deletions py/legacypipe/survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,8 +822,8 @@ def ccds_touching_wcs(targetwcs, ccds, ccdrad=None, polygons=True):

rad = trad + ccdrad
r,d = targetwcs.radec_center()
I, = np.where(np.abs(ccds.dec - d) < rad)
I = I[np.where(degrees_between(r, d, ccds.ra[I], ccds.dec[I]) < rad)[0]]
I = np.flatnonzero(np.abs(ccds.dec - d) < rad)
I = I[np.flatnonzero(np.atleast_1d(degrees_between(r, d, ccds.ra[I], ccds.dec[I])) < rad)]
if not polygons:
return I
# now check actual polygon intersection
Expand Down
1 change: 1 addition & 0 deletions py/legacypipe/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def run_ps_thread(parent_pid, parent_ppid, fn, shutdown, event_queue):
import time
import fitsio
from functools import reduce
import re

# my pid = parent pid -- this is a thread.
print('run_ps_thread starting: parent PID', parent_pid, ', my PID', os.getpid(), fn)
Expand Down

0 comments on commit c0348b8

Please sign in to comment.