Skip to content

Commit

Permalink
Actually convert to velocity
Browse files Browse the repository at this point in the history
  • Loading branch information
rosteen committed Nov 29, 2023
1 parent 3674908 commit 83d0bd0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ def _set_data_units(self, event={}):
unit = self.app.data_collection[self.dataset_selected].coords.world_axis_units[0]
self.dataset_spectral_unit = unit


@with_spinner()
def calculate_moment(self, add_data=True):
"""
Expand Down Expand Up @@ -144,8 +143,11 @@ def calculate_moment(self, add_data=True):
if data_wcs:
data_wcs = data_wcs.swapaxes(0, 1) # We also transpose WCS to match.
self.moment = CCDData(analysis.moment(slab, order=n_moment).T, wcs=data_wcs)
self.moment = self.moment.convert_unit_to(self.dataset_spectral_unit)
if self.output_unit == "Velocity":
self.moment = c*(self.moment-self.reference_wavelength)/self.reference_wavelength
ref_wavelength = self.reference_wavelength * u.Unit(self.dataset_spectral_unit)
in_velocity = c*(self.moment-ref_wavelength)/ref_wavelength
self.moment = CCDData(in_velocity, wcs=data_wcs)

fname_label = self.dataset_selected.replace("[", "_").replace("]", "")
self.filename = f"moment{n_moment}_{fname_label}.fits"
Expand Down

0 comments on commit 83d0bd0

Please sign in to comment.