photutils
photutils copied to clipboard
IterativelySubtractedPSFPhotometry crashes (cannot extract cutouts)
When running IterativelySubtractedPSFPhotometry, the code fails pretty early on, probably because it tries to use a float position to slice an array. The relevant/end bits of the traceback are below. This is occuring when trying to fit an epsf generated from sources found in the data.
I think there just needs to a step where the x_0/y_0 values need to be floored/cast to ints. Perhaps this should be in astropy/nddata instead, but perhaps the root of the issue is that floats are being passed in to the extract_array
function, where it should be documented to be expecting ints.
~/anaconda2/envs/conda_dev/lib/python3.5/site-packages/photutils/psf/photometry.py in nstar(self, image, star_groups)
368 try:
369 image = subtract_psf(image, self.psf_model, param_table,
--> 370 subshape=self.fitshape)
371 except NoOverlapError:
372 pass
~/anaconda2/envs/conda_dev/lib/python3.5/site-packages/photutils/psf/funcs.py in subtract_psf(data, psf, posflux, subshape)
114 x_0, y_0 = row['x_fit'], row['y_fit']
115
--> 116 y = extract_array(indices[0], subshape, (y_0, x_0))
117 x = extract_array(indices[1], subshape, (y_0, x_0))
118
~/anaconda2/envs/conda_dev/lib/python3.5/site-packages/astropy/nddata/utils.py in extract_array(array_large, shape, position, mode, fill_value, return_position)
236 # Extracting on the edges is presumably a rare case, so treat special here
237 if (extracted_array.shape != shape) and (mode == 'partial'):
--> 238 extracted_array = np.zeros(shape, dtype=array_large.dtype)
239 extracted_array[:] = fill_value
240 extracted_array[small_slices] = array_large[large_slices]
TypeError: 'numpy.float64' object cannot be interpreted as an integer