Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions signal_id/_moment_errs.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
np2wcs = {2: 0, 1: 1, 0: 2}


def moment0_error(cube, scale, axis, how='auto'):
def moment0_error(cube, scale, axis=0, how='auto'):
'''
Compute the zeroth moment error.

Expand Down Expand Up @@ -75,7 +75,7 @@ def moment0_error(cube, scale, axis, how='auto'):
header=cube._nowcs_header)


def moment1_error(cube, scale, axis, how='auto', moment0=None, moment1=None):
def moment1_error(cube, scale, axis=0, how='auto', moment0=None, moment1=None):
'''
Compute the first moment error.

Expand Down Expand Up @@ -113,7 +113,7 @@ def moment1_error(cube, scale, axis, how='auto', moment0=None, moment1=None):

# Remove velocity offset from centroid to match cube._pix_cen
# Requires converting to a Quantity
moment1 = u.Quantity(moment1)
moment1 = u.Quantity(moment1.copy())
moment1 -= cube.spectral_axis[0]

if how == "cube":
Expand All @@ -136,7 +136,7 @@ def moment1_error(cube, scale, axis, how='auto', moment0=None, moment1=None):
header=cube._nowcs_header)


def moment2_error(cube, scale, axis, how='auto', moment0=None, moment1=None,
def moment2_error(cube, scale, axis=0, how='auto', moment0=None, moment1=None,
moment2=None, moment1_err=None):
'''
Compute the second moment error.
Expand Down Expand Up @@ -175,7 +175,7 @@ def moment2_error(cube, scale, axis, how='auto', moment0=None, moment1=None,

# Remove velocity offset to match cube._pix_cen
# Requires converting to a Quantity
moment1 = u.Quantity(moment1)
moment1 = u.Quantity(moment1.copy())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

making it a Quantity doesn't automatically copy the data? I guess I didn't realize that. It might be better to have copy=True as a parameter, since that's default for, e.g., np.array

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed it didn't automatically, so I'll go back and check if this is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, it's automatically copied.

moment1 -= cube.spectral_axis[0]

if moment2 is None:
Expand Down