Skip to content

Commit

Permalink
Fix for astropy 5.3 (conversion of astropy.units.Quantity to bool tha…
Browse files Browse the repository at this point in the history
…t was deprecated since astropy 3.0 now raises a ValueError)
  • Loading branch information
tonywong94 committed Jul 29, 2023
1 parent b4d0261 commit 5e7d914
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions astrodendro/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def major_sigma(self):
computed from the intensity weighted second moment in direction of
greatest elongation in the PP plane.
"""
dx = self.spatial_scale or u.pixel
dx = self.spatial_scale if self.spatial_scale is not None else u.pixel
a, b = self._sky_paxes()
# We need to multiply the second moment by two to get the major axis
# rather than the half-major axis.
Expand All @@ -335,7 +335,7 @@ def minor_sigma(self):
computed from the intensity weighted second moment perpendicular to
the major axis in the PP plane.
"""
dx = self.spatial_scale or u.pixel
dx = self.spatial_scale if self.spatial_scale is not None else u.pixel
a, b = self._sky_paxes()
# We need to multiply the second moment by two to get the minor axis
# rather than the half-minor axis.
Expand Down Expand Up @@ -462,7 +462,7 @@ def v_rms(self):
0 following the Numpy convention - the third axis in the FITS
convention).
"""
dv = self.velocity_scale or u.pixel
dv = self.velocity_scale if self.velocity_scale is not None else u.pixel
ax = [0, 0, 0]
ax[self.vaxis] = 1
return dv * np.sqrt(self.stat.mom2_along(tuple(ax)))
Expand All @@ -484,7 +484,7 @@ def area_exact(self):
"""
The exact area of the structure on the sky.
"""
dx = self.spatial_scale or u.pixel
dx = self.spatial_scale if self.spatial_scale is not None else u.pixel
indices = zip(*tuple(self.stat.indices[i] for i in range(3) if i != self.vaxis))
return len(set(indices)) * dx ** 2

Expand Down Expand Up @@ -562,7 +562,7 @@ def area_exact(self):
"""
The exact area of the structure on the sky.
"""
dx = self.spatial_scale or u.pixel
dx = self.spatial_scale if self.spatial_scale is not None else u.pixel
return self.stat.count() * dx ** 2


Expand Down

0 comments on commit 5e7d914

Please sign in to comment.