Changelog#
3.2.0 (unreleased)#
General#
New Features#
Bug Fixes#
photutils.apertureFixed a race condition on free-threaded Python builds where the first parameter reassignments of an aperture class made from multiple threads at once could raise
RuntimeError: dictionary changed size during iteration.ApertureStatshad the same issue. [#2526]Fixed a bug where
ApertureStats.copyandcopy.deepcopyof an aperture,ApertureMask, orAperturePhotometryobject could raiseRuntimeError: dictionary changed size during iterationwhen another thread accessed the properties of the same object at the same time. [#2526]
photutils.detectionFixed a race condition on free-threaded Python builds where
DAOStarFinder,IRAFStarFinder, andStarFindercould raiseRuntimeError: dictionary changed size during iterationwhen first called from multiple threads at once. [#2526]Fixed
DAOStarFinder,IRAFStarFinder,StarFinder, andfind_peaksfornumpy.ma.MaskedArrayinput, which raised aTypeErrorwith scipy 2.0. The mask of aMaskedArrayinput is now combined with the inputmask. Previously, the star finders ignored it. [#2536]
photutils.profilesFixed a bug where
copy.deepcopyof aRadialProfile,CurveOfGrowth,EnsquaredCurveOfGrowth, orEllipticalCurveOfGrowthobject could raiseRuntimeError: dictionary changed size during iterationwhen another thread accessed the properties of the same object at the same time. [#2526]
photutils.psfFixed a bug where
copy.deepcopyof anEPSFStar,EPSFStars, orSourceGroupsobject could raiseRuntimeError: dictionary changed size during iterationwhen another thread accessed the properties of the same object at the same time. [#2526]Fixed
IterativePSFPhotometrywithmode='all'and alocal_bkg_estimatorfor data with units, which raised aUnitConversionErrorwhen a source was found in a later iteration. [#2520]Fixed
PSFPhotometryandIterativePSFPhotometryfor aninit_paramstable with maskedlocal_bkgvalues. Masked values are now handled as NaN, so they are not subtracted and the sources are flagged. [#2520]
photutils.segmentationFixed a race condition on free-threaded Python builds where
SegmentationImageandSourceCatalogcould raiseRuntimeError: dictionary changed size during iterationwhen first used from multiple threads at once. [#2526]Fixed a bug where
SegmentationImage.copyandSourceCatalog.copycould raiseRuntimeError: dictionary changed size during iterationwhen another thread accessed the properties of the same object at the same time. [#2526]Fixed
detect_sourcesandSourceFinderfornumpy.ma.MaskedArrayinput, which raised aTypeErrorwith scipy 2.0. The mask of aMaskedArrayinput is now combined with the inputmask. Previously, it was ignored. [#2536]
photutils.utilsFixed a bug where
copy.deepcopyof aCutoutImagecould raiseRuntimeError: dictionary changed size during iterationwhen another thread accessed the properties of the same object at the same time. [#2526]
API Changes#
3.1.1 (2026-10-16)#
General#
Importing the top-level
photutilspackage and subpackages is now faster. [#2512]
Bug Fixes#
photutils.apertureFixed the
to_pixelmethods ofSkyEllipticalAperture,SkyEllipticalAnnulus,SkyRectangularAperture, andSkyRectangularAnnulusfor an aperture whose position frame differs from the WCS celestial frame (e.g., ICRS positions with a Galactic WCS). The rotation anglethetais again measured in the frame of the aperture position. [#2514]
API Changes#
photutils.apertureRestored the
photutils.aperture.stats.DEFAULT_COLUMNSconstant, which was removed in 3.1.0 without a deprecation period. It contains the 3.0 default columns, which do not include theflagscolumn. It is now deprecated and will be removed in version 4.0. Use theApertureStats.default_columnsattribute instead. [#2517]
photutils.segmentationRestored the
photutils.segmentation.catalog.DEFAULT_COLUMNSconstant, which was removed in 3.1.0 without a deprecation period. It contains the 3.0 default columns, which do not include theflagscolumn. It is now deprecated and will be removed in version 4.0. Use theSourceCatalog.default_columnsattribute instead. [#2517]
3.1.0 (2026-10-13)#
General#
The minimum required Python is now 3.12. [#2366]
The minimum required astropy is now 7.0. [#2401]
The minimum required SciPy is now 1.15. [#2365]
The minimum required regions is now 0.10. [#2266]
The minimum required Matplotlib is now 3.10. [#2401]
The minimum required gwcs is now 0.22. [#2266]
The minimum required Shapely is now 2.1. [#2266]
The minimum required tqdm is now 4.67. [#2266]
The
asdfandasdf-astropypackages are now optional dependencies. [#2211]The
pytest-astropypackage is no longer required to run the test suite. Thetestextra now lists the individual pytest plugins. [#2486]scikit-image is no longer an optional dependency. The compiled watershed kernel replaced its only runtime use. [#2439]
SciPy is now also a build-time dependency. Its Cython interface to the Brent root finder is used by the compiled code that computes the
SourceCatalogflux radii. [#2406]All lazily computed class attributes now use
functools.cached_propertyinstead of the astropylazypropertydecorator. [#2366]
New Features#
Added an ASDF extension with converters to serialize all photutils apertures and PSF models. [#2211, #2335, #2341, #2498]
photutils.apertureAdded a new
AperturePhotometryclass, which is now the recommended tool for aperture photometry. It uses a results-object pattern, similar toApertureStats. The class is immutable after construction, so instances are thread-safe and independent frames can be processed concurrently. [#2328, #2331]Added an
n_threadskeyword toAperturePhotometryandApertureStatsto compute the aperture sums and statistics using multiple threads. The aperture positions are divided into chunks and processed concurrently, producing results identical to the single-threaded computation. [#2367]Rectangular apertures now support the
method='exact'mask mode. Previously this fell back to a 32x subpixel approximation. [#2291]Significantly improved the performance of aperture photometry, typically by factors of ~2-25 depending on the aperture shape and overlap method, by computing all sources in a single call into compiled code. The computation also releases the GIL and uses no global state, so aperture photometry can now be parallelized across threads, including on free-threaded Python builds. [#2292, #2441, #2451]
Added new
PolygonApertureandSkyPolygonApertureclasses for polygon apertures defined by a fixed shape applied at one or more positions. [#2297]Added
to_polygonmethods to the circular, elliptical, and rectangular apertures (both pixel and sky variants) to convert them toPolygonApertureorSkyPolygonApertureobjects. [#2298]Added
segmentation_image,labels, andmask_methodkeywords toAperturePhotometryandApertureStatsto mask or correct the flux from neighboring sources within an aperture using aSegmentationImage. [#2309, #2321, #2328, #2440]Significantly improved the performance of elliptical, rectangular, and convex polygon aperture photometry, typically by a factor of ~2. [#2310]
Significantly improved the performance of
ApertureStats, typically by factors of ~5-15 depending on the requested properties, by computing all sources in a single call into compiled code. Sigma-clipped statistics are also computed in compiled code for the commonSigmaClipconfigurations. [#2314, #2446]Added
mean_errandmedian_errproperties toApertureStatsproviding the standard error of the mean and the standard error of the median, respectively, for each aperture. [#2314]Added a
ddofkeyword toApertureStatsto set the delta degrees of freedom used when computing thevarandstdproperties. The default isddof=0(population variance), andddof=1gives the sample (unbiased) variance. [#2314]Added per-source bitwise quality flags to aperture photometry and statistics. The
AperturePhotometryandApertureStatsclasses provide aflagsattribute (and a'flags'column, or'flags_<i>'columns for multiple apertures, in their defaultto_table()output). TheApertureStats.flagsproperty reports conditions from both the “center”-method footprint used by the value statistics and thesum_methodfootprint used by the sum properties. A newdecode_aperture_flagsfunction decodes the flag values into human-readable names, and both classes have adecode_flagsconvenience method that returns a dictionary keyed by aperture position id. [#2327, #2328, #2362, #2379, #2400]Added validation of the
ApertureStats.to_table()columnskeyword. [#2329]Improved the performance of the sigma-clipped
ApertureStatsorder statistics (min,max,median),mad_std, and biweight properties. [#2364]Added an
as_ellipsekeyword to theto_pixelandto_skymethods ofCircularAperture,CircularAnnulus,SkyCircularAperture, andSkyCircularAnnulus. IfTrue, the image of the circle under the local linear WCS is returned as an elliptical aperture, which differs from a circle when the pixels are not square or the WCS is sheared. [#2428]The
to_pixelmethods of the sky apertures now invert the WCS once, for the aperture positions, and reuse that pixel position for the shape conversion. The elliptical and rectangular annuli convert both of their shapes with one evaluation of the local WCS Jacobian in each direction. Together with the faster WCS helpers, theto_skyandto_pixelmethods of all apertures are two to five times faster. [#2425]Added an
ApertureStatssky_orientationproperty providing the position angle on the sky of the source major axis, measured from North toward East, computed by transporting the pixel covariance matrix through the local WCS Jacobian. [#2433]
photutils.backgroundUpdated
LocalBackgroundso thatQuantityinput data is supported, consistent with the background estimator classes andBackground2D. The result is aQuantitywith the same unit as the input data. [#2363]Added an
n_threadskeyword toBackground2Dto compute the box statistics using multiple threads. The results are identical to the single-threaded computation. The underlying sigma-clipping and statistics kernels release the GIL, so multithreading can significantly speed up the background estimation for large images. [#2363]The
Background2Dn_threadskeyword also multithreads the interpolation of the low-resolution meshes to the full-size maps returned by thebackgroundandbackground_rmsproperties (for the ‘reflect’ and ‘mirror’ interpolation boundary modes, with SciPy 1.16 or later). The multithreaded maps are identical to the single-threaded maps up to floating-point rounding. [#2365]Significantly improved the performance of
Background2Dby computing the sigma clipping and the box statistics in a single combined pass in compiled code when thesigma_clip,bkg_estimator, andbkg_rms_estimatorinputs are among the standard supported options. This includes all of the standard photutils background and background RMS estimator classes. The Cython code releases the GIL and composes with then_threadskeyword. Unsupported inputs (e.g., custom estimator callables) fall back to the previous implementation and produce the same results as before. [#2364]Improved the performance of the background and background RMS estimator classes when called with
axis=None(the default) and a supportedsigma_clipby routing the sigma clipping through astropy’s fast C implementation. [#2364]Significantly improved the performance of
LocalBackgroundwhen thebkg_estimatoris a standard photutils estimator class, by computing the local backgrounds for all positions with the batchedApertureStatskernels instead of a Python loop over the apertures. [#2364]Added an
n_threadskeyword toLocalBackground, passed through to its internalApertureStatscomputation to measure the local backgrounds using multiple threads. The results are identical to the single-threaded computation. [#2367]
photutils.centroidsphotutils.detectionAdded validation of the
StarFinderCatalogBase.to_table()columnskeyword. This is the base class used by theDAOStarFinder,IRAFStarFinder, andStarFindercatalogs. Thecolumnskeyword now accepts a single string in addition to a list of column names. [#2329]Added a
min_n_pixelskeyword toIRAFStarFinderto set the minimum number of positive sky-subtracted pixels within the kernel footprint that a source must have. It is equivalent to thenpixminparameter in IRAF’s starfind. [#2510]
photutils.isophoteOptimized the
build_ellipse_model_cCython extension by adding module-level compiler directives (boundscheck=False,wraparound=False,cdivision=True), using C-contiguous memory views, declaringmath.hfunctions asnogil, and replacing Python function-pointer dispatch with a directif/elsebranch for harmonic corrections. The module is now also marked asfreethreading_compatible=True. [#2293]Added validation of the
IsophoteList.to_table()columnskeyword. Also restored thenpix_eandnpix_cproperties to thecolumns='all'output. [#2329]
photutils.profilesImproved the performance of the profile classes by computing the aperture photometry and unmasked areas for all radii in a single batched
AperturePhotometrycall instead of one photometry and one area calculation per radius. Profile construction is now ~3x faster. [#2371]The profile classes are now thread-safe. All lazily computed attributes cache raw (unnormalized) values that are immutable once computed. [#2371]
photutils.psfImproved
GriddedPSFModelevaluation performance by ~20-25% through optimizations that reduce per-evaluation overhead and streamline interpolation calculations. [#2289, #2307]GriddedPSFModelandImagePSFnow evaluate their interpolating splines, and the spline derivatives used byfit_deriv, with a compiled kernel instead of separatescipyspline calls. For fit regions of 5 x 5 to 25 x 25 pixels,GriddedPSFModelevaluation is ~3-8x faster and itsfit_derivis ~6-14x faster, andImagePSFevaluation is ~1.2-3x faster and itsfit_derivis ~2-5x faster. The models also cache only one set of spline coefficients, which is about a third of the memory that the cached splines used whenfit_derivis evaluated. TheGriddedPSFModelcache is no longer included when the model is pickled. [#2455, #2456]The
ImagePSF.copymethod now builds the cached interpolating spline on the model before copying it, so that the copies share the spline instead of each building their own.PSFPhotometryandIterativePSFPhotometrycopy the model for every source and previously rebuilt the spline each time. PSF photometry with a 361 x 361 pixel PSF image is ~6x faster. [#2456]Added a
STDPSFGrid.grid_shapeproperty returning the(ny, nx)shape of the ePSF grid. [#2347]Added an
n_threadskeyword toPSFPhotometryandIterativePSFPhotometryto fit the source groups using multiple threads. The results are identical to the single-threaded computation. The fitting holds the Python global interpreter lock (GIL), so multithreading speeds up the fitting only on a free-threaded Python build. When the GIL is enabled, a warning is issued and the sources are fitted in a single thread. [#2457]Added a
GriddedPSFModel.grid_shapeproperty returning the(ny, nx)shape of the ePSF grid, matching theSTDPSFGridproperty of the same name. It replaces thegrid_shapemetadata key, which has been removed. [#2360]STDPSFGridand theGriddedPSFModelreadmethod now accept path-like inputs (e.g.,pathlib.Path) in addition to strings. [#2355]SourceGroupernow scales to large source lists by computing the connected components of the minimum-separation graph with a KD-tree instead of building a dense pairwise distance matrix. [#2389]Added an analytic Jacobian (
fit_deriv) toImagePSFandGriddedPSFModel, which allows the fitter to skip the finite-difference Jacobian during PSF fitting. This removes roughly 60% of the model evaluations performed during fitting. Withfill_value=None, a point outside the PSF image takes the value at the nearest point on the image edge, so its position derivative along that axis is zero. [#2393, #2455, #2456]Added
MoffatPRFandAiryDiskPRFmodels, which are Moffat and Airy disk profiles integrated over the detector pixels. UnlikeMoffatPSFandAiryDiskPSF, they conserve flux for an undersampled PSF and give unbiased fluxes when fit to the pixel values of an image, with fittable shape parameters. [#2473]Added an analytic Jacobian (
fit_deriv) toGaussianPRF,CircularGaussianPRF,CircularGaussianSigmaPRF,MoffatPSF, andAiryDiskPSF. Astropy fitters use it in place of finite-difference derivatives. [#2472]The
extract_starsfunction now accepts a plain 2D array, or a list of 2D arrays, as the inputdata. AnNDDataobject is needed only to input an uncertainty, a mask, or a WCS. [#2481]Added a
constrain_fluxesmethod toLinkedEPSFStarand aconstrain_fluxeskeyword toEPSFBuilder(defaultTrue) that constrains the fluxes of linked stars (the same star observed in multiple dithered images) to their mean value after each fitting iteration, in addition to their centers. This breaks the degeneracy between the flux of a star and its subpixel position caused by intra-pixel sensitivity variations, which would otherwise be absorbed into the ePSF. [#2420]Added
smoothing_kernelandfit_shapeattributes toEPSFBuildResultsthat report the smoothing kernel and fitting box used in the final iteration. [#2421]Added an
alias_passbandkeyword toEPSFBuilderthat controls the low-pass filter that is applied to an oversampled ePSF in each iteration. The filter removes structure that repeats with a period of one detector pixel or shorter. The keyword sets the highest spatial frequency that the filter leaves unchanged, in cycles per detector pixel, which corresponds to a period of1 / alias_passbanddetector pixels. The default of'auto'uses 0.8 (0.7 for an oversampling factor of 2). A value of 0.85 or 0.9 recovers the peak of the ePSF of a strongly undersampled detector, 0.7 rejects more noise for better-sampled data, andNoneturns the filter off. [#2465]Added a
refinement_iterskeyword toEPSFBuilder(default 5). After the building iterations, the ePSF is refined for an oversampling factor of 4 or larger. Each refinement iteration updates the ePSF with the star centers and fluxes held fixed, using a weaker low-pass filter that keeps structure that repeats with a period of about one detector pixel, and then refits the stars. This restores the real signal of an undersampled ePSF that the alias low-pass filter of the building iterations removes, which otherwise shows as a ripple pattern along the row and the column through the center of the ePSF. The convergence attributes ofEPSFBuildResultsthen describe the last refinement iteration. [#2465]Added
iteration_epsfsanditeration_infoattributes toEPSFBuildResultsthat hold the ePSF image and the convergence statistics of each building and refinement iteration, aninitial_epsfattribute that holds the image of the input ePSF (if any), and aplot_iterationsmethod that plots the ePSF after each iteration and its change from the previous one. [#2466, #2477]Added a
center_asymmetryattribute toEPSFBuildResultsthat gives the offset of the center of mass of the built ePSF from its symmetry center, i.e., how much the measured star positions depend on the definition of the ePSF center. [#2488]Added a
wing_smoothingkeyword toEPSFBuilder(defaultTrue). The wings of the final ePSF, beyond 3.5 FWHM from its center, are now smoothed with least-squares quadratic fits in boxes 1.25 to 1.75 FWHM wide, which lowers their noise. The core of the ePSF changes only by the renormalization of the smoothed ePSF (less than 0.03 percent in tests). The smoothing also removes real structure in the wings that is finer than about two FWHM, so setwing_smoothing=Falsefor large star samples of high signal-to-noise. With an oversampling factor of 1 it can make the wings of a strongly undersampled ePSF less accurate. [#2467]Added a
converged_fractionkeyword toEPSFBuilder(default 0.95) giving the fraction of the successfully fitted stars whose centers must change by less thancenter_accuracybetween iterations for the build to converge, so that a few spurious or contaminated stars whose centers never settle do not prevent convergence. The fraction achieved in the final iteration is reported in the newfinal_converged_fractionattribute ofEPSFBuildResults. Setconverged_fraction=1.0for the previous behavior. [#2422]EPSFBuildernow builds the ePSF spline interpolators once per iteration instead of once per star and stacks the star residuals in a single vectorized operation instead of a loop over the stars, which makes each build iteration about 20% faster. [#2422]Added a
PSFPhotometryandIterativePSFPhotometryflag (bit 4096,position_outside_fit_region) that is set when the fitted source position is outside the region of fitted data, which is thefit_shapebox around the initial position, trimmed to the input image. [#2450]Added a
make_epsf_from_psffunction that makes an ePSF image from an oversampled PSF image whose values are samples of the PSF and are not integrated over the detector pixels. Image PSF models made from such an image do not conserve flux for undersampled PSFs. Themidpointskeyword gives an ePSF with the PSF center on its central grid point for a PSF that is centered on an even-sized image. [#2470]
photutils.segmentationAdded validation of the
SourceCatalog.to_table()columnskeyword. [#2329]SegmentationImageobjects now always have aninfoattribute, a dictionary containing auxiliary information. Segmentation images returned bydeblend_sourcesstore the input labels affected by deblending warnings under'non_positive_min_labels'and'too_many_markers_labels'keys. [#2378]Added a
get_label_mappingmethod toSegmentationImageto find the mapping of labels to another segmentation image defined on the same pixel grid, e.g., mapping the original (parent) labels to the deblended (child) labels between segmentation images made before and after deblending. [#2382]Added
SourceCatalogcentroid_err,x_centroid_err,y_centroid_err,centroid_win_err,x_centroid_win_err,y_centroid_win_err,centroid_quad_err,x_centroid_quad_err, andy_centroid_quad_errproperties providing the 1-sigma errors on the isophotal, windowed, and quadratic centroid positions, propagated from the inputerrorarray. [#2397]Added
SourceCatalogsky_centroid_err,sky_centroid_ra_err,sky_centroid_dec_err, and the correspondingsky_centroid_win_*andsky_centroid_quad_*properties providing the 1-sigma sky position errors in arcsec, computed by transporting the pixel centroid error covariance through the local WCS Jacobian. [#2399]Added a
SourceCatalogsky_orientationproperty providing the position angle on the sky of the source major axis, measured from North toward East, computed by transporting the pixel covariance matrix through the local WCS Jacobian. [#2430]Added a bitwise quality-flag system for segmentation. A new public
SEGMENTATION_FLAGSregistry anddecode_segmentation_flagsfunction were added.SegmentationImageobjects now have aflagsattribute with per-label flags,deblend_sourcesrecords per-source deblending provenance flags, andSourceCataloghas a newflagsattribute and default table column combining provenance and measurement flags, along with adecode_flagsconvenience method that returns a dictionary keyed by source label. [#2402]Significantly improved the performance of the
SourceCatalogwindowed centroids, quadratic centroids, Kron radii and photometry,flux_radius,circular_photometry, image moments,perimeter,gini, segment pixel statistics (e.g.,segment_flux,segment_area,area, andmin_value), and the positions of the minimum and maximum pixel values (e.g.,min_value_indexandmax_value_xindex), typically by factors of ~3-20 depending on the property, by computing all sources in a single call into compiled code. Theflagsattribute and the defaultto_table()output are about 5 times faster for large catalogs. No property displays a progress bar anymore (see theprogress_bardeprecation under API Changes). [#2406, #2446, #2447]Added an
n_threadskeyword toSourceCatalogto compute the compiled per-source measurements (the isophotal moments and their errors, the segment pixel statistics, the windowed and quadratic centroids,perimeter, the Kron radii and photometry,circular_photometry, andflux_radius), and thus every property derived from them, using multiple threads. The sources are divided into chunks that are processed concurrently, producing results identical to the single-threaded computation. [#2407]Significantly improved the performance of source deblending in
deblend_sourcesandSourceFinder, producing identical results. The multithreshold watershed markers are now built by compiled code. Deblending is typically ~7-30 times faster, both for fields of many small blended sources and for large segments with many markers. [#2408, #2413, #2463]Added an
n_threadskeyword todeblend_sourcesandSourceFinderto deblend the sources using multiple threads. The sources are divided into chunks and processed concurrently, producing results identical to the single-threaded computation. Each chunk is deblended by a few compiled calls that release the GIL, so multithreading speeds up deblending for fields of many small sources as well as for large sources. [#2409, #2413]Added a
contrast_methodkeyword todeblend_sourcesandSourceFinderto select the flux used by the deblending contrast criterion. The default ofNonecurrently resolves to'basin', which preserves the existing behavior (the fraction is the total flux in the source’s watershed basin, with iterative removal of below-contrast basins), and may change to'saddle'in version 4.0. The new'saddle'method instead measures the flux a source holds above the saddle level where it separates from its neighbors. [#2411]Added a
release_cachemethod toSourceCatalogto free the cached full-image working arrays used by the compiled code. Working copies are made when the input image arrays do not have a commonfloat32orfloat64dtype. [#2446]Added
centroid_win_fallbackandcentroid_quad_fallbackboolean properties toSourceCatalogthat areTruewhere the windowed or quadratic centroid was substituted by the isophotal centroid or peak pixel, or the value is NaN. [#2450]Added a
kron_radius_measuredproperty toSourceCatalogthat returns the measured unscaled Kron radius before thekron_paramsminimum values are applied. [#2459]Significantly improved the performance of creating a
SegmentationImageand of itslabels,areas, andslicesattributes, producing identical results. They are now measured by compiled code in a single pass over the segmentation array. Creating aSegmentationImageand getting its slices is typically ~3-15 times faster, depending on the number of labels and the fraction of labeled pixels. [#2464]
photutils.utilsAdded a new
DeblendWarningclass, a subclass of astropy’sAstropyUserWarning, which is raised bydeblend_sourceswhen the deblending mode is changed to a fallback mode for one or more sources. [#2378]Added a new
PhotutilsDeprecationWarningclass, a subclass of astropy’sAstropyDeprecationWarning, which is now used for all Photutils deprecation warnings. The class name identifies Photutils as the source of the warning. Existing warning filters forAstropyDeprecationWarningcontinue to match. [#2417]Added
compute_pixel_areasandcompute_pixel_area_mapfunctions to compute the on-sky area of image pixels from a WCS, either at an array of positions or for every pixel in an image. The map is interpolated from a coarse grid by default, or evaluated exactly at every pixel withinterpolate=False. [#2427, #2431]
Bug Fixes#
photutils.apertureFixed the local WCS Jacobian computation used by the aperture
to_skyandto_pixelmethods so that it is well-conditioned at the celestial poles and across the RA = 0/360 degree wraparound. [#2286]Fixed
RectangularAperture,RectangularAnnulus, and their sky counterparts to use the SVD-based ellipseto_skyandto_pixelconversions so that they round-trip correctly with a sheared WCS. [#2286]Fixed the aperture
to_skyandto_pixelconversions for elliptical and rectangular apertures (and their annulus variants) so that the orientation is correct for a WCS with a flipped parity (e.g., North down, East left). Previously, such apertures were mirrored about the x-axis. [#2288]Fixed
CircularAnnulus,EllipticalAnnulus, andRectangularAnnulusoverlap masks so that pixel fractions are never negative. Previously, boundary pixels could contain tiny negative values (of order the floating-point epsilon) from subtracting the inner and outer overlaps. [#2314]Fixed a corner case in
ApertureStatswheresum_aper_areawas NaN whilesumwas finite. When all pixels selected by the “center” method are masked but unmasked boundary pixels still have nonzerosum_methodoverlap fractions, the fractional area of those pixels is now returned, consistent withsum. [#2314]Fixed the aperture photometry so that the returned flux errors always have the same length as the fluxes when
erroris not input. Previously, an all-NaN error array was returned only for sources with no overlap with the data. [#2316]Fixed the elliptical and rectangular apertures (and their annulus and sky variants) so that reassigning
thetaafter construction updates the aperture geometry. Previously, the rotation angle was computed only once, so the bounding box, aperture mask, and photometry silently continued to use the original angle. [#2348]Fixed
BoundingBoxso that it can be used in asetor as adictkey. Defining__eq__without__hash__had left the class unhashable. [#2348]Fixed
PixelAperture.area_overlapso that it no longer modifies the data of the aperture mask it creates when amaskis input. [#2348]Fixed the annulus apertures so that reassigning an inner or outer shape parameter after construction validates the inner < outer invariant. [#2362]
Fixed a thread-safety issue in
ApertureStatsby using a copy of the user’sSigmaClipinstance. [#2364]Fixed the aperture photometry flux error propagation so that each pixel variance is weighted by the squared aperture overlap fraction. Previously, the linear overlap fraction was used, which overestimated the flux errors by a few percent for small apertures. This affects the flux errors from
AperturePhotometry,aperture_photometry, andApertureStats.sum_err. TheApertureStats.error_sum_cutoutvalues are now the pixel errors multiplied by the aperture mask weights, so their quadrature sum equalssum_err. [#2398]Fixed
ApertureStats.error_sum_cutoutbeing calculated infloat32precision for afloat32inputerrorarray. It is now calculated infloat64, as are all of the other statistics. [#2446]Fixed the
exactmethod ofEllipticalApertureandEllipticalAnnulus(and their sky variants) returning incorrect overlap fractions, including values greater than 1, when a pixel edge is tangent to the ellipse or a pixel corner lies exactly on it. [#2497]Fixed the
ApertureStatscentroid,x_centroid,y_centroid,sky_centroid, andsky_centroid_icrsproperties for an aperture whose bounding box extends beyond the left or bottom edge of the data. Previously, the centroid was offset by the size of the part of the bounding box outside of the data. [#2505]Fixed the
to_skyandto_pixelmethods of the elliptical and rectangular annulus apertures raising aValueErrorfor a sheared WCS when the inner and outer shapes have different aspect ratios. The inner shape is now the converted outer shape scaled by the input inner-to-outer size ratios, which is always a valid annulus and is recovered exactly by the inverse conversion. [#2505]Fixed
aperture_photometryandPixelAperture.do_photometryreturning a sum of zero for an aperture whose bounding box overlaps the data but that has no weighted pixel inside the data. The sum is now NaN, the same as for an aperture whose bounding box does not overlap the data. [#2505]Fixed
ApertureStatsraising anAttributeErrorfor aregions.SkyRegioninput without awcs. AValueErroris now raised, the same as for aSkyAperture. [#2505]Fixed
BoundingBox.intersectionreturning aBoundingBoxwith zero width or height for two bounding boxes that share only an edge or a corner.Noneis now returned. [#2505]
photutils.backgroundFixed the
exclude_percentilebox-exclusion criterion inBackground2Dso that a box is excluded only if more thanexclude_percentilepercent of its pixels are masked, as documented. Previously, a box with exactly that percentage of masked pixels was excluded, andexclude_percentile=0excluded all boxes, even fully unmasked ones. [#2363]Background2Dnow raises a clearTypeErrorif the inputmaskorcoverage_maskis not a boolean array. Previously, a nonbooleancoverage_maskraised a crypticIndexError(or could silently select the wrong pixels) when the background map was computed. [#2363]Fixed
BiweightLocationBackgroundandBiweightScaleBackgroundRMSraising an error for a scalarMinput, either for a Python scalar withaxis=Noneor for any scalar with a positive integeraxis. [#2492]Fixed
LocalBackgroundso that nonfinite data values in the annulus are always excluded. Previously, they were kept (giving a nonfinite or NaN result) for a custombkg_estimatoror one withsigma_clip=None, depending on the estimator type. [#2492]
photutils.centroidsFixed
centroid_quadraticto fit the quadratic in coordinates centered on the peak pixel, avoiding ill-conditioning at large pixel coordinates that could cause failures and spurious NaN results. [#2368]Fixed the centroid functions using the masked values of an input
MaskedArraythat has a hard mask. [#2491]Fixed
centroid_2dgto raise aValueErrorif the unmasked data are constant. Previously, constant data with a masked or nonfinite pixel was fit and a meaningless position was returned. [#2491]centroid_quadraticandCentroidQuadraticnow emit a warning wheneverfit_boxsizeis larger than the data and is reduced. Previously, no warning was emitted if the data size along the axis was odd. [#2491]
photutils.datasetsFixed
make_wcsso that the WCSpixel_shapeattribute is set in (nx, ny) order. The WCS transformation itself was unaffected. [#2374]Fixed
make_model_imageraising aValueErrorfor a source whose model bounding box ends exactly at the lower edge of the image. Such sources do not overlap the image and are now skipped. [#2484]
photutils.detectionFixed
DAOStarFinderandIRAFStarFinderorientationoutput to return a value in the range (-90, 90] degrees instead of incorrectly wrapping it to [0, 360) degrees (which only ever produced values in the disjoint ranges [0, 90] and (270, 360)). This also makes it consistent withApertureStats.orientationandSourceCatalog.orientation. [#2317]Fixed integer indexing of the star finder catalog classes when multidimensional per-source attributes (e.g., image moments or cutouts) had already been computed. Previously, the integer index dropped the leading source axis of those cached arrays, and accessing dependent properties on the indexed catalog raised an
IndexError. [#2377]DAOStarFinderandIRAFStarFindernow raise aValueErrorif any inputxycoordsposition is outside the bounds of the input data. [#2377]Fixed
IRAFStarFinderreturning no sources when the kernel footprint covers the entire kernel array (e.g.,fwhmvalues between about 4.45 and 4.7 with the defaultsigma_radius). There are then no pixels to estimate the local sky, which was NaN for every source. As in IRAFstarfind, the sky is now the central data value minus the central convolved data value in that case. [#2492]Fixed the
DAOStarFinderandIRAFStarFindercentroids being offset when the inputxycoordsare not integers. The input positions are now rounded to the nearest pixel. [#2492]Fixed the
find_peaksmin_separationkeyword (also used by the star finder classes) so that the local region is a circle of that radius centered on each pixel. Previously, the region was larger than the circle for radii smaller than 2 pixels (e.g., diagonal neighbors were suppressed formin_separation=1) and was offset by half a pixel for most noninteger radii. Small radii are also faster. [#2493]Fixed the
DAOStarFinderfluxto be the sum of the data values within the kernel footprint, as documented. Previously, it was the sum over the entire rectangular kernel array, which includes pixels beyond the truncation radius of the Gaussian kernel. Thefluxvalues are therefore smaller, themagvalues are larger, and the sources selected byn_brightestmay differ. [#2493]Fixed
find_peaks(and the star finder classes, which use it) so that masked pixels can no longer suppress nearby peaks within the local region. Masked pixels are now replaced by the minimum finite data value before peak detection, the same treatment already applied to NaN pixels. Previously, a masked pixel (e.g., a flagged cosmic ray or hot pixel) with a value larger than a nearby true peak prevented that peak from being detected. [#2377]StarFindernow validates the inputkernelvalues. The kernel must contain only finite values and have a positive maximum. [#2377]Fixed the
DAOStarFinderroundness1values for a non-square kernel, which can occur for an elliptical kernel (ratio < 1). As in DAOFIND,roundness1is now computed over the central square of the kernel array. Previously, it was computed over the entire rectangular kernel array. The sources selected byroundness_rangemay therefore differ for such kernels. Square kernels are not affected. [#2510]DAOStarFindernow rejects sources whose centroid is outside of the image, as in DAOFIND. Such sources could previously be returned for peaks in the pixels at the image edges. [#2510]IRAFStarFindernow rejects sources with fewer than 5 positive sky-subtracted pixels within the kernel footprint by default, as in IRAF’s starfind. Previously, only 2 such pixels were required, so fewer faint sources may be returned. Setmin_n_pixels=2to recover the previous behavior. [#2510]IRAFStarFindernow rejects sources whose centroid is outside of the image, as in IRAF’s starfind. [#2510]
photutils.isophoteChanged
booltobintin_ellipse_model.pyxto fix a compilation issue with Cython 3.1.x. [#2260]Fixed spurious NumPy “Mean of empty slice” and related warnings raised during isophote fitting when a trial or failed isophote has an elliptical path that falls entirely (or largely) outside the image. [#2283]
Fixed
EllipseSamplenot resettingEllipseGeometrycached attributes when overridingsma. [#2280]Fixed a compilation issue in
_ellipse_model.pyxwith Cython 3.3, which no longer allows tuples of typed memoryviews. [#2404]Fixed an issue when fitting isophotes with the
'nearest_neighbor'integration mode. At small semimajor axes, nearest-neighbor sampling could measure a local intensity gradient of exactly zero, and the resulting division by zero corrupted the ellipse geometry. [#2405]
photutils.morphologyFixed
data_propertiesso that abackgroundinput with units is preserved. Previously, the units were stripped, and a confusing units-mismatch error was raised whendatawas aQuantity. [#2370]Fixed
data_propertiesandginito use the mask of anumpy.ma.MaskedArrayinput. Previously, the mask was ignored and the masked values were included in the calculations. [#2499]
photutils.profilesFixed
RadialProfile.data_profileso that its values are always consistent with the current profile normalization. Previously, ifnormalizewas called beforedata_profilewas first accessed, the raw (unnormalized) values were returned, and a subsequentunnormalizecall then incorrectly multiplied those raw values by the normalization. [#2371]Fixed
RadialProfile.data_profileto return aQuantitywhen the input data is aQuantity, consistent with theprofileattribute. [#2371]Fixed the
RadialProfiledata_radiusanddata_profileattributes so that pixels whose centers lie exactly at the maximum input radius are included on all sides of the center. Previously, such pixels were excluded on the upper-x and upper-y sides of the center. [#2371]Fixed the profile
plotmethod so that the y-axis label no longer includes the data unit after the profile has been normalized (a normalized profile is dimensionless). [#2371]Fixed the
RadialProfilegaussian_fitandmoffat_fitattributes forQuantityinput data. Previously, aUnitsErrorwas raised for an unnormalized profile and the model amplitude had inverse data units for a normalized profile. [#2494]The profile classes now raise a
ValueErrorfor an invalidmethodorsubpixelsvalue, or fordatathat is not 2D, when the class is created. Previously, the error was raised only when the profile was first computed. [#2494]The profile
normalizemethod now emits a warning and leaves the profile unchanged when the maximum or sum of the profile is negative. Previously, the profile was divided by the negative value, which reversed its sign. [#2494]The
RadialProfiledata_radiusanddata_profileattributes now exclude pixels whose centers lie inside the minimum input radius, consistent with the binned profile. Previously, only the maximum input radius was applied. [#2494]A
Quantityradii(orhalf_sizes) input to the profile classes now raises aTypeError. Previously, the units were silently dropped. [#2371]The
profile_errorvalues of the profile classes are now slightly smaller because the aperture photometry flux error propagation now weights each pixel variance by the squared aperture overlap fraction. [#2398]
photutils.psfFixed a bug where evaluating an
AiryDiskPSFmodel with an array-valuedfluxat input coordinates with fewer dimensions than thefluxarray raised aValueError. [#2473]Fixed a bug where calling
PSFPhotometrywith aninit_paramstable containing agroup_idcolumn permanently disabled the grouper for all subsequent calls on the same instance. [#2383]Fixed a bug where nonfinite data values were not merged into a user-provided mask, causing fit failures in
fit_2dgaussian,fit_fwhm, andPSFPhotometry. [#2383]Fixed a bug where grouped fits could silently reuse a stale cached flat-model class when multiple PSF models of the same class (e.g., two different
ImagePSFmodels) were used, producing incorrect photometry. The flat-model class cache is now stored per fitter instance. [#2384]Fixed a bug where PSF model parameter bounds were not applied in grouped fits, so grouped fits were unconstrained where single-source fits were constrained. The bounds are now also propagated back to the fitted models, so the
PARAMETER_NEAR_BOUNDflag is now set for grouped sources. [#2384]Fixed a bug where
PSFPhotometryraised an error for integer-dtype data when alocal_bkgcolumn was provided. [#2384]An
init_paramstable column that has a unit attribute (e.g., from aTableinstead of aQTable) is now converted to the data unit instead of raising an error claiming the column has no units. The error message for a truly unitless column now suggests using aQuantitycolumn. [#2384]Fixed a bug where
EPSFBuilderrejected allLinkedEPSFStarinputs as invalid stars, a regression introduced in version 3.0. [#2385]Fixed a bug where the
EPSFBuilderstar exclusion warning raised aTypeErrorfor stars with the default (None) or stringid_labelvalues. The warning message now always reports the flat star index and includes the id label when available. [#2385]Fixed a bug where the
EPSFStarslicesandbboxattributes were transposed for nonsquare cutouts. [#2386]Fixed a bug where the ePSF building flux renormalization used stale cached values, so every iteration normalized the star data with the first-iteration flux instead of the updated fitted flux. [#2386]
Fixed a bug where the
n_pixels_fitresults column leaked into the tables returned by thePSFPhotometryresults_to_init_paramsandresults_to_model_paramsmethods (asn_pixels_initandn_pixelscolumns) and into the deprecatedfit_paramstable. [#2387]PSFPhotometrynow raises aValueErrorif theinit_paramstable contains duplicateidvalues. Previously, duplicate ids silently produced a results table with extra mispaired rows. [#2387]Fixed a bug where
PSFPhotometry.finder_resultsretained the results from a previous call when a subsequent call providedinit_params(so the finder was not used). [#2387]PSFPhotometrynow raises aValueErrorif theinit_paramstable has no rows. [#2387]Fixed a bug where the
PSFPhotometryfit_infolist was not reordered to match the results table when theinit_paramstable was not sorted by theidcolumn. [#2387]Fixed a bug where the
reduced_chi2calculation emitted a divide-by-zero warning when the number of fit pixels equaled the number of fit parameters. NaN is now returned without a warning when there are no degrees of freedom. [#2387]The
PSFPhotometrygroup_warning_thresholdkeyword is now validated to be a positive integer. [#2387]Fixed a bug where
IterativePSFPhotometrywithmode='all'raised an error when an earlier iteration produced a source with nonfinite fit results. Such sources are now dropped from later iterations. [#2387]Fixed a bug where
IterativePSFPhotometrywithmode='all'did not carry the local background values into iterations after the first, so sources were refit with a local background of zero. [#2387]Fixed a bug where a callable
finderreturning a zero-row table caused an error inIterativePSFPhotometry. The iteration now stops cleanly. [#2387]Fixed a bug where the
IterativePSFPhotometrymake_model_imageandmake_residual_imagemethods raised a confusing error after a run in which no sources were detected. They now raise a clearValueError. [#2387]The
IterativePSFPhotometrysub_shapekeyword is now validated at initialization to have odd, positive values, matching the documented requirement. Themaxiterskeyword validation now also rejects nonnumeric and boolean inputs. [#2387]Fixed a bug where the
GaussianPSFandGaussianPRFbounding boxes treated a floatthetavalue (in degrees) as radians, producing incorrect bounding-box extents for rotated models. [#2388]Fixed a bug where
AiryDiskPSFreturned the peak value instead of NaN for NaN input coordinates. [#2388]Fixed the default lower bound of the
MoffatPSFbetaparameter, which rounded to exactly 1.0 instead of being strictly greater than 1. [#2388]CircularGaussianPSFandCircularGaussianPRFnow raise aUnitsErrorduring fitting when the x and y inputs have different units, consistent with the other Gaussian models. [#2388]Fixed the normalization prefactor shown in the
AiryDiskPSFdocstring and documented that the rotatedGaussianPRFpixel integration is performed along the rotated principal axes of the Gaussian. [#2388]Fixed
stdpsf_readerandSTDPSFGridto accept an already-openastropy.io.fits.HDUListor file object. Such inputs were previously accepted by the low-level reader but then raised aTypeErrorwhen parsing the metadata. [#2347, #2388]Fixed
webbpsf_readerto correctly read files containing a single 2D PSF. The data was previously reshaped with the new axis in the wrong position, raising aValueError. [#2388]GriddedPSFModelnow raises aValueErrorifgrid_xyposcontains duplicate positions. Previously, duplicate positions could silently produce an invalid grid. [#2388]Fixed
GriddedPSFModel.copyso that the copy has its ownmetadictionary. Previously, setting theoversamplingon a copy also changed themetadictionary of the original model. [#2388]Fixed
plot_gridfor integer-dtype ePSF grids, which raised a casting error withdeltas=Trueorpeak_norm=True. Also, with bothdeltas=Trueandpeak_norm=True, the differences are now normalized by the average ePSF peak, as documented, instead of the maximum difference value. [#2388]Fixed
GriddedPSFModel.evaluateandImagePSF.evaluateto accept scalar coordinates when called directly. [#2388]Fixed
GriddedPSFModel.readto raise the standard format identification error for a corrupt file with a FITS extension instead of anOSError. [#2388]Fixed a bug where
SourceGrouperraised an error for scalar x and y inputs whenreturn_groups_object=True. 2D coordinate arrays now raise a clearValueError, andSourceGroupsnow validates that the input coordinates are finite. [#2389]Fixed a bug where the interpolation of masked pixels in ePSF building raised an error for integer-dtype star data. The interpolation is now always performed in float. [#2389]
Fixed a bug in
make_psf_model_imagewhere thefluxkeyword was silently ignored for models whose flux parameter has a different name (e.g., models output frommake_psf_model). The keyword is now mapped to the model’s flux parameter name. [#2389]Fixed a bug where the
EPSFStarsstar counts and flat star list were stale after deleting a star from the container. [#2390]Fixed a bug where
extract_starscould modify a user-supplied weights uncertainty array when masking pixels. [#2390]extract_starsno longer requires every input image to have a WCS when multiple catalogs are input. A WCS is now required only for images whose catalog provides only sky coordinates. [#2390]EPSFStarnow raises aTypeErrorforQuantityinput data. Previously,Quantitydata produced confusing downstream errors. [#2390]Fixed a bug where an even
EPSFBuildershapevalue raised an error instead of being made odd by adding one (with a warning), as documented. [#2390]Fixed the
EPSFBuilderminimum-shape validation to match the automatically derived ePSF shape. Previously, ashapeequal to the derived shape could be rejected as too small when the star size times the oversampling factor was odd. [#2390]EPSFBuildernow raises aValueErrorif the initial ePSF model passed tobuild_epsfhas an oversampling that does not match the builder oversampling. [#2390]Fixed a bug where a fitter that raised a
TypeErrorduring ePSF fitting was silently retried without weights. Whether the fitter supports weights is now determined from its call signature. [#2390]Fixed a bug where the
make_model_imageandmake_residual_imagemethods raised an error withinclude_local_bkg=Truewhen no local background values were available. The local background is now treated as zero. [#2391]Fixed a bug where the initial flux estimates in
fit_2dgaussianandfit_fwhmincluded pixels masked by themaskkeyword, corrupting the fit starting point. [#2395]Fixed a bug where interpolating missing data during ePSF building raised a
QhullErrorwhen fewer than three valid pixels remained or all valid pixels were collinear. Nearest-neighbor interpolation is now used as a fallback. [#2395]Fixed a bug where the
parameter_near_boundflag (bit 32) was only set for bounds applied via thexy_boundskeyword. The flag is now set when any fitted parameter is very close to its bounds, including bounds set directly on the PSF model. [#2395]AiryDiskPSFnow evaluates to zero at infinite radial distance, matching the other PSF models. Previously, it returned NaN. [#2395]Fixed the
CircularGaussianPSF.fit_derivpartial derivative with respect tofwhm. This affected only fits in which thefwhmparameter was unfixed. [#2347]Fixed
ImagePSFto discard its cached interpolator when thedataattribute is set. Previously, assigning a new image to an existing model silently continued to evaluate the old image. Thedataandoversamplingattributes are now also validated when set, not only when the model is created. [#2347]Fixed the
GriddedPSFModel.originattribute, which returned a three-element array instead of the documented(x, y)pair. The spurious third element was derived from the number of ePSFs in the grid. Model evaluation was unaffected because it used only the first two elements. [#2347]Fixed the
filtermetadata parsed from the filename when reading a gzipped STDPSF file (e.g.,.fits.gz). The file extension was not removed, so the filter name included the extension. [#2347]Fixed
webbpsf_readerto swap theDET_YX{i}FITS header values when defininggrid_xypos. The reference ePSFs were previously swapped to the wrong detector positions for any grid whose x and y positions differ. [#2347]Fixed
SourceGroups.plotto sample a user-supplied colormap over its full range. Previously the colormap was indexed by the group number, which gave nearly identical colors for every group (and raised anIndexErrorfor more than 256 groups). [#2347]Fixed the
plot_gridtitle when the instrument, detector, or filter metadata is missing. The missing values left stray spaces in the title. [#2347]Fixed an all-zero row and column at one edge of the ePSF built by
EPSFBuilder. The recentering step shifts the ePSF with its spline, and the edge that moved outside the grid was filled with zero instead of being extrapolated. [#2418]Fixed a checkerboard pattern in ePSFs built by
EPSFBuilderwithoversamplinggreater than one from heterogeneous or contaminated stars. Each star pixel residual is now deposited on the oversampled grid points within 0.375 pixel (and at least one grid spacing) of the pixel center, so that every star contributes to both parities of the grid regardless of its subpixel phase, and structure that repeats with a period of about one input pixel or shorter is removed from the ePSF in each iteration. A warning is now emitted if the subpixel phases of the fitted star centers are strongly nonuniform, which indicates biased star centers. [#2419, #2465]Fixed a bug where
EPSFBuilderraisedNonFiniteValueErrorwhen a star cutout contained a nonfinite (e.g., NaN) pixel inside the fitting region. A star whose fitting region is fully masked is now treated as a fit failure instead of raising an error. [#2423]Fixed the
copymethods ofImagePSFandGriddedPSFModelso that the copies no longer share the parameter array, the constraints, and the constraints cache that astropy keeps on each model instance. Copies fitted at the same time in several threads interfered with each other. The parameters of a copy now also refer to the copy instead of the original model. [#2453]GriddedPSFModelnow computes the bilinear interpolation weights of the grid PSFs in double precision whengrid_xyposhas a single-precision dtype. The weights were computed in single precision, which limited the model values to about 8 significant digits. [#2455]Fixed
PSFPhotometry,IterativePSFPhotometry, andextract_starsraising aValueErrorfor a source whose fit region or cutout ends exactly at the lower edge of the image. Such sources do not overlap the image and are now flagged or skipped. [#2484]Fixed
PSFPhotometryandIterativePSFPhotometryreturning zero for the fixed model parameters of grouped sources. [#2508]PSFPhotometryandIterativePSFPhotometrynow raise aValueErrorwith a clear message if all the parameters of the PSF model are fixed. [#2508]The
qfitandcfitvalues ofPSFPhotometryandIterativePSFPhotometryare now0.0instead of-0.0for an exact fit. [#2509]Fixed
LinkedEPSFStar.constrain_centerscomputing wrong star centers for a WCS whose latitude axis comes first (e.g.,CTYPE1 = 'DEC--TAN'). [#2508]Fixed
extract_starsraising aTypeErrorfor anNDDatauncertainty that cannot be converted to a standard deviation (e.g.,UnknownUncertainty, whichNDDatacreates for a plain array). Such an uncertainty is now assumed to be a standard deviation. [#2508]Fixed
stdpsf_readersetting theinstrumentand instrument detector name in themetaof the returnedGriddedPSFModelonly when adetector_idwas input. For a file with a single detector, the metadata no longer depends ondetector_id, andmeta['detector']is now the detector name (e.g.,'A1') instead of the filename field (e.g.,'NRCA1').STDPSFGridsets the same metadata. [#2508]Fixed
fit_2dgaussianandfit_fwhmraising aNoOverlapErrorfor a position whose fit region lies completely outside the image. Such a source is now flagged in thefit_2dgaussianresults and has a NaNfit_fwhmvalue. [#2508]Fixed the aperture-based initial flux of
PSFPhotometryandIterativePSFPhotometrywhen a local background is used. The per-pixellocal_bkgvalue was subtracted once from the aperture sum. It is now multiplied by the aperture area first. For sources found in a later iteration ofIterativePSFPhotometrywithmode='all', the local background was not subtracted at all. Only the initial guess (theflux_initcolumn) changes. [#2508]
photutils.psf_matchingmake_wiener_kernelnow validates a custompenaltyarray. It must be 2D with odd dimensions in both axes, contain only finite values, and not be all zeros. [#2372]make_kernelandmake_wiener_kernelnow raise aValueErrorif the computed kernel contains nonfinite values, which can occur when the Fourier-space denominator is zero at frequencies where the numerator is also zero. [#2372]make_wiener_kernelnow raises aValueErrorstating thatregularizationmust be positive when it is NaN. Previously, an unrelated error about a nonfinite kernel was raised. [#2494]Fixed the window classes for nonsquare shapes. The window radii are now defined relative to the size of the array along each axis, so the window is elliptical instead of circular. Previously, a window passed to
make_kernelormake_wiener_kernelwith nonsquare PSFs cut off lower spatial frequencies along the longer axis, which made the matching kernel too narrow along that axis. Windows for square shapes are unchanged. [#2495]Fixed
resize_psfto return a PSF with the requested pixel scale. The output pixel scale wasinput_pixel_scale * (n_in - 1) / (n_out - 1), wheren_inandn_outare the input and output sizes, which made the resized PSF too broad or too narrow by up to several percent. The output size is now the largest odd size for which the output grid lies within the outermost pixel centers of the input PSF, which can be smaller than before. [#2474]resize_psfnow raises aValueErroriforderis not an integer from 0 to 5. The exception was aRuntimeErroror aTypeError, depending on the value. [#2508]
photutils.segmentationFixed
SourceCatalog.orientationto return a value in the range (-90, 90] degrees instead of incorrectly wrapping it to [0, 360) degrees (which only ever produced values in the disjoint ranges [0, 90] and (270, 360)). This also makes it consistent withApertureStats.orientation. [#2317]SegmentationImage.remove_border_labelsnow raises aValueErrorfor nonpositiveborder_widthvalues. Previously,border_width=0(and negative widths) silently removed every label because the entire array was treated as the border region. [#2378]Fixed
SourceCatalogslicing so that the sliced catalog no longer shares its custom-properties list (and other mutable containers, such asmeta) with the parent catalog. [#2378]Fixed
SourceCatalog.segment_fluxso that the local-background subtraction uses the number of unmasked pixels actually summed. Previously, with adetection_cataloginput and a different mask, the local background was multiplied by the detection catalog’sarea, oversubtracting the background. [#2378]deblend_sourceswithcontrast=1(no deblending) now honorsrelabel=True, relabeling nonconsecutive input labels like every other code path. [#2378]SourceCatalog.add_propertynow raises aValueErrorfor names of built-in methods (e.g.,to_table). [#2378]Fixed the
SourceCatalogkron_flux_errandcircular_photometryflux errors so that each pixel variance is weighted by the squared aperture overlap fraction. [#2398]Fixed
SourceCatalog.background_centroidbeing calculated infloat32precision for afloat32inputbackgroundarray. It is now calculated infloat64, as are all of the other source properties. [#2446]Fixed a crash in
deblend_sourceswhen the inputSegmentationImagehas auint64data type. [#2462]Fixed
SegmentationImageanddeblend_sourcesrunning out of memory for a 2D segmentation image with very large label values (e.g.,2**40). Theslices,bbox, andsegmentsattributes, therelabel_consecutive,reassign_labels,keep_labels, andremove_labelsmethods, and the relabeling indeblend_sourcesallocated memory in proportion to the largest label value. They now use memory in proportion to the number of labels. [#2464]Fixed a
ValueErrorwhen getting theslicesattribute of a zero-sizeSegmentationImage. An empty list is now returned. [#2464]Fixed the
SourceCatalogsky_bbox_ul,sky_bbox_lr, andsky_bbox_urproperties, which were one pixel beyond the bounding box along its upper and right edges. [#2502]Fixed
SourceCatalog.select_labelandselect_labelsreturning the wrong source or raising anIndexErrorfor a label that is in the segmentation image but not in a sliced catalog. AValueErroris now raised. [#2503]Fixed
SourceCatalog.flux_radiusreturning the radii of thedetection_catalogwhen one was input. The radius is now measured in the catalogdataas a fraction of its own Kron flux. [#2503]Fixed the
SourceCatalogquadratic centroid setting the pixels of its 3x3 fitting box that are outside of the source segment to zero, which biased the centroid of a source whose peak pixel is next to the edge of its segment. The unmasked pixels of the box, including the pixels of neighboring sources, are now fit with theirdatavalues. [#2503]Fixed the Kron flags and flux error of a
SourceCatalogsource that is completely masked in the catalog but not in itsdetection_catalog. Itskron_flux_erris now NaN and thekron_undefinedflag is set instead ofkron_non_finite_data. [#2503]Fixed the
SegmentationImagedeblended_labels,deblended_label_to_parent, andparent_to_deblended_labelsattributes keeping removed deblended labels as label 0 and listing merged deblended labels more than once. A label merged from the deblended labels of more than one parent is kept under each of its parents. [#2503]Fixed
deblend_sourceswith the'basin'contrast method including NaN pixels in the flux of a deblended source, which made that flux NaN and changed which sources passed the contrast criterion. [#2503]Fixed
deblend_sourceswithcontrast=1(no deblending) returning theinfo,flags, and deblended labels of an input segmentation image that was itself deblended, and not validating the inputlabels. [#2503]
photutils.utilsFixed a thread-safety issue in
ImageDepthby using a copy of the user’sSigmaClipinstance. [#2364]Fixed the
orientationandsky_orientationproperties ofSourceCatalogandApertureStatsreturning -90 degrees, outside of the documented (-90, 90] range, for a source with a negative-zero covariance. [#2500]Fixed
ImageDepthso that repeated calls on the same instance no longer accumulate thefluxesattribute across calls. The result attributes now always reflect only the most recent call. [#2375]Fixed a crash in
calc_total_errorwhen the inputdataarray has an integer data type. [#2375]The local WCS Jacobians and pixel scales used by the aperture
to_skyandto_pixelmethods and by theSourceCatalogsky position errors are now computed with central finite differences (half a pixel on either side of the position) instead of one-sided 1-pixel differences. [#2425]The WCS helper functions now evaluate a
gwcstransform with its bounding box disabled. Previously, sources within half a pixel of the array edge received NaN Jacobians and pixel scales because the finite-difference offsets fell outside the bounding box. [#2425]Fixed
CutoutImageraising aValueErrorinstead of aNoOverlapErrorwhenshapeis a NumPy array and the cutout ends exactly at the lower edge of the data. [#2484]
API Changes#
photutils.apertureThe
PixelAperture.do_photometrymethod is now deprecated and will be removed in version 4.0. Use the newAperturePhotometryclass instead. [#2324, #2328]The
ApertureStatsinertia_tensorproperty is deprecated and will be removed in version 4.0. It carries no information beyond thecovariancematrix. [#2500]The default
ApertureStats.to_table()columns now include a'flags'column. [#2327, #2379]The
ApertureStats.idsattribute is now deprecated and will be removed in version 4.0. Use theApertureStats.idattribute instead. [#2331]The
ApertureStats.n_aperturesattribute is now deprecated and will be removed in version 4.0. Use the newApertureStats.n_positionsattribute instead, which matchesAperturePhotometry.n_positions. [#2362]AperturePhotometryandApertureStatsnow validate themethod/sum_methodandsubpixelskeywords when the object is created instead of when a measured attribute is first accessed. [#2348]ApertureStatsnow stores thesegmentation_image,labels, andmask_methodinputs as public attributes, matchingAperturePhotometry. [#2348]The
'aperture_photometry_args'metadata in theAperturePhotometry.to_table()output now also records themask_methodkeyword. [#2348]BoundingBox.__eq__now returnsNotImplementedinstead of raising aTypeErrorwhen the other object is not aBoundingBox, so that comparing aBoundingBoxto another type returnsFalserather than raising. [#2348]The
maskinput to aperture photometry and the aperturearea_overlapmethod must now be a boolean array (orNone). [#2362]The
PixelAperture.plotmethod now returns a list of patches for scalar apertures, as documented, instead of a tuple. [#2362]The
to_pixelandto_skymethods of the circular apertures now use the geometric mean of the two singular values of the local WCS Jacobian (the square root of its absolute determinant) as the isotropic pixel scale for every WCS. The scale preserves the area of the mapped circle and inverts exactly, so a conversion to pixels and back returns the original radius. Previously, a distorted WCS or agwcsused the arithmetic mean of the singular values, and an undistortedastropy.wcs.WCSused the geometric mean of the x and y pixel scales. The radii are unchanged for an undistorted WCS with orthogonal pixel axes. [#2425]The
ApertureStatscovarianceis now regularized by raising each eigenvalue to at least1/12pixel**2 instead of adding1/12to both diagonal elements when the determinant is below(1/12)**2. Thin sources that are unresolved along only their minor axis are now regularized, the variance along a resolved axis is no longer inflated, and the result is continuous. This affects the covariance-derived shape properties of unresolved sources (those with thesingular_covarianceflag). An exactly thin tilted source, whose covariance determinant is zero apart from rounding, is now regularized instead of having NaN shape properties. [#2437]
photutils.datasetsThe
load_irac_psfandload_simulated_hst_star_imagefunctions are now deprecated and will be removed in version 4.0. [#2476]make_model_imagenow also skips sources that have a nonfinite'local_bkg'value. Previously, a nonfinite local background was added to the source region, propagating NaN or inf values into the output image. [#2374]make_model_imagenow determines the output image units up front from the parameter table column units, so the output units no longer depend on whether any sources are actually rendered (e.g., a zero-row table or sources that are skipped or do not overlap the image). [#2374]make_model_imagenow validates thediscretize_methodkeyword and the values in a'model_shape'column (which must be finite and positive) up front with clear error messages. Previously, invalid values raised cryptic errors from within the source loop or silently rendered nothing. [#2374]The
make_model_imageshapeargument now also accepts a single integer, which is used for both dimensions, consistent withmake_model_params. [#2374]The
make_model_paramsoutput table now includes the creation date and photutils version metadata, consistent withmake_random_models_table. [#2374]make_wcswithgalactic=Truenow returns a WCS with a tangent (TAN) projection instead of a plate carree (CAR) projection, so that it is equivalent to themake_gwcsWCS. [#2499]make_model_paramsnow raises aValueErrorif a keyword argument is namedidor has the same name asx_nameory_name, andmake_random_models_tablenow raises aValueErrorifparam_rangescontains an'id'key. Previously, the ID or position column was silently replaced. [#2499]make_model_imagenow raises aValueErrorwith a clear message if aparams_tablecolumn has units andparams_tableis not aQTable. [#2499]
photutils.detectionThe
reprandstroutput ofStarFinderCatalogBasenow labels the number of sources asn_sourcesinstead ofnsourcesfor naming consistency. [#2338]The star-finder cutout centers used for the shape and flux measurements now round half-integer pixel positions half away from zero instead of half to even, consistent with the rounding convention used elsewhere in photutils. [#2375]
The
find_peaksmin_separationkeyword (also used by the star finder classes) now returns only one peak for pixels with identical values that are withinmin_separationof each other. A group of connected equal-valued peak pixels (e.g., a saturated star) is replaced by its pixel nearest to the centroid of the group, and only one of any remaining equal-valued peaks that are separated bymin_separationor less is kept. All returned peaks are now separated by more thanmin_separationpixels. Previously, all pixels that were tied for the maximum were returned. Use a circularfootprintfor the previous behavior. [#2506]
photutils.geometryThe
circular_overlap_grid,elliptical_overlap_grid, andrectangular_overlap_gridfunctions now validate theuse_exactandsubpixelsinputs, raising aValueErrorfor values outside the documented ranges. [#2369]
photutils.profilesThe radius methods of the curve-of-growth classes (
calc_radius_at_eeofCurveOfGrowthandEllipticalCurveOfGrowth, andcalc_half_size_at_eeofEnsquaredCurveOfGrowth) now return the smallest radius at which the interpolated profile reaches the given energy, for every energy in the profile range. They are now consistent with the energy methods (calc_ee_at_radiusandcalc_ee_at_half_size). Previously, they used only the part of a noisy profile before its first decrease, returned NaN for larger energies, and raised aValueErrorif the profile did not increase at its smallest radii. [#2496]The encircled energy methods of the curve-of-growth classes now return a
Quantitywhen the input data has units, and the radius methods accept aQuantityenergy. The encircled energy methods now raise aTypeErrorfor aQuantityradius. Previously, its units were silently dropped. [#2496]
photutils.psfThe default
recentering_funcofEPSFBuilderis nowcentroid_symmetryinstead ofcentroid_com. The ePSF is centered on the point about which its core is most symmetric, which is the definition of Anderson 2016, instead of its center of mass. For an asymmetric PSF the star positions fit with the built ePSF change by a constant offset, up to about 0.1 pixel for undersampled space-telescope PSFs. The center of mass is still used if the symmetry center cannot be calculated, and a warning is emitted if the recentering box is too small for it. Userecentering_func=centroid_comfor the previous behavior. [#2488]The convergence of an
EPSFBuilderbuild is now measured from the changes of the star centers relative to their median change, which must also be less thancenter_accuracy. A change that is common to all the stars is a shift of the ePSF center, and one that is smaller thancenter_accuracyno longer delays the convergence. Thefinal_center_accuracyattribute and themax_center_shiftcolumn ofiteration_infoare the relative changes, and the newcommon_center_shiftcolumn is the median change. [#2488]GaussianPRFis now integrated exactly over the detector pixels for any rotation angle. Previously, the integration was performed along the rotated principal axes of the Gaussian, which was exact only fortheta = 0. The model values change for a rotated Gaussian with different x and y widths, by up to about 1% of the peak for a FWHM of 1 pixel. Such models are about four times slower to evaluate on a pixel grid. [#2471]The
PSFPhotometry.decode_flagsandIterativePSFPhotometry.decode_flagsmethods now return a dictionary mapping each source id from the results table to its list of active flag names (or bit values), instead of a positional list of lists. This is a backward-incompatible change, made so that decoded flags can be looked up directly by source id (which may not be sequential when custom ids are input) and for consistency with the new aperture and segmentationdecode_flagsmethods. The module-leveldecode_psf_flagsfunction is unchanged and still returns lists. [#2400]The
make_psf_modelfunction is now deprecated and will be removed in version 4.0. Use one of the PSF models provided byphotutils.psf, anImagePSFmade from the output ofmake_epsf_from_psf, or a custom astropyFittable2DModelwithx_0,y_0, andfluxparameters instead. [#2478]Defining a custom interpolator for
ImagePSF, either by overriding theinterpolatorattribute in a subclass or by assigning an interpolator to it on a model, is now deprecated and will be removed in version 4.0. A model with a custom interpolator calls it as before and does not use the compiled spline kernel. [#2456]The
EPSFBuildResultclass returned byEPSFBuilderhas been renamed toEPSFBuildResults. The oldEPSFBuildResultname is deprecated and will be removed in version 4.0. [#2326]The default convergence criterion of
EPSFBuilderhas changed. The build now converges when at least 95% of the successfully fitted stars (the newconverged_fractionkeyword) have met thecenter_accuracy, instead of all of them, so the same inputs may now stop after fewer iterations withconverged=True. Setconverged_fraction=1.0for the previous behavior. [#2422]The
nxpsfsandnypsfsmetadata keys of theGriddedPSFModelreturned when reading a STDPSF file have been removed. They were redundant with thegrid_shapeattribute, which contains the same information as(nypsfs, nxpsfs). [#2344]The
'grid_shape'key has been removed from theGriddedPSFModelmetadictionary. Use the newGriddedPSFModel.grid_shapeattribute instead. [#2360]The
grid_xypos,oversampling, andgrid_shapekeys have been removed from theSTDPSFGridmetadictionary. Themetadictionary now contains only the metadata parsed from the filename (e.g.,STDPSF,detector, andfilter). Use thegrid_xypos,oversampling, andgrid_shapeattributes instead. [#2344]The
STDPSFGridgrid_xyposattribute is now anumpyarray instead of a list, matching theGriddedPSFModelattribute of the same name. Theoversamplingattribute is now a read-only property. [#2344]The
GriddedPSFModelmetadictionary now always stores'grid_xypos'as the sorted array of grid positions and'oversampling'as a normalized(y, x)tuple, so that both always match the attributes of the same name. Previously, these keys held the input values unchanged, which could differ from the attributes in ordering, type, or shape. [#2344]The
reprandstroutput ofGriddedPSFModel,ImagePSF, andSTDPSFGridnow show the oversampling as a tuple (e.g.,(4, 4)) instead of a list ornumpyarray. TheSTDPSFGridoutput now labels the grid shape asGrid shapeinstead ofGrid_shape. [#2344]decode_psf_flagsnow raises aTypeErrorfor boolean flag values instead of treatingTrueas bit value 1. [#2375]The
EPSFBuildercoord_transformerattribute is now deprecated and will be removed in a future version. It is an internal helper object that was never intended to be public. [#2390]EPSFBuildernow supportssigma_clip=Noneto disable sigma clipping when stacking the ePSF residuals, as its docstring already documented. [#2390]The
maskanderrorkeywords ofPSFPhotometryandIterativePSFPhotometrynow raise aValueErrorwhen the input data is anNDDatainstance. Previously, they were silently ignored in favor of theNDDataattributes.NDDatainput is now also documented in the__call__docstrings. [#2395]The error message raised for nonpositive or nonfinite
errorvalues within a fit region now includes the location of the fit region. [#2395]EPSFStarsnow explicitly supports array conversion (e.g.,np.asarrayor passing it to matplotlib’simshow). A container holding a single star (e.g., from indexing) converts to that star’s 2D cutout, and a container holding multiple stars converts to a 3D stack of the cutouts. [#2395]The default
smoothing_kernelandfit_shapeofEPSFBuilderare now'auto'. The smoothing kernel is a least-squares quartic polynomial kernel whose width is the largest odd number of oversampled grid points that is not larger than 0.7 times the FWHM of the ePSF (no smoothing below 5 grid points, i.e., for fewer than about 7 grid points per FWHM), and the fitting box is twice the FWHM of the ePSF in detector pixels (at least 5 pixels and at most the star cutout size). The FWHM is measured in each iteration along the narrowest axis of the ePSF. The previous fixed 5x5'quartic'kernel (in oversampled grid points) and 5-pixel fitting box (in detector pixels) were designed for HST images with an oversampling factor of 4. A fixed kernel oversmooths heavily undersampled ePSFs, and a fixed 5-pixel fitting box applied to a well-sampled star uses only its flat core, which biases the fitted centers and can prevent convergence. The previous behavior is available withsmoothing_kernel='quartic'andfit_shape=5. An invalid string value for either parameter now raises aValueError. [#2421, #2465]The following PSF flags have been renamed, along with their uppercase constants:
outside_bounds(bit 2) toposition_outside_image,negative_flux(bit 4) tonon_positive_flux,near_bound(bit 32) toparameter_near_bound, andnon_finite_localbkg(bit 2048) tonon_finite_local_bkg. The old names are deprecated and will be removed in version 4.0.decode_psf_flagsnow returns the new names. [#2450]
photutils.segmentationThe
SourceCataloginertia_tensorproperty is deprecated and will be removed in version 4.0. It carries no information beyond thecovariancematrix. [#2500]The deblending warning information stored by
deblend_sourcesin the returnedSegmentationImageinfodictionary has been restructured. The affected input labels are now stored as arrays directly under'non_positive_min_labels'and'too_many_markers_labels'keys. The nestedinfo['warnings']dictionary, including its'message'entries, has been removed. The emitted warning is now aDeblendWarning(a subclass of astropy’sAstropyUserWarning) instead of anAstropyUserWarning. [#2378]SegmentationImagenow raises aTypeErrorfor masked array input. [#2381]The conditions for the
SourceCatalogcentroid_winfallback to the isophotal centroid have been expanded. The windowed centroid is reset when it has diverged far from the isophotal centroid and lies outside the 1-sigma ellipse, the total weighted flux is nonpositive, the windowed second-order moments are negative, or the windowed covariance determinant is negative. Previously, only the ellipse condition was applied. [#2397]The
SourceCatalogprogress_barkeyword is now deprecated and will be removed in version 4.0. All property calculations are now computed for all sources at once in compiled code, so no progress bar is displayed and the keyword has no effect. [#2406]The
deblend_sourcesandSourceFinderprogress_barandn_processeskeywords are now deprecated and will be removed in version 4.0, and both keywords no longer have any effect. Deblending is now dominated by compiled code, so no progress bar is displayed, and the multiprocessing implementation has been removed because its process startup and data-pickling overheads made it slower than the serial implementation at any number of sources. [#2408]The
deblend_sourcesandSourceFinderdeblending-mode fallback for sources with nonpositive minimum data values (used withmode='exponential', for which such sources are undefined) was changed from “linear” to “sinh”. The sinh spacing keeps the threshold levels concentrated near the source minimum, recovering faint companions of bright sources that the linear spacing misses, so deblending results can change for the affected sources. The'non_positive_min_labels'info key and thedeblend_non_positive_minflag are unchanged and continue to record the affected sources. [#2410]detect_sourcesnow emits anAstropyUserWarningif thethresholdis negative or, for a threshold array, has any negative values. [#2429]The
SourceCatalogcovarianceis now regularized by raising each eigenvalue to at least1/12pixel**2 instead of adding1/12to both diagonal elements when the determinant is below(1/12)**2. Thin sources that are unresolved along only their minor axis are now regularized, the variance along a resolved axis is no longer inflated, and the result is continuous. This affects the covariance-derived shape properties of unresolved sources (those with thesingular_covarianceflag) and the quantities that are derived from their shape, such as the Kron aperture and the windowed centroid and its errors. An exactly thin tilted source, whose covariance determinant is zero apart from rounding, is now regularized instead of having NaN shape properties. [#2437]
photutils.utilsThe
ImageDepthoverlap_maxiterskeyword is deprecated and will be removed in version 4.0. The keyword was unused and had no effect. [#2500]The
ShepardIDWInterpolatorncoordsattribute has been renamed ton_coords, consistent with then_*naming used elsewhere in photutils. The oldncoordsname is deprecated and will be removed in version 4.0. [#2346]ImageDepthnow creates a fresh random generator initialized withseedon every call instead of consuming a generator shared across calls. With a fixed seed, every call on the same instance now produces identical results. [#2375]ShepardIDWInterpolatornow returns a NumPy scalar for a single input position whenn_neighbors=1, consistent with then_neighbors > 1case. Previously it returned a Python float. [#2375]calc_total_errornow returns an array whose dtype follows the NumPy type promotion of its floating-pointdata,bkg_error, and (array)effective_gaininputs, with a minimum offloat32. Previously the result was alwaysfloat64. For example,float32inputs now give afloat32total error. Integer inputs still give afloat64result, and the results forfloat64inputs are unchanged. A scalareffective_gainis also no longer expanded to a full-size array, which reduces the memory used. [#2438]
3.0.0 (2026-04-17)#
General#
New Features#
photutils.apertureThe
to_skyandto_pixelmethods for all pixel and sky aperture types now use the local WCS Jacobian to accurately compute pixel scale factors and rotation angles. This correctly handles WCS with distortions (e.g., SIP polynomial corrections) and nonsquare pixels. [#2240]
photutils.backgroundAdded a
to_aperturemethod toLocalBackground. [#2118]
photutils.centroidsphotutils.detectionAdded a public
StarFinderCatalogBaseclass that provides a common base for the catalogs in theDAOStarFinder,IRAFStarFinder, andStarFinderclasses. [#2149, #2201]Added
__repr__and__str__methods toDAOStarFinder,IRAFStarFinder, andStarFinder. [#2201]Significantly improved the performance of
DAOStarFinder,IRAFStarFinder, andStarFinderby vectorizing cutout extraction and image moment computation. [#2201]The
thresholdparameter inDAOStarFinder,IRAFStarFinder, andStarFindernow accepts a 2D array in addition to a scalar value, allowing for spatially varying detection thresholds. [#2202]Added a
scale_thresholdparameter toDAOStarFinder. When set toFalse, the inputthresholdis applied directly to the convolved data without the default kernel-based scaling. [#2202]Added a
min_separationkeyword tofind_peaks. The implementation uses fast separable box filters and is approximately 10-400x faster than using an explicit circular footprint withscipy.ndimage.maximum_filter(depending on the radius), while producing identical results. [#2246]
photutils.profilesAdded a
EnsquaredCurveOfGrowthclass to compute a curve of growth using concentric square apertures. [#2184]Added a
EllipticalCurveOfGrowthclass to compute a curve of growth using concentric elliptical apertures with a fixed axis ratio and orientation. [#2184]Added
moffat_fit,moffat_profile, andmoffat_fwhmproperties toRadialProfilefor fitting a 1D Moffat model to the radial profile. [#2185]
photutils.psfAdded a
SourceGroupsclass that stores the results of grouping sources and provides methods to analyze and plot the groupings. [#2116]Added
remove_invalidandreset_idskeywords to theresults_to_init_paramsandresults_to_model_paramsmethods ofPSFPhotometryandIterativePSFPhotometry. [#2131]Added a
decode_flagsconvenience method toPSFPhotometryandIterativePSFPhotometryclasses to decode the bitwise flags from the results table. [#2132, #2136]Added a
return_bit_flagskeyword to thedecode_psf_flagsfunction. [#2136]Added
__repr__methods toImagePSFandGriddedPSFModel. [#2134]Added a
shapeproperty toImagePSF. [#2158]EPSFBuildernow automatically excludes stars that repeatedly fail fitting and emits warnings with specific failure reasons. [#2158, #2165]Added validation and automatic shape handling for
fit_shape=Noneinfit_2dgaussianandfit_fwhm. The functions now require explicitfit_shapefor multiple sources and emit an informative warning for single-source fitting. [#2164]The
fit_fwhmandfit_2dgaussianxyposvalue can now be input as azipobject. [#2164]
photutils.psf_matchingAdded a
regularizationkeyword tomake_kernelto regularize division by near-zero values in the source Optical Transfer Function. [#2170, #2171, #2175]Added
make_wiener_kernelfunction that uses Wiener regularization to make a PSF matching kernel. [#2171, #2172, #2175]make_kernelnow validates input PSFs (2D, odd dimensions, centered) and the window function output. [#2170]resize_psfnow validates input PSFs and pixel scales. [#2170]Added
__repr__methods toCosineBellWindow,HanningWindow,SplitCosineBellWindow,TopHatWindow, andTukeyWindowclasses. [#2176]
photutils.segmentationThe
SourceCatalogfluxfrac_radiusnow caches results byfluxfracvalue. Repeated calls with the samefluxfracreturn the cached result without recomputation. [#2197]The radial step used when searching for a bracketing interval in
SourceCatalogfluxfrac_radiusis now set to 10% of the currentmax_radius, bounding the fallback loop to at most ~10 iterations regardless of source size. [#2197]Improved the performance (~6-9x speedup) of
SourceCatalogmin_value,max_value,segment_flux,segment_flux_err,background_sum, andbackground_mean. [#2199]Added
SegmentationImageget_segmentandget_segmentsmethods to return theSegmentobject(s) for a given label or list of labels. [#2228, #2256]Added the ability to input
RegionVisualkeywords to theSegmentationImageto_regionsmethod. [#2228]Added
SegmentationImageget_polygon,get_polygons,get_patch,get_patches,get_region, andget_regionsmethods to return the polygon, patch, or region for a given segment label or list of labels. [#2232]Improved the performance of the
SegmentationImagekeep_labelsmethod andmissing_labelsattribute. [#2234]Improved the performance of
SourceCatalogcentroid_win(~3.5x speedup),centroid_quad,fluxfrac_radius(~6x speedup),kron_radius(~2x speedup),moments,moments_central,perimeter, and Kron photometry. [#2238]
photutils.utilsSignificantly improved the performance (by factors of 3 or more) of
ShepardIDWInterpolator[#2187].Added a
use_future_column_namescontext manager for temporarily enabling future column names in a scoped, thread-safe, and async-safe way without modifying the globalphotutils.future_column_namesflag. [#2258]
Bug Fixes#
photutils.backgroundFixed
Background2DraisingAttributeErrorwhen passed a function asbkg_estimatororbkgrms_estimatorinstead of a class instance with asigma_clipattribute. [#2181]Fixed silent truncation of background estimates when integer input data were provided to
Background2D. Integer inputs now producenp.float32output to preserve precision from interpolation. [#2181]
photutils.centroidsFixed a bug in
centroid_sourceswhere the input error array could be ignored if more than one source was input. [#2179]
photutils.datasetsFixed a bug in
apply_poisson_noisewhere the returned image could have a different dtype than the input. [#2173]
photutils.detectionphotutils.isophotebuild_ellipse_modelnow integrates over all angles instead of stopping once it hits the edge of the output image. [#2156]
photutils.morphologyFixed issues with negative pixel values input to
gini. [#2178]
photutils.profilesFixed an issue where the mask (input and nonfinite values) was not applied to the raw data profile. [#2184]
photutils.psfPSFPhotometryandIterativePSFPhotometrynow handle nonfinite (NaN or inf) local background values instead of raising an error. Three new flags have been added to identify sources with nonfinite values: flag 512 for nonfinite fitted positions, flag 1024 for nonfinite fitted flux, and flag 2048 for nonfinite local background. [#2131]Fixed a bug in
EPSFBuilderwhere therecentering_boxsizewas being applied in oversampled space instead of the original star pixel space. [#2168]
photutils.segmentationFixed a bug in
SourceCatalogwhere the (x, y) coordinates were swapped in themap_coordinatescall used to interpolate the background at source centroids, causingbackground_centroidto return incorrect values. [#2198]Fixed an issue in
SourceCatalogwhere incorrect masking behavior could occur whenapermask_method='none'. [#2198]Fixed an issue in
SourceCatalogwhere unrealistically largekron_radiusvalues could cause out-of-memory issues. [#2237]
API Changes#
photutilsPassing optional arguments positionally to all functions, classes, and methods in
photutilsis now deprecated. In the future, all optional arguments must be passed as keyword arguments. [#2219]
photutils.apertureThe
ApertureStatscovar_sigx2,covar_sigxy, andcovar_sigy2attributes have been renamed tocovariance_xx,covariance_xy, andcovariance_yy, respectively. The old names are deprecated. [#2241]The
ApertureStatscxx,cxy, andcyyattributes have been renamed toellipse_cxx,ellipse_cxy, andellipse_cyy, respectively. The old names are deprecated. [#2241]The
ApertureStatsdata_sumcutoutanderror_sumcutoutattributes have been renamed todata_sum_cutoutanderror_sum_cutout, respectively. The old names are deprecated. [#2241]The
ApertureStatsget_idandget_idsmethods have been renamed toselect_idandselect_ids, respectively. The old names are deprecated. [#2241]The
ApertureStatssemimajor_sigmaandsemiminor_sigmaattributes/columns have been renamed tosemimajor_axisandsemiminor_axis, respectively. The old names are deprecated. [#2241]The
ApertureStatsxcentroidandycentroidattributes/columns have been renamed tox_centroidandy_centroid, respectively. The old names are deprecated. [#2241]The
xcenterandycentercolumn names in the table returned byaperture_photometryhave been renamed tox_centerandy_center, respectively. The old names are deprecated. [#2241]The
CircularMaskMixin,EllipticalMaskMixin, andRectangularMaskMixinclasses are now deprecated. The mask generation is now handled internally by thePixelAperturebase class. [#2242]
photutils.backgroundRemoved the deprecated
edge_methodkeyword fromBackground2D. [#2102]Removed the deprecated
background_mesh_masked,background_rms_mesh_masked, andmesh_nmaskedproperties fromBackground2D. [#2102]Removed the deprecated
grid_modekeyword fromBkgZoomInterpolator. [#2102]The
interpolatorkeyword argument forBackground2Dis now deprecated. Wheninterpolatoris eventually removed, thescipy.ndimage.zoomcubic spline interpolator will always be used to resize the low-resolution arrays. The behavior will be identical to the current default. [#2108]The
Background2Dnpixels_meshandnpixels_mapproperties have been renamed ton_pixels_meshandn_pixels_map, respectively. The old names are deprecated. [#2241]The
BkgIDWInterpolatorandBkgZoomInterpolatorclasses are now deprecated. [#2108]The
Background2Dbkgrms_estimatorkeyword argument has been renamed tobkg_rms_estimator. The old name is deprecated. [#2241]
photutils.centroidsThe
xpeak,ypeak, andsearch_boxsizekeyword arguments forcentroid_quadraticare now deprecated. Usecentroid_sourcesto centroid sources at specific positions. [#2160]
photutils.datasetsThe
get_path,load_spitzer_image,load_spitzer_catalog, andload_star_imagefunctions are now deprecated and will be removed in a future version. [#2135]
photutils.detectionfind_peaksnow returns aQTableinstead of aTable. [#2201]The
sharploandsharphikeyword arguments forDAOStarFinderandIRAFStarFinderare now deprecated. Use thesharpness_range=(lower, upper)tuple keyword instead. Setsharpness_range=Noneto disable sharpness filtering. [#2216]The
roundloandroundhikeyword arguments forDAOStarFinderandIRAFStarFinderare now deprecated. Use theroundness_range=(lower, upper)tuple keyword instead. Setroundness_range=Noneto disable roundness filtering. [#2216]The
minsep_fwhmkeyword argument forIRAFStarFinderis now deprecated. Usemin_separationinstead. [#2216]The
peakmaxkeyword argument forDAOStarFinder,IRAFStarFinder, andStarFinderis now deprecated. Usepeak_maxinstead. [#2216]The
brightestkeyword argument forDAOStarFinder,IRAFStarFinder, andStarFinderis now deprecated. Usen_brightestinstead. [#2216]The
npeakskeyword argument forfind_peaksis now deprecated. Usen_peaksinstead. [#2241]The default
min_separationforDAOStarFinder,IRAFStarFinder, andStarFinderis nowNone, which computes a default separation of2.5 * fwhm(or2.5 * (min(kernel.shape) // 2)forStarFinder) consistent across all three star finders. [#2216]The
xcentroidandycentroidcolumn/attribute names forDAOStarFinder,IRAFStarFinder, andStarFindercatalog classes are deprecated. Usex_centroidandy_centroidinstead. Thecutout_xcentroidandcutout_ycentroidattributes are also deprecated in favor ofcutout_x_centroidandcutout_y_centroid. [#2241]The
IRAFStarFinderandStarFinderpaattribute/column has been renamed toorientation. The old name is deprecated. [#2241]The
npixcolumn/attribute inDAOStarFinderandIRAFStarFindercatalogs has been renamed ton_pixels. The old name is deprecated. [#2241]The
IRAFStarFinderandStarFinderorientation(waspa) values are now always returned as aQuantityarray in the range [0, 360) degrees. [#2224, #2225]
photutils.isophoteThe
IsophoteandIsophoteListgrad_errorandgrad_r_errorattributes have been renamed togradient_errandgradient_rel_err, respectively. The old names are deprecated. [#2241]The
EllipseSamplegradient_errorandgradient_relative_errorattributes have been renamed togradient_errandgradient_rel_err, respectively. The old names are deprecated. [#2241]The
grad_errorandgrad_rerrorcolumn names in the isophote output table have been renamed togradient_errandgradient_rel_err, respectively. The old names are deprecated. [#2241]The
nclipparameter inEllipse.fit_image,Ellipse.fit_isophote, andEllipseSamplehas been renamed ton_clip. The old name is deprecated. [#2241]The
IsophoteandIsophoteListniter,ndata, andnflagattributes have been renamed ton_iter,n_data, andn_flag, respectively. The old names are deprecated. [#2241]
photutils.profilesCached Gaussian fits to the radial profile are now automatically invalidated when the profile normalization changes, so the fit is always consistent with the current profile. [#2185]
photutils.psfThe
photutils.psf.matchingsubpackage has been moved tophotutils.psf_matching. Importing from the old location is deprecated. [#2167]Removed the deprecated
IntegratedGaussianPRFandPRFAdapterclasses. [#2103]The
grid_from_epsfshelper function is now deprecated. Instead, useGriddedPSFModeldirectly. [#2111]The
EPSFFitterclass is now deprecated. Use thefitter,fit_shape, andfitter_maxitersparameters ofEPSFBuilderinstead. [#2159]Removed the
ModelImageMixinclass. [#2133]Removed the
ModelGridPlotMixinclass. [#2137]Removed the
norm_radiuskeyword fromEPSFBuilder. [#2158]Removed the deprecated
FittableImageModelandEPSFModelclasses. UseImagePSFinstead. [#2158]EPSFBuildernow returns anEPSFBuildResultdataclass containing the ePSF, fitted stars, iteration count, convergence status, and excluded star diagnostics. Tuple unpacking is still supported for backward compatibility. [#2158]LinkedEPSFStarno longer inherits fromEPSFStars. [#2158]The
npixfitcolumn inPSFPhotometryresults has been renamed ton_pixels_fit. The old name is deprecated. [#2241]The
NPIXFIT_PARTIAL(npixfit_partial) PSF flag has been renamed toN_PIXELS_FIT_PARTIAL(n_pixels_fit_partial). The old name is deprecated. [#2241]The
PSFPhotometryandIterativePSFPhotometrylocalbkg_estimatorkeyword argument has been renamed tolocal_bkg_estimator. The old name is deprecated. [#2241]The
PSFPhotometryandIterativePSFPhotometryinclude_localbkgkeyword argument inmake_model_imageandmake_residual_imagehas been renamed toinclude_local_bkg. The old name is deprecated. [#2241]
photutils.psf_matchingRenamed
create_matching_kerneltomake_kernel. The old name is deprecated. [#2171]make_kernelnow raisesValueErrorif PSFs are not 2D, have even dimensions, or do not have the same shape. [#2170]resize_psfnow raisesValueErrorif the PSF is not 2D, has even dimensions, or if pixel scales are not positive. [#2170]make_kernelnow raisesTypeErrorif thewindowparameter is not callable. [#2170]
photutils.segmentationThe
SourceCatalogorientationproperty is now always returned in the range [0, 360) degrees. [#2224]The
SegmentationImagenlabels,data_ma,deblended_labels_map, anddeblended_labels_inverse_mapattributes have been renamed ton_labels,data_masked,deblended_label_to_parent, andparent_to_deblended_labels, respectively. The old names are deprecated. [#2241]The
Segmentdata_maattribute has been renamed todata_masked. The old name is deprecated. [#2241]The
SourceCatalogdata,error,background, andsegmentattributes have been renamed todata_cutout,error_cutout,background_cutout, andsegment_cutout, respectively. The old names are deprecated. [#2241]The
SourceCatalogdata_ma,error_ma,background_ma, andsegment_maattributes have been renamed todata_cutout_masked,error_cutout_masked,background_cutout_masked, andsegment_cutout_masked, respectively. The old names are deprecated. [#2241]The
SourceCatalogconvdataandconvdata_maattributes have been renamed toconv_data_cutoutandconv_data_cutout_masked, respectively. The old names are deprecated. [#2241]The
SourceCatalogcutout_minval_indexandcutout_maxval_indexattributes have been renamed tocutout_min_value_indexandcutout_max_value_index, respectively. The old names are deprecated. [#2241]The
SourceCatalogminval_index,maxval_index,minval_xindex,minval_yindex,maxval_xindex, andmaxval_yindexattributes have been renamed tomin_value_index,max_value_index,min_value_xindex,min_value_yindex,max_value_xindex, andmax_value_yindex, respectively. The old names are deprecated. [#2241]The
SourceCatalogcovar_sigx2,covar_sigxy, andcovar_sigy2attributes/columns have been renamed tocovariance_xx,covariance_xy, andcovariance_yy, respectively. The old names are deprecated. [#2241]The
SourceCatalogcxx,cxy, andcyyattributes/columns have been renamed toellipse_cxx,ellipse_cxy, andellipse_cyy, respectively. The old names are deprecated. [#2241]The
SourceCatalogsegment_fluxerrandkron_fluxerrattributes/columns have been renamed tosegment_flux_errandkron_flux_err, respectively. The old names are deprecated. [#2241]The
SourceCatalogfluxfrac_radiusattribute has been renamed toflux_radius. The old name is deprecated. [#2241]The
SourceCatalogget_labelandget_labelsmethods have been renamed toselect_labelandselect_labels, respectively. The old names are deprecated. [#2241]The
SourceCatalogadd_extra_property,remove_extra_property,remove_extra_properties, andrename_extra_propertymethods have been renamed toadd_property,remove_property,remove_properties, andrename_property, respectively. Theextra_propertiesattribute has been renamed tocustom_properties. The old names are deprecated. [#2241]The
SourceCatalognlabelsandlocalbkg_widthattributes have been renamed ton_labelsandlocal_bkg_width, respectively. The old names are deprecated. [#2241]The
SourceCatalogsemimajor_sigmaandsemiminor_sigmaattributes/columns have been renamed tosemimajor_axisandsemiminor_axis, respectively. The old names are deprecated. [#2241]The
SourceCatalogxcentroid,ycentroid,xcentroid_win,ycentroid_win,xcentroid_quad, andycentroid_quadattributes/columns have been renamed tox_centroid,y_centroid,x_centroid_win,y_centroid_win,x_centroid_quad, andy_centroid_quad, respectively. The old names are deprecated. [#2241]The
SourceCatalogsegment_img,localbkg_width,apermask_method, anddetection_catkeyword arguments have been renamed tosegmentation_image,local_bkg_width,aperture_mask_method, anddetection_catalog, respectively. The old names are deprecated. [#2241]The
SourceFindernpixels,nlevels, andnprocattributes have been renamed ton_pixels,n_levels, andn_processes, respectively. The old names are deprecated. [#2241]The
nsigmaparameter indetect_thresholdhas been renamed ton_sigma. The old name is deprecated. [#2241]The
npixelsparameter indetect_sourceshas been renamed ton_pixels. The old name is deprecated. [#2241]The
segment_img,npixels,nlevels, andnprocparameters indeblend_sourceshave been renamed tosegmentation_image,n_pixels,n_levels, andn_processes, respectively. The old names are deprecated. [#2241]The
npixels,nlevels, andnprocparameters inSourceFinderhave been renamed ton_pixels,n_levels, andn_processes, respectively. The old names are deprecated. [#2241]The
SourceCatalogto_tabledefault columns no longer includeslocal_background. [#2252]
photutils.utilsThe
ImageDepthnsigma,napers, andnitersparameters have been renamed ton_sigma,n_apertures, andn_iters, respectively. The old names are deprecated. Thenapers_usedattribute has also been renamed ton_apertures_used. [#2241]The
make_random_cmapncolorsparameter has been renamed ton_colors. The old name is deprecated. [#2241]The
ShepardIDWInterpolatorregparameter in__call__has been renamed toregularization. The old name is deprecated. [#2241]
2.3.0 (2025-09-15)#
General#
New Features#
photutils.isophotephotutils.psfPSFPhotometryandIterativePSFPhotometrynow raise an error if the inputerrorarray contains nonfinite or zero values. [#2022]GriddedPSFModelcan now be used with a single input ePSF model, which will be equivalent toImagePSF. [#2034]The
findercallable input toPSFPhotometryandIterativePSFPhotometryis no longer restricted to have x and y column names of'xcentroid'and'ycentroid'. The allowed column names are now the same as those allowed in theinit_paramstable. [#2072]Added a
group_warning_thresholdkeyword toPSFPhotometryandIterativePSFPhotometry. [#2081]The
PSFPhotometryandIterativePSFPhotometryclasses no longer fail for invalid sources, defined as those that have no overlap with the input data, are completely masked, or have too few unmasked pixels for a fit. These classes have new flags (64, 128, 256, respectively) for these invalid conditions. [#2084, #2085]The
PSFPhotometryandIterativePSFPhotometryclasses have newresults_to_init_paramsandresults_to_model_paramsmethods for outputting fit results in different formats. [#2084]When using Astropy 7.0+, the
PSFPhotometryandIterativePSFPhotometryfitterobject now modifies the PSF model in place instead of creating a copy, improving performance and significantly reducing memory usage in some cases. [#2093]PSFPhotometryandIterativePSFPhotometrynow return a reduced chi-squared statistic (reduced_chi2column in the results table). [#2086]The PSF photometry classes now use a dynamically generated “flat” model instead of a compound model for grouped sources. This eliminates recursion limits and significantly reduces memory usage for large groups. [#2100]
Added a
decode_psf_flagsutility function for decoding PSF photometry bit flags. [#2090]Added a
PSF_FLAGSobject to hold all PSF photometry bit flags in one place. PSF_FLAGS provides readable, named constants for each bit flag and helper utilities for decoding bit flags. [#2091]
photutils.segmentation
Bug Fixes#
photutils.centroidsphotutils.datasetsFixed a bug in
make_model_imagewhere the output image would not have units in the case where the input params had units and none of the models overlapped the image shape. [#2082]Fixed a bug in
make_model_imagewhere an error would be raised if any row in the input parameters table contained nonfinite model parameters. Such sources are now silently ignored. [#2083]
photutils.psfFixed a bug in
fit_2dgaussianandfit_fwhmwhere the fit would fail if there were NaN values in the input data. [#2030]Fixed the check in
GriddedPSFModelfor rectangular pixel grids. [#2035]Fixed a bug in
PSFPhotometrywhere the'group_id'column would be ignored if included in theinit_paramstable. [#2070]Fixed a bug in
PSFPhotometrywhere the outputflux_errcolumn would not have units if the input data had units and the flux model parameter was fixed in value. [#2072]Fixed a bug in
PSFPhotometryandIterativePSFPhotometrywhere an error would be raised if the x or y columns ininit_paramshad units. [#2079]Fixed a bug in
PSFPhotometryandIterativePSFPhotometryfor the boundary conditions where flag=2 would be set. [#2080]Fixed a bug in
EPSFBuilderwhere the output PSF would have the wrong shape if the inputstarswere nonsquare cutouts. [#2089, #2092]Fixed a bug in the calculation of the
PSFPhotometryandIterativePSFPhotometryqfitandcfitto not include the fit weights. [#2099]
photutils.segmentation
API Changes#
photutils.backgroundAn explicit
ValueErroris now raised if the inputdatatoBackground2Dcontains all nonfinite values. [#2062]
photutils.psfphotutils.segmentationThe
SegmentationImagepolygonslist may now include either ShapelyPolygonorMultiPolygon(noncontiguous) objects. [#2060]The
SegmentationImageto_patchesandplot_patchesmethods now returnmatplotlib.patches.PathPatchobjects. [#2060]The
SegmentationImageto_regionsmethod now returnsPolygonPixelRegionregions that have the segment label stored in the objectmetadictionary. [#2060]
2.2.0 (2025-02-18)#
New Features#
photutils.apertureAdd an
aperture_to_regionfunction to convert an Aperture object to an astropyRegionorRegionsobject. [#2009]
photutils.profilesAdded
data_radiusanddata_profileattributes to theRadialProfileclass for calculating the raw radial profile. [#2001]
photutils.segmentationAdded a
to_regionsmethod toSegmentationImagethat converts the segment outlines to aregions.Regionsobject. [#2010]
Bug Fixes#
photutils.segmentationFixed an issue where the
SegmentationImagepolygonsattribute would raise an error if any source segment contained a hole. [#2005]
API Changes#
photutils.apertureThe
thetaattribute ofEllipticalAperture,EllipticalAnnulus,RectangularAperture, andRectangularAnnulusis now always returned as an angularQuantity. [#2008]
2.1.0 (2025-01-06)#
General#
New Features#
photutils.apertureThe
aperture_photometryoutput table will now include asky_centercolumn ifwcsis input, even if the input aperture is not a sky aperture. [#1965]
photutils.datasetsA
params_mapkeyword was added tomake_model_imageto allow a custom mapping between model parameter names and column names in the parameter table. [#1994]
photutils.detectionThe
find_peaksborder_widthkeyword can now accept two values, indicating the border width along the y and x edges, respectively. [#1957]
photutils.morphologyAn optional
maskkeyword was added to theginifunction. [#1979]
photutils.segmentationAdded
deblended_labels,deblended_labels_map, anddeblended_labels_inverse_mapproperties toSegmentationImageto identify and map any deblended labels. [#1988]
Bug Fixes#
photutils.segmentationFixed a bug where the table output from the
SourceCatalogto_tablemethod could have column names with anp.str_representation instead ofstrrepresentation when using NumPy 2.0+. [#1956]Fixed a bug to ensure that the dtype of the
SegmentationImagelabelsalways matches the image dtype. [#1986]Fixed an issue with the source labels after source deblending when using
relabel=False. [#1988]
API Changes#
photutils.apertureThe
xcenterandycentercolumns in the table returned byaperture_photometryno longer have (pixel) units for consistency with other tools. [#1993]
photutils.detectionWhen
exclude_borderis set toTruein theDAOStarFinderandStarFinderclasses, the excluded border region can be different along the x and y edges if the kernel shape is rectangular. [#1957]Detected sources that match interval ends for sharpness, roundness, and maximum peak values (
sharplo,sharphi,roundlo,roundhi, andpeakmax) are now included in the returned table of detected sources byDAOStarFinderandIRAFStarFinder. [#1978]Detected sources that match the maximum peak value (
peakmax) are now included in the returned table of detected sources byStarFinder. [#1990]
photutils.morphologyThe
ginifunction now returns zero instead of NaN if the (unmasked) data values sum to zero. [#1979]
photutils.psf
2.0.2 (2024-10-24)#
Bug Fixes#
Due to an upstream bug in
bottleneckwithfloat32arrays,bottlenecknan-functions are now used internally only forfloat64arrays. Performance may be impacted for computations involving arrays with dtype other thanfloat64. Affected functions are used in theaperture,background,detection,profiles,psf, andsegmentationsubpackages. This change has no impact ifbottleneckis not installed.photutils.backgroundFixed a bug in
Background2Dwhere an error would be raised when using theBkgIDWInterpolatorinterpolator when any mesh was excluded, e.g., due to an input mask. [#1940]
photutils.detectionFixed a bug in the star finders (
DAOStarFinder,IRAFStarFinder, andStarFinder) whenexclude_border=True. Also, fixed an issue withexclude_border=Truewhere if all sources were in the border region then an error would be raised. [#1943]
2.0.1 (2024-10-16)#
Bug Fixes#
2.0.0 (2024-10-14)#
General#
The
regionspackage is now an optional dependency. [#1813]The minimum required Astropy is now 5.3. [#1839]
SciPy is now a required dependency. [#1880]
The minimum required SciPy is now 1.10. [#1880]
The minimum required NumPy is now 1.24. [#1881]
The minimum required Matplotlib is now 3.7. [#1881]
The minimum required GWCS is now 0.19. [#1881]
Importing tools from all subpackages now requires including the subpackage name. Also, PSF matching tools must now be imported from
photutils.psf.matchinginstead ofphotutils.psf. [#1879, #1904]
New Features#
photutils.apertureThe metadata in the tables generated by
aperture_photometryandApertureStatsnow include the aperture name and shape parameters. [#1849]aperture_photometryandApertureStatsnow accept supportedregions.Regionobjects, i.e., those corresponding to circular, elliptical, and rectangular apertures. [#1813, #1852]A new
region_to_apertureconvenience function has been added to convert supportedregions.Regionobjects toApertureobjects. [#1813, #1852]
photutils.backgroundThe
Background2Dclass has been refactored to significantly reduce its memory usage. In some cases, it is also significantly faster. [#1870, #1872, #1873]A new
npixels_meshproperty was added toBackground2Dthat gives a 2D array of the number of pixels used to compute the statistics in the low-resolution grid. [#1870]A new
npixels_mapproperty was added toBackground2Dthat gives a 2D array of the number of pixels used to compute the statistics in each mesh, resized to the shape of the input data. [#1871]
photutils.centroidsQuantityarrays can now be input tocentroid_1dgandcentroid_2dg. [#1861]
photutils.datasetsAdded a new
params_table_to_modelsfunction to create a list of models from a table of model parameters. [#1896]
photutils.psfAdded new
xy_boundskeyword toPSFPhotometryandIterativePSFPhotometryto allow one to bound the x and y model parameters during the fitting. [#1805]The
extract_starsfunction can now acceptNDDatainputs with uncertainty types other thanweights. [#1821]Added new
GaussianPSF,CircularGaussianPSF,GaussianPRF,CircularGaussianPRF, andMoffatPSFPSF model classes. [#1838, #1898, #1918]Added new
CircularGaussianSigmaPRFPSF model class. [#1845, #1918]The
IntegratedGaussianPRFmodel now supports units. [#1838]A new
resultsattribute was added toPSFPhotometryto store the returned table of fit results. [#1858]Added new
fit_fwhmconvenience function to estimate the FWHM of one or more sources in an image by fitting a circular 2D Gaussian PSF model. [#1859, #1887, #1899, #1918]Added new
fit_2dgaussianconvenience function to fit a circular 2D Gaussian PSF to one or more sources in an image. [#1859, #1887, #1899]Added new
ImagePSFmodel class to represent a PSF model as an image. [#1890]The
GriddedPSFModelmodel now has abounding_boxmethod to return the bounding box of the model. [#1891]The
GriddedPSFModelclass has been refactored to significantly improve its performance. In typical PSF photometry use cases, it is now about 4 times faster than previous versions. [#1903]
photutils.segmentationReduced the memory usage and improved the performance of source deblending with
deblend_sourcesandSourceFinder. [#1924, #1925, #1926]Improved the accuracy of the progress bar in
deblend_sourcesandSourceFinderwhen using multiprocessing. Also added the source ID label number to the progress bar. [#1925, #1926]
Bug Fixes#
photutils.apertureFixed a bug checking that the
subpixelskeyword is a strictly positive integer. [#1816]
photutils.datasetsFixed an issue in
make_model_imagewhere if thebbox_factorwas input and the model bounding box did not have afactorkeyword then an error would be raised. [#1921]
photutils.detectionFixed an issue where
DAOStarFinderwould not return any sources if the inputthresholdwas set to zero due to thefluxbeing nonfinite. [#1882]
photutils.isophoteFixed a bug in
build_ellipse_modelwhere ifhigh_harmonics=True, the harmonics were not correctly added to the model. [#1810]
photutils.psfFixed a bug in
make_psf_modelwhere if the input model had amplitude units, an error would be raised. [#1894]
API Changes#
The
sklearnversion information has been removed from the meta attribute in output tables.sklearnwas removed as an optional dependency in 1.13.0. [#1807]photutils.backgroundThe
Background2Dbackground_meshandbackground_rms_meshproperties will have units if the input data has units. [#1870]The
Background2Dedge_methodkeyword is now deprecated. Whenedge_methodis eventually removed, the'pad'option will always be used. [#1870]The
Background2Dbackground_mesh_masked,background_rms_mesh_masked, andmesh_nmaskedproperties are now deprecated. [#1870]To reduce memory usage,
Background2Dno longer keeps a cached copy of the returnedbackgroundandbackground_rmsproperties. [#1870]The
Background2Ddata,mask,total_mask,nboxes,box_npixels, andnboxes_totattributes have been removed. [#1870]The
BkgZoomInterpolatorgrid_modekeyword is now deprecated. Whengrid_modeis eventually removed, theTrueoption will always be used. [#1870]The
Background2Dbackground,background_rms,background_mesh, andbackground_rms_meshproperties now have the samedtypeas the input data. [#1922]
photutils.centroidsFor consistency with other fitting functions (including PSF fitting), the
centroid_1dgandcentroid_2dgfunctions now fit only a 1D or 2D Gaussian model, respectively, excluding any constant component. The input data are required to be background-subtracted. [#1861]The fitter used in
centroid_1dgandcentroid_2dgwas changed fromLevMarLSQFittertoTRFLSQFitter.LevMarLSQFitteruses the legacy SciPy functionscipy.optimize.leastsq, which is no longer recommended. [#1917]
photutils.datasetsThe deprecated
makemodule has been removed. Instead of importing functions fromphotutils.datasets.make, import functions fromphotutils.datasets. [#1884]The deprecated
make_model_sources_image,make_gaussian_prf_sources_image,make_gaussian_sources_table,make_test_psf_data,make_random_gaussians_table, andmake_imagehdufunctions have been removed. [#1884]
photutils.detectionThe deprecated
skykeyword inDAOStarFinderandIRAFStarFinderhas been removed. Also, there will no longer be askycolumn in the output table. [#1884]The
DAOStarFinderfluxandmagcolumns were changed to give sensible values. Previously, thefluxvalue was defined by the original DAOFIND algorithm as a measure of the intensity ratio of the amplitude of the best fitting Gaussian function at the object position to the detection threshold. Adaofind_magcolumn was added for comparison to the original IRAF DAOFIND algorithm. [#1885]
photutils.isophoteThe
build_ellipse_modelfunction now raises aValueErrorif the inputisolistis empty. [#1809]
photutils.profilesThe fitter used in
RadialProfileto fit the profile with a Gaussian was changed fromLevMarLSQFittertoTRFLSQFitter.LevMarLSQFitteruses the legacy SciPy functionscipy.optimize.leastsq, which is no longer recommended. [#1899]
photutils.psfThe
IntegratedGaussianPRFclass now must be initialized using keyword-only arguments. [#1838]The
IntegratedGaussianPRFclass has been moved to the newfunctional_modelsmodule. [#1838]The
modelsandgriddedpsfmodelmodules have been renamed toimage_modelsandgridded_models, respectively. [#1838]The
IntegratedGaussianPRFmodel class has been renamed toCircularGaussianSigmaPRF.IntegratedGaussianPRFis now deprecated. [#1845]Some PSF tools have moved to new modules. The
PRFAdapterclass and themake_psf_modelandgrid_from_epsfsfunctions have been moved to the newmodel_helpersmodule. Themake_psf_model_imagefunction has been moved to the newsimulationsmodule. It is recommended that all of these tools be imported fromphotutils.psfwithout using the submodule name. [#1854, #1901]The
PSFPhotometryfit_resultsattribute has been renamed tofit_info.fit_resultsis now deprecated. [#1858]The
PRFAdapterclass has been deprecated. Instead, use aImagePSFmodel derived from thediscretize_modelfunction inastropy.convolution. [#1865]The
FittableImageModelandEPSFModelclasses have been deprecated. Instead, use the newImagePSFmodel class. [#1890]The default fitter for
PSFPhotometry,IterativePSFPhotometry, andEPSFFitterwas changed fromLevMarLSQFittertoTRFLSQFitter.LevMarLSQFitteruses the legacy SciPy functionscipy.optimize.leastsq, which is no longer recommended. [#1899]psf_shapeis now an optional keyword in themake_model_imageandmake_residual_imagemethods ofPSFPhotometryandIterativePSFPhotometry. The value defaults to using the model bounding box to define the shape and is required only if the PSF model does not have a bounding box attribute. [#1921]
photutils.psf.matchingPSF matching tools must now be imported from
photutils.psf.matchinginstead ofphotutils.psf. [#1904]
photutils.segmentationThe
SegmentationImagerelabel_consecutive,reassign_label(s),keep_label(s),remove_label(s),remove_border_labels, andremove_masked_labelsmethods now keep the original dtype of the segmentation image instead of always changing it toint(int64). [#1878, #1923]The
detect_sourcesanddeblend_sourcesfunctions now return aSegmentationImageinstance whose data dtype isnp.int32instead ofint(int64) unless more than (2**31 - 1) labels are needed. [#1878]
1.13.0 (2024-06-28)#
General#
scikit-learnhas been removed as an optional dependency. [#1774]
New Features#
photutils.datasetsAdded a
make_model_imagefunction for generating simulated images with model sources. This function has more options and is significantly faster than the now-deprecatedmake_model_sources_imagefunction. [#1759, #1790]Added a
make_model_paramsfunction to make a table of randomly generated model positions, fluxes, or other parameters for simulated sources. [#1766, #1796]
photutils.detectionphotutils.profilesphotutils.psfAdded an
include_localbkgkeyword to theIterativePSFPhotometrymake_model_imageandmake_residual_imagemethods. [#1756]Added “x_fit”, “xfit”, “y_fit”, “yfit”, “flux_fit”, and “fluxfit” as allowed column names in the
init_paramstable input to the PSF photometry objects. [#1765]Added a
make_psf_model_imagefunction to generate a simulated image from PSF models. [#1785, #1796]PSFPhotometrynow has a newfit_paramsattribute containing a table of the fit model parameters and errors. [#1789]The
PSFPhotometryandIterativePSFPhotometryinit_paramstable now allows the user to input columns for model parameters other than x, y, and flux. The column names must match the parameter names in the PSF model. They can also be suffixed with either the “_init” or “_fit” suffix. [#1793]
Bug Fixes#
photutils.apertureFixed an issue in
ApertureStatswhere in very rare cases thecovariancecalculation could take a long time. [#1788]
photutils.backgroundNo longer warn about NaNs in the data if those NaNs are masked in
coverage_maskpassed toBackground2D. [#1729]
photutils.psfFixed an issue where
IterativePSFPhotometrywould fail if the input data was aQuantityarray. [#1746]Fixed the
IntegratedGaussianPRFclassbounding_boxlimits to always be symmetric. [#1754]Fixed an issue where
IterativePSFPhotometrycould sometimes issue a warning when merging tables ifmode='all'. [#1761]Fixed a bug where the first matching column in the
init_paramstable was not used inPSFPhotometryandIterativePSFPhotometry. [#1765]Fixed an issue where
IterativePSFPhotometrycould sometimes raise an error about nonoverlapping data. [#1778]Fixed an issue with unit handling in
PSFPhotometryandIterativePSFPhotometry. [#1792]Fixed an issue in
IterativePSFPhotometrywhere thefit_resultsattribute was not cleared between repeated calls. [#1793]
photutils.segmentationFixed an issue in
SourceCatalogwhere in very rare cases thecovariancecalculation could take a long time. [#1788]
API Changes#
The
photutils.testfunction has been removed. Instead use thepytest --pyargs photutilscommand. [#1725]photutils.datasetsThe
photutils.datasetssubpackage has been reorganized and themakemodule has been deprecated. Instead of importing functions fromphotutils.datasets.make, import functions fromphotutils.datasets. [#1726]The
make_model_sources_imagefunction has been deprecated in favor of the newmake_model_imagefunction. The new function has more options and is significantly faster. [#1759]The randomly-generated optional noise in the simulated example images
make_4gaussians_imageandmake_100gaussians_imageis now slightly different. The noise sigma is the same, but the pixel values differ. [#1760]The
make_gaussian_prf_sources_imagefunction is now deprecated. Use themake_psf_model_imagefunction or the newmake_model_imagefunction instead. [#1762]The
make_random_gaussians_tablefunction now includes an “id” column and always returns both'flux'and'amplitude'columns. [#1763]The
make_random_models_tablefunction now includes an “id” column. [#1764]The
make_random_gaussians_tablefunction is now deprecated. Use themake_random_models_tablefunction instead. [#1764]The
make_test_psf_datafunction is now deprecated. Use the newmake_psf_model_imagefunction instead. [#1785]
photutils.detectionThe
skykeyword inDAOStarFinderandIRAFStarFinderis now deprecated and will be removed in a future version. [#1747]Sources that have nonfinite properties (e.g., centroid, roundness, sharpness, etc.) are automatically excluded from the output table in
DAOStarFinder,IRAFStarFinder, andStarFinder. [#1750]
photutils.psfPSFPhotometryandIterativePSFPhotometrynow raise aValueErrorif the inputpsf_modelis not two-dimensional withn_inputs=2andn_outputs=1. [#1741]The
IntegratedGaussianPRFclassbounding_boxis now a method instead of an attribute for consistency with Astropy models. The method has afactorkeyword to scale the bounding box. The default scale factor is 5.5 timessigma. [#1754]The
IterativePSFPhotometrymake_model_imageandmake_residual_imagemethods no longer include the local background by default. This is a backwards-incompatible change. If the previous behavior is desired, setinclude_localbkg=True. [#1756]IterativePSFPhotometrywill now only issue warnings after all iterations are completed. [#1767]The
IterativePSFPhotometrypsfphotattribute has been removed. Instead, use thefit_resultsattribute, which contains a list ofPSFPhotometryinstances for each fit iteration. [#1771]The
group_sizecolumn has been moved to come immediately after thegroup_idcolumn in the output table fromPSFPhotometryandIterativePSFPhotometry. [#1772]The
PSFPhotometryinit_paramstable was moved from thefit_resultsdictionary to an attribute. [#1773]Removed
local_bkg,psfcenter_indices,fit_residuals,npixfit, andnmodelskeys from thePSFPhotometryfit_resultsdictionary. [#1773]Removed the deprecated
BasicPSFPhotometry,IterativelySubtractedPSFPhotometry,DAOPhotPSFPhotometry,DAOGroup,DBSCANGroup,GroupStarsBase, andNonNormalizableclasses and theprepare_psf_model,get_grouped_psf_model, andsubtract_psffunctions. [#1774]A
ValueErroris now raised if the shape of theerrorarray does not match thedataarray when calling the PSF-fitting classes. [#1777]The
fit_param_errskey was removed from thePSFPhotometryfit_resultsdictionary. The fit parameter errors are now stored in thefit_paramstable. [#1789]The
cfitcolumn in thePSFPhotometryandIterativePSFPhotometryresult table will now be NaN for sources whose initial central pixel is masked. [#1789]
1.12.0 (2024-04-12)#
General#
The minimum required Python is now 3.10. [#1719]
The minimum required NumPy is now 1.23. [#1719]
The minimum required SciPy is now 1.8. [#1719]
The minimum required scikit-image is now 0.20. [#1719]
The minimum required scikit-learn is now 1.1. [#1719]
The minimum required pytest-astropy is now 0.11. [#1719]
The minimum required sphinx-astropy is now 1.9. [#1719]
NumPy 2.0 is supported.
Bug Fixes#
photutils.backgroundNo longer warn about NaNs in the data if those NaNs are masked in
maskpassed toBackground2D. [#1712]
API Changes#
photutils.utilsThe default value for the
ImageDepthmask_padkeyword is now set to 0. [#1714]
1.11.0 (2024-02-16)#
New Features#
photutils.psfAn
init_paramstable is now included in thePSFPhotometryfit_resultsdictionary. [#1681]Added an
include_localbkgkeyword to thePSFPhotometrymake_model_imageandmake_residual_imagemethods. [#1691]Significantly reduced the memory usage of PSF photometry when using a
GriddedPSFModelPSF model. [#1679]Added a
modekeyword toIterativePSFPhotometryfor controlling the fitting mode. [#1708]
photutils.datasetsImproved the performance of
make_test_psf_datawhen generating random coordinates with a minimum separation. [#1668]
photutils.segmentationThe
SourceFindernpixelskeyword can now be a tuple corresponding to the values used for the source finder and source deblender, respectively. [#1688]
photutils.utilsImproved the performance of
ImageDepthwhen generating random coordinates with a minimum separation. [#1668]
Bug Fixes#
photutils.psf
API Changes#
photutils.aperturePixelApertureinstances now raise an informative error message whenpositionsis input as azipobject containing AstropyQuantityobjects. [#1682]
photutils.psfThe
GridddedPSFModelstring representations now include the modelflux,x_0, andy_0parameters. [#1680]The
PSFPhotometrymake_model_imageandmake_residual_imagemethods no longer include the local background by default. This is a backwards-incompatible change. If the previous behavior is desired, setinclude_localbkg=True. [#1703]The PSF photometry
finder_resultsattribute is now returned as aQTableinstead of a list ofQTable. [#1704]Deprecated the
NonNormalizablecustom warning class in favor ofAstropyUserWarning. [#1710]
photutils.segmentationThe
SourceCatalogget_labelandget_labelsmethods now raise aValueErrorif any of the input labels are invalid. [#1694]
1.10.0 (2023-11-21)#
General#
The minimum required Astropy is now 5.1. [#1627]
New Features#
photutils.datasetsphotutils.detectionAdded a
min_separationkeyword toDAOStarFinderandIRAFStarFinder. [#1663]
photutils.morphologyAdded a
wcskeyword todata_properties. [#1648]
photutils.psfThe
GriddedPSFModelplot_gridmethod now returns amatplotlib.figure.Figureobject. [#1653]Added the ability for the
GriddedPSFModelreadmethod to read FITS files generated by WebbPSF. [#1654]Added “flux_0” and “flux0” as allowed flux column names in the
init_paramstable input to the PSF photometry objects. [#1656]PSF models output from
prepare_psf_modelcan now be input into the PSF photometry classes. [#1657]Added
make_psf_modelfunction for making a PSF model from a 2D Astropy model. Compound models are also supported. [#1658]The
GriddedPSFModeloversampling can now be different in the x and y directions. Theoversamplingattribute is now stored as a 1Dnumpy.ndarraywith two elements. [#1664]
photutils.segmentationThe
SegmentationImagemake_source_maskmethod now uses a much faster implementation of binary dilation. [#1638]Added a
scalekeyword to theSegmentationImage.to_patches()method to scale the sizes of the polygon patches. [#1641, #1646]Improved the
SegmentationImageimshowmethod to ensure that labels are plotted with unique colors. [#1649]Added a
imshow_mapmethod toSegmentationImagefor plotting segmentation images with a small number of nonconsecutive labels. [#1649]Added a
reset_cmapmethod toSegmentationImagefor resetting the colormap to a new random colormap. [#1649]
photutils.utilsImproved the generation of random aperture positions in
ImageDepth. [#1666]
Bug Fixes#
photutils.apertureFixed an issue where the aperture
plotmethod**kwargswere not reset to the default values when called multiple times. [#1655]
photutils.psfphotutils.segmentation
API Changes#
The metadata in output tables now contains a timestamp. [#1640]
The order of the metadata in a table is now preserved when writing to a file. [#1640]
photutils.psfDeprecated the
prepare_psf_modelfunction. Use the newmake_psf_modelfunction instead. [#1658]The
GriddedPSFModelnow stores the ePSF grid such that it is first sorted by y then by x. As a result, the order of thedataandxygridattributes may be different. [#1661]The
oversamplingattribute is now stored as a 1Dnumpy.ndarraywith two elements. [#1664]A
ValueErroris raised ifGriddedPSFModelis called with x and y arrays that have more than 2 dimensions. [#1662]
photutils.segmentationRemoved the deprecated
kernelkeyword fromSourceCatalog. [#1613]
1.9.0 (2023-08-14)#
General#
New Features#
photutils.backgroundAdded
LocalBackgroundclass for computing local backgrounds in a circular annulus aperture. [#1556]
photutils.datasetsphotutils.psfPropagate measurement uncertainties in PSF fitting. [#1543]
Added new
PSFPhotometryandIterativePSFPhotometryclasses for performing PSF-fitting photometry. [#1558, #1559, #1563, #1566, #1567, #1581, #1586, #1590, #1594, #1603, #1604]Added a
GriddedPSFModelfill_valueattribute. [#1583]Added a
grid_from_epsfsfunction to make aGriddedPSFModelfrom ePSFs. [#1596]Added a
readmethod toGriddedPSFModelfor reading “STDPSF” FITS files containing grids of ePSF models. [#1557]Added a
plot_gridmethod toGriddedPSFModelfor plotting ePSF grids. [#1557]Added a
STDPSFGridclass for reading “STDPSF” FITS files containing grids of ePSF models and plotting the ePSF grids. [#1557]
Bug Fixes#
photutils.apertureFixed a bug in the validation of
PixelAperturepositions. [#1553]
API Changes#
photutils.psfDeprecated the PSF photometry classes
BasicPSFPhotometry,IterativelySubtractedPSFPhotometry, andDAOPhotPSFPhotometry. Use the newPSFPhotometryorIterativePSFPhotometryclass instead. [#1578]Deprecated the
DAOGroup,DBSCANGroup, andGroupStarsBaseclasses. Use the newSourceGrouperclass instead. [#1578]Deprecated the
get_grouped_psf_modelandsubtract_psffunction. [#1578]
1.8.0 (2023-05-17)#
General#
New Features#
photutils.profilesThe
RadialProfileandCurveOfGrowthradial bins can now be directly input, which also allows for nonuniform radial spacing. [#1540]
Bug Fixes#
photutils.psfFixed an issue with the local model cache in
GriddedPSFModel, significantly improving performance. [#1536]
API Changes#
Removed the deprecated
axeskeyword in favor ofaxfor consistency with other packages. [#1523]photutils.apertureRemoved the
ApertureStatsunpack_nddatamethod. [#1537]
photutils.profilesThe API for defining the radial bins for the
RadialProfileandCurveOfGrowthclasses was changed. While the new API allows for more flexibility, unfortunately, it is not backwards-compatible. [#1540]
photutils.segmentationRemoved the deprecated
kernelkeyword fromdetect_sourcesanddeblend_sources. [#1524]Deprecated the
kernelkeyword inSourceCatalog. [#1525]Removed the deprecated
outline_segmentsmethod fromSegmentationImage. [#1526]The
SourceCatalogkron_paramsattribute is no longer returned as andarray. It is returned as atuple. [#1531]
1.7.0 (2023-04-05)#
General#
The
rasterioandshapelypackages are now optional dependencies. [#1509]
New Features#
photutils.aperturephotutils.profilesphotutils.psfSignificantly improved the performance of evaluating and fitting
GriddedPSFModelinstances. [#1503]
photutils.segmentationAdded a
sizekeyword to theSegmentationImagemake_source_maskmethod. [#1506]Significantly improved the performance of
SegmentationImagemake_source_maskwhen using square footprints for source dilation. [#1506]Added the
polygonsproperty andto_patchesandplot_patchesmethods toSegmentationImage. [#1509]Added
polygonkeyword to theSegmentclass. [#1509]
Bug Fixes#
photutils.centroidsFixed an issue where
centroid_quadraticwould sometimes fail if the input data contained NaNs. [#1495]
photutils.detectionFixed an issue with the starfinders (
DAOStarFinder,IRAFStarFinder, andStarFinder) where an exception was raised ifexclude_border=Trueand there were no detections. [#1512].
photutils.isophotephotutils.psfphotutils.utilsFixed a bug in the calculation of
ImageCutoutxyoriginwhen using the'partial'mode when the cutout extended beyond the right or top edge. [#1508]
API Changes#
photutils.apertureThe
ApertureStatslocal_bkgkeyword can now be broadcast for apertures with multiple positions. [#1504]
photutils.centroidsThe
centroid_sourcesfunction will now raise an error if the cutout mask contains allTruevalues. [#1516]
photutils.datasetsRemoved the deprecated
load_fermi_imagefunction. [#1479]
photutils.psfRemoved the deprecated
sandboxclassesDiscretePRFandReproject. [#1479]
photutils.segmentationRemoved the deprecated
make_source_maskfunction in favor of theSegmentationImage.make_source_maskmethod. [#1479]The
SegmentationImageimshowmethod now uses “nearest” interpolation instead of “none” to avoid rendering issues with some backends. [#1507]The
repr()notebook output for theSegmentclass now includes a SVG polygon representation of the segment if therasterioandshapelypackages are installed. [#1509]Deprecated the
SegmentationImageoutline_segmentsmethod. Use theplot_patchesmethod instead. [#1509]
1.6.0 (2022-12-09)#
General#
New Features#
photutils.aperturephotutils.psfphotutils.segmentationAdded the ability to slice
SegmentationImageobjects. [#1413]Added
modeandfill_valuekeywords toSourceCatalogmake_cutoutsmethod. [#1420]Added
segment_areasource property andwcs,localbkg_width,apermask_method, andkron_paramsattributes toSourceCatalog. [#1425]Added the ability to use
Quantityarrays withdetect_threshold,detect_sources,deblend_sources, andSourceFinder. [#1436]The progress bar used when deblending sources now is prepended with “Deblending”. [#1439]
Added a
progress_baroption toSourceCatalogfor displaying progress bars when calculating some source properties. [#1471]
photutils.utils
Bug Fixes#
photutils.aperturephotutils.datasetsFixed a bug in the various
loadfunctions where FITS files were not closed. [#1455]
photutils.segmentationFixed an issue in the
SourceCatalogkron_photometry,make_kron_apertures, andplot_kron_aperturesmethods where the input minimum Kron and circular radii would not be applied. Instead the instance-level minima would always be used. [#1421]Fixed an issue where the
SourceCatalogplot_kron_aperturesmethod would raise an error for a scalarSourceCatalog. [#1421]Fixed an issue in
SourceCatalogget_labelsfor the case when the labels are not sorted (due to slicing). [#1423]
API Changes#
Deprecated
axeskeyword in favor ofaxfor consistency with other packages. [#1432]Importing tools from all subpackages now requires including the subpackage name.
photutils.aperturephotutils.centroidsRemoved the deprecated
oversamplingkeyword incentroid_com. [#1398]
photutils.datasetsDeprecated the
load_fermi_imagefunction. [#1455]
photutils.psfphotutils.segmentationRemoved the deprecated
sigclip_sigmaandsigclip_iterskeywords indetect_threshold. Use thesigma_clipkeyword instead. [#1398]Removed the
mask_value,sigclip_sigma, andsigclip_iterskeywords indetect_threshold. Use themaskorsigma_clipkeywords instead. [#1398]Removed the deprecated the
filter_fwhmandfilter_sizekeywords inmake_source_mask. Use thekernelkeyword instead. [#1398]If
detection_catis input toSourceCatalog, then the detection catalog source centroids and morphological/shape properties will be returned instead of calculating them from the input data. Also, ifdetection_catis input, then the inputwcs,apermask_method, andkron_paramskeywords will be ignored. [#1425]
1.5.0 (2022-07-12)#
General#
Added
tqdmas an optional dependency. [#1364]
New Features#
photutils.psfphotutils.segmentationAdded
SourceFinderclass, which is a convenience class combiningdetect_sourcesanddeblend_sources. [#1344]Added a
sigma_clipkeyword todetect_threshold. [#1354]Added a
make_source_maskmethod toSegmentationImage. [#1355]Added a
make_2dgaussian_kernelconvenience function. [#1356]Allow
SegmentationImage.make_cmapbackground_colorto be in any matplotlib color format. [#1361]Added an
imshowconvenience method toSegmentationImage. [#1362]Improved performance of
deblend_sources. [#1364]Added a
progress_barkeyword todeblend_sources. [#1364]Added a
'sinh'mode todeblend_sources. [#1368]Improved the resetting of cached
SegmentationImageproperties so that custom (noncached) attributes can be kept. [#1368]Added a
nprockeyword to enable multiprocessing indeblend_sourcesandSourceFinder. [#1372]Added a
make_cutoutsmethod toSourceCatalogfor making custom-shaped cutout images. [#1376]Added the ability to set a minimum unscaled Kron radius in
SourceCatalog. [#1381]
photutils.utils
Bug Fixes#
API Changes#
photutils.centroidsphotutils.psfInvalid data values (i.e., NaN or inf) are now automatically masked when performing PSF fitting. [#1350]
Deprecated the
sandboxclassesDiscretePRFandReproject. [#1357]Changed the axes order of
oversamplingkeywords when input as a tuple. [#1358]Removed the unused
shift_valkeyword inEPSFBuilderandEPSFModel. [#1377]Renamed the
flux_residual_sigclipkeyword (now deprecated) tosigma_clipinEPSFBuilder. [#1378]The
EPSFBuilderprogress bar now requires that the optionaltqdmpackage be installed. [#1379]The tools in the PSF package now require keyword-only arguments. [#1386]
photutils.segmentationRemoved the deprecated
circular_aperturemethod fromSourceCatalog. [#1329]The
SourceCatalogplot_kron_aperturesmethod now sets a defaultkron_apersvalue. [#1346]deblend_sourcesno longer allows an array to be input as a segmentation image. It must be aSegmentationImageobject. [#1347]SegmentationImageno longer allows array-like input. It must be a numpyndarray. [#1347]Deprecated the
sigclip_sigmaandsigclip_iterskeywords indetect_threshold. Use thesigma_clipkeyword instead. [#1354]Deprecated the
make_source_maskfunction in favor of theSegmentationImage.make_source_maskmethod. [#1355]Deprecated the
kernelkeyword indetect_sourcesanddeblend_sources. Instead, if filtering is desired, input a convolved image directly into thedataparameter. [#1365]Sources with a data minimum of zero are now treated the same as negative minima (i.e., the mode is changed to “linear”) for the “exponential” deblending mode. [#1368]
A single warning (as opposed to 1 per source) is now raised about negative/zero minimum data values using the ‘exponential’ deblending mode. The affected labels is available in a new “info” attribute. [#1368]
If the mode in
deblend_sourcesis “exponential” or “sinh” and there are too many potential deblended sources within a given source (watershed markers), a warning will be raised and the mode will be changed to “linear”. [#1369]The
SourceCatalogmake_circular_aperturesandmake_kron_aperturesmethods now return a single aperture (instead of a list with one item) for a scalarSourceCatalog. [#1376]The
SourceCatalogkron_paramskeyword now has an optional third item representing the minimum circular radius. [#1381]The
SourceCatalogkron_radiusis now set to the minimum Kron radius (the second element ofkron_params) if the data or radially weighted data sum to zero. [#1381]
photutils.utilsThe colormap returned from
make_random_cmapnow has colors in RGBA format. [#1361]
1.4.0 (2022-03-25)#
General#
The minimum required Python is now 3.8. [#1279]
The minimum required Numpy is now 1.18. [#1279]
The minimum required Astropy is now 5.0. [#1279]
The minimum required Matplotlib is now 3.1. [#1279]
The minimum required scikit-image is now 0.15.0 [#1279]
The minimum required gwcs is now 0.16.0 [#1279]
New Features#
photutils.apertureAdded a
copymethod toApertureobjects. [#1304]Added the ability to compare
Apertureobjects for equality. [#1304]The
thetakeyword forEllipticalAperture,EllipticalAnnulus,RectangularAperture, andRectangularEllipsecan now be an AstropyAngleorQuantityin angular units. [#1308]Added an
ApertureStatsclass for computing statistics of unmasked pixels within an aperture. [#1309, #1314, #1315, #1318]Added a
dtypekeyword to theApertureMaskto_imagemethod. [#1320]
photutils.backgroundphotutils.segmentation
Bug Fixes#
photutils.apertureFixed a bug in
aperture_photometrywhere an error was not raised if the data and error arrays have different units. [#1285].
photutils.backgroundFixed a bug in
Background2Dwhere using thepadedge method would result in incorrect image padding if only one of the axes needed padding. [#1292]
photutils.centroidsphotutils.segmentationFixed a bug in
SourceCatalogwhere aUFuncTypeErrorwould be raised if the inputdatahad an integerdtype[#1312].
API Changes#
photutils.apertureA
ValueErroris now raised if nonpositive sizes are input to sky-based apertures. [#1295]The
BoundingBox.plot()method now returns amatplotlib.patches.Patchobject. [#1305]Inputting
PixelAperturepositions as an AstropyQuantityin pixel units is deprecated. [#1310]Inputting
SkyApertureshape parameters as an AstropyQuantityin pixel units is deprecated. [#1310]
photutils.backgroundRemoved the deprecated
background_mesh_maandbackground_rms_mesh_maBackground2Dproperties. [#1280]By default,
BkgZoomInterpolatorusesclip=Trueto prevent the interpolation from producing values outside the given input range. If backwards-compatibility is needed with older Photutils versions, setclip=False. [#1324]
photutils.centroidsphotutils.morphologyImporting tools from the morphology subpackage now requires including the subpackage name. [#1280]
photutils.segmentationRemoved the deprecated
source_propertiesfunction and theSourcePropertiesandLegacySourceCatalogclasses. [#1280]Removed the deprecated the
filter_kernelkeyword in thedetect_sources,deblend_sources, andmake_source_maskfunctions. [#1280]A
TypeErroris raised if the input array toSegmentationImagedoes not have integer type. [#1319]A
SegmentationImagemay contain an array of all zeros. [#1319]Deprecated the
mask_valuekeyword indetect_threshold. Use themaskkeyword instead. [#1322]Deprecated the
filter_fwhmandfilter_sizekeywords inmake_source_mask. Use thekernelkeyword instead. [#1322]
1.3.0 (2021-12-21)#
General#
The metadata in output tables now contains version information for all dependencies. [#1274]
New Features#
photutils.centroidsphotutils.segmentationAdded
copymethod toSourceCatalog. [#1264]Added
kron_photometrymethod toSourceCatalog. [#1264]Added
add_extra_property,remove_extra_property,remove_extra_properties, andrename_extra_propertymethods andextra_propertiesattribute toSourceCatalog. [#1264, #1268]Added
nameandoverwritekeywords toSourceCatalogcircular_photometryandfluxfrac_radiusmethods. [#1264]SourceCatalogfluxfrac_radiuswas improved for cases where the source flux doesn’t monotonically increase with increasing radius. [#1264]Added
metaandpropertiesattributes toSourceCatalog. [#1268]The
SourceCatalogoutput table (usingto_table)metadictionary now includes a field for the date/time. [#1268]Added
SourceCatalogmake_kron_aperturesmethod. [#1268]Added
SourceCatalogplot_circular_aperturesandplot_kron_aperturesmethods. [#1268]
Bug Fixes#
photutils.segmentationIf
detection_catalogis input toSourceCatalogthen the detection centroids are used to calculate thecircular_aperture,circular_photometry, andfluxfrac_radius. [#1264]Units are applied to
SourceCatalogcircular_photometryoutput if the input data has units. [#1264]SourceCatalogcircular_photometryreturns scalar values if catalog is scalar. [#1264]SourceCatalogfluxfrac_radiusreturns aQuantitywith pixel units. [#1264]Fixed a bug where the
SourceCatalogdetection_catalogwas not indexed/sliced whenSourceCatalogwas indexed/sliced. [#1268]SourceCatalogcircular_photometrynow returns NaN for completely-masked sources. [#1268]SourceCatalogkron_fluxis always NaN for sources wherekron_radiusis NaN. [#1268]SourceCatalogfluxfrac_radiusnow returns NaN ifkron_fluxis zero. [#1268]
API Changes#
photutils.centroidsA
ValueErroris now raised incentroid_sourcesif the inputxposoryposis outside of the inputdata. [#1276]A
ValueErroris now raised incentroid_quadraticif the inputxpeakorypeakis outside of the inputdata. [#1276]NaNs are now returned from
centroid_sourceswhere the centroid failed. This is usually due to abox_sizethat is too small when using a fitting-based centroid function. [#1276]
photutils.segmentationRenamed the
SourceCatalogcircular_aperturemethod tomake_circular_apertures. The old name is deprecated. [#1268]The
SourceCatalogkron_paramskeyword must have a minimum circular radius that is greater than zero. The default value is now 1.0. [#1268]detect_sourcesnow usesastropy.convolution.convolve, which allows for masking pixels. [#1269]
1.2.0 (2021-09-23)#
General#
The minimum required scipy version is 1.6.0 [#1239]
New Features#
photutils.apertureAdded a
maskkeyword to thearea_overlapmethod. [#1241]
photutils.backgroundImproved the performance of
Background2Dby up to 10-50% when the optionalbottleneckpackage is installed. [#1232]Added a
maskedkeyword to the background classesMeanBackground,MedianBackground,ModeEstimatorBackground,MMMBackground,SExtractorBackground,BiweightLocationBackground,StdBackgroundRMS,MADStdBackgroundRMS, andBiweightScaleBackgroundRMS. [#1232]Enable all background classes to work with
Quantityinputs. [#1233]Added a
markersizekeyword to theBackground2Dmethodplot_meshes. [#1234]Added
__repr__methods to all background classes. [#1236]Added a
grid_modekeyword toBkgZoomInterpolator. [#1239]
photutils.detectionAdded a
xycoordskeyword toDAOStarFinderandIRAFStarFinder. [#1248]
photutils.psf
Bug Fixes#
photutils.apertureFixed a bug when converting between pixel and sky apertures with a
gwcsobject. [#1221]
photutils.backgroundFixed an issue where
Background2Dcould fail when using the'pad'edge method. [#1227]
photutils.detectionFixed the
DAOStarFinderimport deprecation message. [#1195]
photutils.morphologyFixed an issue in
data_propertieswhere a scalar background input would raise an error. [#1198]
photutils.psfFixed an issue in
prepare_psf_modelwhenxnameorynamewasNonewhere the model offsets were applied in the wrong direction, resulting in the initial photometry guesses not being improved by the fit. [#1199]
photutils.segmentationphotutils.utilsFixed an issue in
ShepardIDWInterpolatorto allow its initialization with scalar data values and coordinate arrays having more than one dimension. [#1226]
API Changes#
photutils.aperturephotutils.backgroundInvalid data values (i.e., NaN or inf) are now automatically masked in
Background2D. [#1232]The background classes
MeanBackground,MedianBackground,ModeEstimatorBackground,MMMBackground,SExtractorBackground,BiweightLocationBackground,StdBackgroundRMS,MADStdBackgroundRMS, andBiweightScaleBackgroundRMSnow return by default anumpy.ndarraywithnp.nanvalues representing masked pixels instead of a masked array. A masked array can be returned by settingmasked=True. [#1232]Deprecated the
Background2Dattributesbackground_mesh_maandbackground_rms_mesh_ma. They have been renamed tobackground_mesh_maskedandbackground_rms_mesh_masked. [#1232]By default,
BkgZoomInterpolatornow usesgrid_mode=True. For zooming 2D images, this keyword should be set to True, which makes the interpolator’s behavior consistent withscipy.ndimage.map_coordinates,skimage.transform.resize, andOpenCV (cv2.resize). If backwards-compatibility is needed with older Photutils versions, setgrid_mode=False. [#1239]
photutils.centroidsDeprecated the
gaussian1d_momentsandcentroid_epsffunctions. [#1240]
photutils.datasetsphotutils.detectionphotutils.isophoteThe
Isophoteto_tablemethod nows return an astropyQTablewith version metadata. [#1247]
photutils.psfBasicPSFPhotometry,IterativelySubtractedPSFPhotometry, andDAOPhotPSFPhotometrynow return an astropyQTablewith version metadata. [#1247]
photutils.segmentationDeprecated the
filter_kernelkeyword in thedetect_sources,deblend_sources, andmake_source_maskfunctions. It has been renamed to simplykernelfor consistency withSourceCatalog. [#1242]Removed the deprecated
random_statekeyword in themake_cmapmethod. [#1244]The
SourceCatalogto_tablemethod nows return an astropyQTablewith version metadata. [#1247]
photutils.utils
1.1.0 (2021-03-20)#
General#
The minimum required python version is 3.7. [#1120]
New Features#
photutils.apertureThe
PixelAperture.plot()method now returns a list ofmatplotlib.patches.Patchobjects. [#923]Added an
area_overlapmethod forPixelApertureobjects that gives the overlapping area of the aperture on the data. [#874]Added a
get_overlap_slicesmethod and acenterattribute toBoundingBox. [#1157]Added a
get_valuesmethod toApertureMaskthat returns a 1D array of mask-weighted values. [#1158, #1161]Added
get_overlap_slicesmethod toApertureMask. [#1165]
photutils.backgroundThe
Background2Dclass now accepts astropyNDData,CCDData, andQuantityobjects as data inputs. [#1140]
photutils.detectionAdded a
StarFinderclass to detect stars with a user-defined kernel. [#1182]
photutils.isophoteAdded the ability to specify the output columns in the
IsophoteListto_tablemethod. [#1117]
photutils.psfphotutils.segmentationAdded a modified, significantly faster,
SourceCatalogclass. [#1170, #1188, #1191]Added
circular_apertureandcircular_photometrymethods to theSourceCatalogclass. [#1188]Added
fwhmproperty to theSourceCatalogclass. [#1191]Added
fluxfrac_radiusmethod to theSourceCatalogclass. [#1192]Added a
bboxattribute toSegmentationImage. [#1187]
Bug Fixes#
photutils.apertureSlicing a scalar
Apertureobject now raises an informative error message. [#1154]Fixed an issue where
ApertureMask.multiplyfill_valuewas not applied to pixels outside of the aperture mask, but within the aperture bounding box. [#1158]Fixed an issue where
ApertureMask.cutoutwould raise an error iffill_valuewas nonfinite and the input array was integer type. [#1158]Fixed an issue where
RectangularAnnuluswith a nondefaulth_inwould give an incorrectApertureMask. [#1160]
photutils.isophoteFix computation of gradient relative error when gradient=0. [#1180]
photutils.psfFixed a bug in
EPSFBuildwhere a warning was raised if the inputsmoothing_kernelwas annumpy.ndarray. [#1146]Fixed a bug that caused photometry to fail on an
EPSFmodelwith multiple stars in a group. [#1135]Added a fallback
aperture_radiusfor PSF models without a FWHM or sigma attribute, raising a warning. [#740]
photutils.segmentationFixed
SourcePropertieslocal_backgroundto work with Quantity data inputs. [#1162]Fixed
SourcePropertieslocal_backgroundfor sources near the image edges. [#1162]Fixed
SourcePropertieskron_radiusfor sources that are completely masked. [#1164]Fixed
SourcePropertiesKron properties for sources near the image edges. [#1167]Fixed
SourcePropertiesKron mask correction. [#1167]
API Changes#
photutils.apertureDeprecated the
BoundingBoxslicesattribute. Use theget_overlap_slicesmethod instead. [#1157]
photutils.centroidsphotutils.detectionImporting the
DAOStarFinder,IRAFStarFinder, andStarFinderBaseclasses from the deprecatedfindstars.pymodule is now deprecated. These classes can be imported usingfrom photutils.detection import <class>. [#1173]Importing the
find_peaksfunction from the deprecatedcore.pymodule is now deprecated. This function can be imported usingfrom photutils.detection import find_peaks. [#1173]
photutils.morphologyImporting tools from the morphology subpackage without including the subpackage name is deprecated. [#1190]
photutils.segmentationDeprecated the
"mask_all"option in theSourcePropertieskron_paramskeyword. [#1167]Deprecated
source_properties,SourceProperties, andLegacySourceCatalog. Use the newSourceCatalogfunction instead. [#1170]The
detect_thresholdfunction was moved to thesegmentationsubpackage. [#1171]Removed the ability to slice
SegmentationImage. Instead slice thesegmentsattribute. [#1187]
1.0.2 (2021-01-20)#
General#
Bug Fixes#
photutils.backgroundFixed a bug with
Background2Dwhere usingBkgIDWInterpolatorwould give incorrect results. [#1104]
photutils.isophotephotutils.psfphotutils.segmentation
1.0.1 (2020-09-24)#
Bug Fixes#
photutils.psfFixed checks on
oversamplingfactors. [#1086]
1.0.0 (2020-09-22)#
General#
New Features#
photutils.aperturephotutils.backgroundAdded
coverage_maskandfill_valuekeyword options toBackground2D. [#1061]
photutils.centroidsAdded quadratic centroid estimator function (
centroid_quadratic). [#1067]
photutils.psfAdded the ability to use odd oversampling factors in
EPSFBuilder. [#1076]
photutils.segmentation
Bug Fixes#
photutils.isophoteFixed a typo in the calculation of the
b4higher-order harmonic coefficient inbuild_ellipse_model. [#1052]Fixed a bug where
build_ellipse_modelfalls into an infinite loop when the pixel to fit is outside of the image. [#1039]Fixed a bug where
build_ellipse_modelfalls into an infinite loop under certain image/parameters input combinations. [#1056]
photutils.psfFixed a bug in
subtract_psfcaused by using a fill_value of np.nan with an integer input array. [#1062]
photutils.segmentationFixed a bug where
source_propertieswould fail with unitlessgwcs.wcs.WCSobjects. [#1020]
photutils.utilsThe
effective_gainparameter incalc_total_errorcan now be zero (or contain zero values). [#1019]
API Changes#
photutils.apertureAperture pixel positions can no longer be shaped as 2xN. [#953]
Removed the deprecated
unitskeyword inaperture_photometryandPixelAperture.do_photometry. [#953]PrimaryHDU,ImageHDU, andHDUListcan no longer be input toaperture_photometry. [#953]Removed the deprecated the Aperture
mask_areamethod. [#953]Removed the deprecated Aperture plot keywords
axandindices. [#953]
photutils.backgroundphotutils.centroidsphotutils.datasetsphotutils.detectionRemoved the deprecated
snrkeyword indetect_threshold. [#953]
photutils.psfphotutils.segmentationRemoved the deprecated
SegmentationImagemethodscmapandrelabel. [#953]Removed the deprecated
SourcePropertiesvaluesandcoordsattributes. [#953]Removed the deprecated
xmin/yminandxmax/ymaxproperties. [#953]Removed the deprecated
snrandmask_valuekeywords inmake_source_mask. [#953]Renamed the
random_statekeyword (deprecated) toseedin themake_cmapmethod. [#1080]
photutils.utilsRemoved the deprecated
random_cmap,mask_to_mirrored_num,get_version_info,filter_data, andstd_blocksumfunctions. [#953]Removed the deprecated
wcs_helpersfunctionspixel_scale_angle_at_skycoord,assert_angle_or_pixel,assert_angle, andpixel_to_icrs_coords. [#953]Deprecated the
check_random_statefunction. [#1080]Renamed the
random_statekeyword (deprecated) toseedin themake_random_cmapfunction. [#1080]
0.7.2 (2019-12-09)#
Bug Fixes#
photutils.isophoteFixed computation of upper harmonics
a3,b3,a4, andb4in the ellipse fitting algorithm. [#1008]
photutils.psfFix to algorithm in
EPSFBuilder, causing issues where ePSFs failed to build. [#974]Fix to
IterativelySubtractedPSFPhotometrywhere an error could be thrown when aFinderwas passed which did not returnNoneif no sources were found. [#986]Fix to
centroid_epsfwhere the wrong oversampling factor was used along the y-axis. [#1002]
0.7.1 (2019-10-09)#
Bug Fixes#
0.7 (2019-08-14)#
General#
Any WCS object that supports the astropy shared interface for WCS is now supported. [#899]
Added a new
photutils.__citation__andphotutils.__bibtex__attributes which give a citation for photutils in bibtex format. [#926]
New Features#
photutils.apertureAdded parameter validation for all aperture classes. [#846]
Added
from_float,as_artist,unionandintersectionmethods toBoundingBoxclass. [#851]Added
shapeandisscalarproperties to Aperture objects. [#852]Significantly improved the performance (~10-20 times faster) of aperture photometry, especially when using
errorsandQuantityinputs with many aperture positions. [#861]aperture_photometrynow supportsNDDatawithStdDevUncertaintyto input errors. [#866]The
modekeyword in theto_skyandto_pixelaperture methods was removed to implement the shared WCS interface. All WCS transforms now include distortions (if present). [#899]
photutils.datasetsAdded
make_gwcsfunction to create an examplegwcs.wcs.WCSobject. [#871]
photutils.isophotephotutils.psfAdded new centroiding function
centroid_epsf. [#816]
photutils.segmentationSignificantly improved the performance of relabeling in segmentation images (e.g.,
remove_labels,keep_labels). [#810]Added new
background_areaattribute toSegmentationImage. [#825]Added new
data_maattribute toSegment. [#825]Added new
SegmentationImagemethods:find_index,find_indices,find_areas,check_label,keep_label,remove_label, andreassign_labels. [#825]Added
__repr__and__str__methods toSegmentationImage. [#825]Added
slices,indices, andfiltered_data_cutout_maattributes toSourceProperties. [#858]Added
__repr__and__str__methods toSourcePropertiesandSourceCatalog. [#858]Significantly improved the performance of calculating the
background_at_centroidproperty inSourceCatalog. [#863]Added the
ginisource property representing the Gini coefficient. [#864]Cached (lazy) properties can now be reset in
SegmentationImagesubclasses. [#916]Significantly improved the performance of
deblend_sources. It is ~40-50% faster for large images (e.g., 4k x 4k) with a few thousand of sources. [#924]
photutils.utilsAdded
NoDetectionsWarningclass. [#836]
Bug Fixes#
photutils.apertureFixed an issue where the
ApertureMask.cutoutmethod would drop the data units whencopy=True. [#842]Fixed a corner-case issue where aperture photometry would return NaN for nonfinite data values outside the aperture but within the aperture bounding box. [#843]
Fixed an issue where the
celestial_centercolumn (for sky apertures) would be a length-1 array containing aSkyCoordobject instead of a length-1SkyCoordobject. [#844]
photutils.isophotephotutils.psfphotutils.segmentationFixed an issue where
deblend_sourcescould fail for sources with labels that are a power of 2 and greater than 255. [#806]SourcePropertiesandsource_propertieswill no longer raise an exception if a source is completely masked. [#822]Fixed an issue in
SourcePropertiesandsource_propertieswhere inf values in the data array were not automatically masked. [#822]errorandbackgroundarrays are now always masked identically to the inputdata. [#822]Fixed the
perimeterproperty to take into account the source mask. [#822]Fixed the
background_at_centroidsource property to use bilinear interpolation. [#822]Fixed
SegmentationImageoutline_segmentsto include outlines along the image boundaries. [#825]Fixed
SegmentationImage.is_consecutiveto returnTrueonly if the labels are consecutive and start with label=1. [#886]Fixed a bug in
deblend_sourceswhere sources could be deblended too much whenconnectivity=8. [#890]Fixed a bug in
deblend_sourceswhere thecontrastparameter had little effect if the original segment contained three or more sources. [#890]
photutils.utilsFixed a bug in
filter_datawhere units were dropped for dataQuantityobjects. [#872]
API Changes#
photutils.apertureDeprecated inputting aperture pixel positions shaped as 2xN. [#847]
Renamed the
celestial_centercolumn tosky_centerin theaperture_photometryoutput table. [#848]Aperture objects defined with a single (x, y) position (input as 1D) are now considered scalar objects, which can be checked with the new
isscalarAperture property. [#852]Nonscalar Aperture objects can now be indexed, sliced, and iterated. [#852]
Scalar Aperture objects now return scalar
positionsandbounding_boxesproperties and itsto_maskmethod returns anApertureMaskobject instead of a length-1 list containing anApertureMask. [#852]Deprecated the Aperture
mask_areamethod. [#853]Aperture
areais now an attribute instead of a method. [#854]The Aperture plot keyword
axwas deprecated and renamed toaxes. [#854]Deprecated the
unitskeyword inaperture_photometryand thePixelAperture.do_photometrymethod. [#866, #861]Deprecated
PrimaryHDU,ImageHDU, andHDUListinputs toaperture_photometry. [#867]The
aperture_photometryfunction moved to a newphotutils.aperture.photometrymodule. [#876]Renamed the
bounding_boxesattribute for pixel-based apertures tobboxfor consistency. [#896]Deprecated the
BoundingBoxas_patchmethod (instead useas_artist). [#851]
photutils.backgroundThe
Background2Dplot_mesheskeywordaxwas deprecated and renamed toaxes. [#854]
photutils.datasetsThe
make_noise_imagetypekeyword was deprecated and renamed todistribution. [#877]
photutils.detectionphotutils.isophotephotutils.psfFittableImageModeland subclasses now allow for differentoversamplingfactors to be specified in the x and y directions. [#834]Removed
pixel_scalekeyword fromEPSFStar,EPSFBuilder, andEPSFModel. [#815]Added
oversamplingkeyword tocentroid_com. [#816]Removed deprecated
Star,Stars, andLinkedStarclasses. [#894]Removed
recentering_boxsizeandcenter_accuracykeywords and addednorm_radiusandshift_valuekeywords inEPSFBuilder. [#817]Added
norm_radiusandshift_valuekeywords toEPSFModel. [#817]
photutils.segmentationRemoved deprecated
SegmentationImageattributesdata_masked,max, andis_sequentialand methodsareaandrelabel_sequential. [#825]Renamed
SegmentationImagemethodscmap(deprecated) tomake_cmapandrelabel(deprecated) toreassign_label. The newreassign_labelmethod gains arelabelkeyword. [#825]The
SegmentationImagesegmentsandslicesattributes now have the same length aslabels(noNoneplaceholders). [#825]detect_sourcesnow returnsNoneif no sources are found. Also, for this case aNoDetectionsWarningis issued. [#836]The
SegmentationImageinputdataarray must contain at least one nonzero pixel and must not contain any nonfinite values. [#836]A
ValueErroris raised if an empty list is input intoSourceCatalogor no valid sources are defined insource_properties. [#836]Deprecated the
valuesandcoordsattributes inSourceProperties. [#858]Deprecated the unused
mask_valuekeyword inmake_source_mask. [#858]The
bboxproperty now returns aBoundingBoxinstance. [#863]The
xmin/yminandxmax/ymaxproperties have been deprecated with the replacements having abbox_prefix (e.g.,bbox_xmin). [#863]The
orientationproperty is now returned as aQuantityinstance in units of degrees. [#863]Renamed the
snr(deprecated) keyword tonsigmainmake_source_mask. [#917]
photutils.utilsRenamed
random_cmaptomake_random_cmap. [#825]Removed deprecated
cutout_footprintfunction. [#835]Deprecated the
wcs_helpersfunctionspixel_scale_angle_at_skycoord,assert_angle_or_pixel,assert_angle, andpixel_to_icrs_coords. [#846]Removed deprecated
interpolate_masked_datafunction. [#895]Deprecated the
mask_to_mirrored_numfunction. [#895]Deprecated the
get_version_info,filter_data, andstd_blocksumfunctions. [#918]
0.6 (2018-12-11)#
General#
Versions of Numpy <1.11 are no longer supported. [#783]
New Features#
photutils.detectionDAOStarFinderandIRAFStarFindergain two new parameters:brightestto keep the topbrightest(based on the flux) objects in the returned catalog (after all other filtering has been applied) andpeakmaxto exclude sources with peak pixel values larger or equal topeakmax. [#750]Added a
maskkeyword toDAOStarFinderandIRAFStarFinderthat can be used to mask regions of the input image. [#759]
photutils.psfThe
Star,Stars, andLinkedStarsclasses are now deprecated and have been renamedEPSFStar,EPSFStars, andLinkedEPSFStars, respectively. [#727]Added a
GriddedPSFModelclass for spatially-dependent PSFs. [#772]The
pixel_scalekeyword inEPSFStar,EPSFBuilderandEPSFModelis now deprecated. Use theoversamplingkeyword instead. [#780]
API Changes#
photutils.detectionThe
find_peaksfunction now returns an emptyastropy.table.Tableinstead of an empty list if the input data is an array of constant values. [#709]The
find_peaksfunction will no longer issue a RuntimeWarning if the input data contains NaNs. [#712]If no sources/peaks are found,
DAOStarFinder,IRAFStarFinder, andfind_peaksnow will return an empty table with column names and types. [#758, #762]
photutils.psfThe
photutils.psf.funcs.pymodule was renamedphotutils.psf.utils.py. Theprepare_psf_modelandget_grouped_psf_modelfunctions were also moved to this newutils.pymodule. [#777]
Bug Fixes#
photutils.apertureIf a single aperture is input as a list into the
aperture_photometryfunction, then the output columns will be calledaperture_sum_0andaperture_sum_err_0(if errors are used). Previously these column names did not have the trailing “_0”. [#779]
photutils.segmentationFixed a bug in the computation of
sky_bbox_ul,sky_bbox_lr,sky_bbox_urin theSourceCatalog. [#716]
Other Changes and Additions#
Updated background and detection functions that call
astropy.stats.SigmaCliporastropy.stats.sigma_clipped_statsto support both theiriters(for astropy < 3.1) andmaxiterskeywords. [#726]
0.5 (2018-08-06)#
General#
Versions of Python <3.5 are no longer supported. [#702, #703]
Versions of Numpy <1.10 are no longer supported. [#697, #703]
Versions of Pytest <3.1 are no longer supported. [#702]
pytest-astropyis now required to run the test suite. [#702, #703]The documentation build now uses the Sphinx configuration from
sphinx-astropyrather than fromastropy-helpers. [#702]
New Features#
photutils.aperturephotutils.centroidsphotutils.datasetsAdded a
load_simulated_hst_star_imagefunction to load a simulated HST WFC3/IR F160W image of stars. [#695]
photutils.detectionAdded a
centroid_funckeyword tofind_peaks. Thesubpixelskeyword is now deprecated. [#656]The
find_peaksfunction now returnsSkyCoordobjects in the table instead of separate RA and Dec. columns. [#656]The
find_peaksfunction now returns an empty Table and issues a warning when no peaks are found. [#668]
photutils.psfphotutils.segmentationAdded a
maskkeyword to thedetect_sourcesfunction. [#621]Renamed
SegmentationImagemaxattribute tomax_label.maxis deprecated. [#662]Added a
Segmentclass to hold the cutout image and properties of single labeled region (source segment). [#662]Deprecated the
SegmentationImageareamethod. Instead, use theareasattribute. [#662]Renamed
SegmentationImagedata_maskedattribute todata_ma.data_maskedis deprecated. [#662]Renamed
SegmentationImageis_sequentialattribute tois_consecutive.is_sequentialis deprecated. [#662]Renamed
SegmentationImagerelabel_sequentialattribute torelabel_consecutive.relabel_sequentialis deprecated. [#662]Added a
missing_labelsproperty toSegmentationImage. [#662]Added a
check_labelsmethod toSegmentationImage. Thecheck_labelmethod is deprecated. [#662]
photutils.utilsDeprecated the
cutout_footprintfunction. [#656]
Bug Fixes#
photutils.apertureFixed a bug where quantity inputs to the aperture classes would sometimes fail. [#693]
photutils.detectionphotutils.isophoteFixed a bug where isophote fitting would fail when the initial center was not specified for an image with an elongated aspect ratio. [#673]
photutils.segmentationFixed
deblend_sourceswhen other sources are in the neighborhood. [#617]Fixed
source_propertiesto handle the case where the data contain one or more NaNs. [#658]Fixed an issue with
deblend_sourceswhere sources were not deblended where the data contain one or more NaNs. [#658]Fixed the
SegmentationImageareasattribute to not include the zero (background) label. [#662]
Other Changes and Additions#
photutils.isophoteCorrected the units for isophote
sareain the documentation. [#657]
0.4 (2017-10-30)#
General#
Dropped python 3.3 support. [#542]
Dropped numpy 1.8 support. Minimal required version is now numpy 1.9. [#542]
Dropped support for astropy 1.x versions. Minimal required version is now astropy 2.0. [#575]
Dropped scipy 0.15 support. Minimal required version is now scipy 0.16. [#576]
Explicitly require six as dependency. [#601]
New Features#
photutils.apertureAdded
BoundingBoxclass, used when defining apertures. [#481]Apertures now have
__repr__and__str__defined. [#493]Improved plotting of annulus apertures using Bezier curves. [#494]
Rectangular apertures now use the true minimal bounding box. [#507]
Elliptical apertures now use the true minimal bounding box. [#508]
Added a
to_skymethod for pixel apertures. [#512]
photutils.backgroundMesh rejection now also applies to pixels that are masked during sigma clipping. [#544]
photutils.datasetsphotutils.isophotephotutils.segmentationAdded a
cmapmethod toSegmentationImageto generate a random matplotlib colormap. [#513]Added
sky_centroidandsky_centroid_icrssource properties. [#592]Added new source properties representing the sky coordinates of the bounding box corner vertices (
sky_bbox_ll,sky_bbox_ulsky_bbox_lr, andsky_bbox_ur). [#592]Added new
SourceCatalogclass to hold the list ofSourceProperties. [#608]The
properties_tablefunction is now deprecated. Use theSourceCatalog.to_table()method instead. [#608]
photutils.psf
API Changes#
photutils.aperturephotutils.backgroundThe
Background2Dkeywordsexclude_mesh_methodandexclude_mesh_percentilewere removed in favor of a single keyword calledexclude_percentile. [#544]Renamed
BiweightMidvarianceBackgroundRMStoBiweightScaleBackgroundRMS. [#547]Removed the
SigmaClipclass.astropy.stats.SigmaClipis a direct replacement. [#569]
photutils.datasetsThe
make_poisson_noisefunction was renamed toapply_poisson_noise. [#527]The
make_random_gaussiansfunction was renamed tomake_random_gaussians_table. The parameter ranges must now be input as a dictionary. [#527]The
make_gaussian_sourcesfunction was renamed tomake_gaussian_sources_image. [#527]The
make_random_modelsfunction was renamed tomake_random_models_table. [#527]The
make_model_sourcesfunction was renamed tomake_model_sources_image. [#527]The
unit,hdu,wcs, andwcsheaderkeywords inphotutils.datasetsfunctions were removed. [#527]'photutils-datasets'was added as an optionallocationin theget_pathfunction. This option is used as a fallback in case the'remote'location (astropy data server) fails. [#589]
photutils.detectionThe
daofindandirafstarfinderfunctions were removed. [#588]
photutils.psfIterativelySubtractedPSFPhotometryissues a “no sources detected” warning only on the first iteration, if applicable. [#566]
photutils.segmentationphotutils.utils
Bug Fixes#
photutils.segmentationphotutils.utilsAdded a check that
dataandbkg_errorhave the same units incalc_total_error. [#537]
0.3.2 (2017-03-31)#
General#
Fixed file permissions in the released source distribution.
0.3.1 (2017-03-02)#
General#
Bug Fixes#
photutils.backgroundphotutils.geometryFixed a bug in
circular_overlap_gridaffecting 32-bit machines that could cause errors circular aperture photometry. [#475]
photutils.psf
0.3 (2016-11-06)#
New Features#
photutils.apertureAdded new
originkeyword to apertureplotmethods. [#395]Added new
idcolumn toaperture_photometryoutput table. [#446]Added
__len__method for aperture classes. [#446]Added new
to_maskmethod toPixelApertureclasses. [#453]Added new
ApertureMaskclass to generate masks from apertures. [#453]Added new
mask_area()method toPixelApertureclasses. [#453]The
aperture_photometry()function now accepts a list of aperture objects. [#454]
photutils.backgroundAdded new
MeanBackground,MedianBackground,MMMBackground,SExtractorBackground,BiweightLocationBackground,StdBackgroundRMS,MADStdBackgroundRMS, andBiweightMidvarianceBackgroundRMSclasses. [#370]Added
axiskeyword to new background classes. [#392]Added new
removed_masked,meshpix_threshold, andedge_methodkeywords for the 2D background classes. [#355]Added new
std_blocksumfunction. [#355]Added new
SigmaClipclass. [#423]Added new
BkgZoomInterpolatorandBkgIDWInterpolatorclasses. [#437]
photutils.datasetsAdded
load_irac_psffunction. [#403]
photutils.detectionphotutils.psfphotutils.psf_matchAdded
create_matching_kernelandresize_psffunctions. Also, addedCosineBellWindow,HanningWindow,SplitCosineBellWindow,TopHatWindow, andTukeyWindowclasses. [#403]
photutils.segmentation
API Changes#
photutils.apertureRemoved the
effective_gainkeyword fromaperture_photometry. Users must now input the total error, which can be calculated using thecalc_total_errorfunction. [#368]aperture_photometrynow outputs aQTable. [#446]Renamed
source_idkeyword toindicesin the apertureplot()method. [#453]Added
maskandunitkeywords to aperturedo_photometry()methods. [#453]
photutils.backgroundFor the background classes, the
filter_shapekeyword was renamed tofilter_size. Thebackground_low_resandbackground_rms_low_resclass attributes were renamed tobackground_meshandbackground_rms_mesh, respectively. [#355, #437]The
Background2Dmethodandbackfunckeywords have been removed. In its place one can input callable objects via thesigma_clip,bkg_estimator, andbkgrms_estimatorkeywords. [#437]The interpolator to be used by the
Background2Dclass can be input as a callable object via the newinterpolatorkeyword. [#437]
photutils.centroidsCreated
photutils.centroidssubpackage, which contains thecentroid_com,centroid_1dg, andcentroid_2dgfunctions. These functions now return a two-element numpy ndarray. [#428]
photutils.detectionChanged finding algorithm implementations (
daofindandstarfind) from functional to object-oriented style. Deprecated old style. [#379]
photutils.morphologyphotutils.psfRemoved the
effective_gainkeyword frompsf_photometry. Users must now input the total error, which can be calculated using thecalc_total_errorfunction. [#368]
photutils.segmentationRemoved the
effective_gainkeyword fromSourcePropertiesandsource_properties. Users must now input the total error, which can be calculated using thecalc_total_errorfunction. [#368]
photutils.utilsRenamed
calculate_total_errortocalc_total_error. [#368]
Bug Fixes#
photutils.apertureFixed a bug in
aperture_photometryso that single-row output tables do not return a multidimensional column. [#446]
photutils.centroidsFixed a bug in
centroid_1dgandcentroid_2dgthat occurred when the input data contained invalid (NaN or inf) values. [#428]
photutils.segmentationFixed a bug in
SourcePropertieswhereerrorandbackgroundunits were sometimes dropped. [#441]
0.2.2 (2016-07-06)#
General#
Bug Fixes#
photutils.detectionphotutils.utilsFixed a bug in
pixel_to_icrs_coordswhere the incorrect pixel origin was being passed. [#348]
0.2.1 (2016-01-15)#
Bug Fixes#
0.2 (2015-12-31)#
General#
Photutils has the following requirements:
Python 2.7 or 3.3 or later
Numpy 1.6 or later
Astropy v1.0 or later
New Features#
photutils.detectionfind_peaksnow returns an Astropy Table containing the (x, y) positions and peak values. [#240]find_peakshas newmask,error,wcsandsubpixelprecision options. [#244]detect_sourceswill now issue a warning if the filter kernel is not normalized to 1. [#298]Added new
deblend_sourcesfunction, an experimental source deblender. [#314]
photutils.morphologyphotutils.segmentationphotutils.utils
API Changes#
photutils.segmentationThe
relabel_sequential,relabel_segments,remove_segments,remove_border_segments, andremove_masked_segmentsfunctions are nowSegmentationImagemethods (with slightly different names). [#306]The
SegmentPropertiesclass has been renamed toSourceProperties. Likewise, thesegment_propertiesfunction has been renamed tosource_properties. [#306]The
segment_sumandsegment_sum_errattributes have been renamed tosource_sumandsource_sum_err, respectively. [#306]The
background_atcentroidattribute has been renamed tobackground_at_centroid. [#306]
Bug Fixes#
photutils.apertureFixed an issue where
np.nanornp.infwere not properly masked. [#267]
photutils.geometryoverlap_area_triangle_unit_circlehandles correctly a corner case in some i386 systems where the area of the aperture was not computed correctly. [#242]rectangular_overlap_gridandelliptical_overlap_gridfixes to normalization of subsampled pixels. [#265]overlap_area_triangle_unit_circlehandles correctly the case where a line segment intersects at a triangle vertex. [#277]
Other Changes and Additions#
Updated astropy-helpers to v1.1. [#302]
0.1 (2014-12-22)#
Photutils 0.1 was released on December 22, 2014. It requires Astropy version 0.4 or later.