-
-
Notifications
You must be signed in to change notification settings - Fork 146
Description
Photutils exist memory leakage which is caused by the kron_radius:
`---------------------------------------------------------------------------
MemoryError Traceback (most recent call last)
...
File ~/anaconda3/lib/python3.12/site-packages/photutils/aperture/ellipse.py:96, in EllipticalMaskMixin.to_mask(self, method, subpixels)
94 ny, nx = bbox.shape
95 theta_rad = self.theta.to(u.radian).value
---> 96 mask = elliptical_overlap_grid(edges[0], edges[1], edges[2],
97 edges[3], nx, ny, a, b,
98 theta_rad, use_exact, subpixels)
100 # subtract the inner ellipse for an annulus
101 if hasattr(self, 'a_in'):
File photutils/geometry/elliptical_overlap.pyx:81, in photutils.geometry.elliptical_overlap.elliptical_overlap_grid()
MemoryError: Unable to allocate 182. GiB for an array with shape (141384, 172556) and data type float64`
I solved this problem by setting upper limit of kron radius at function def _calc_kron-radius:
` def _calc_kron_radius(self, kron_params):
3060 """
3061 Calculate the unscaled first-moment Kron radius, applying any
3062 minimum Kron or circular radius to the measured Kron radius.
3064 Returned as a Quantity array or scalar (if self isscalar) with
3065 pixel units.
3067 kron_radius = self._measured_kron_radius.copy()
3068 print(kron_radius)
3069 # set minimum (unscaled) kron radius
3070 kron_radius[kron_radius < kron_params[1]] = kron_params[1]
3071 kron_radius[kron_radius > 1000] = 1000`
All the best!