Moment Maps#
Plugin Availability
The plugin will be visible when at least one compatible dataset is loaded.
Create moment maps from spectral cubes.
Description#
The Moment Maps plugin computes moment maps by integrating flux along the spectral axis raised to various powers. Moment maps characterize spectral line properties in 2D, including integrated flux, velocity, and dispersion.
Key Features:
Calculate moment 0 through moment 4 maps
Continuum subtraction support
Velocity or wavelength output units
Spectral region selection
Export to FITS format
Details#
Moment Orders#
Mathematically, moment N is: $M_N = int I(lambda) lambda^N dlambda$
Moment 0: Integrated flux (line strength)
Moment 1: Flux-weighted centroid (line center, velocity)
Moment 2: Dispersion (line width, velocity dispersion)
Moment 3: Skewness (asymmetry)
Moment 4: Kurtosis (peak sharpness)
Moment 0 is most commonly used for creating line maps. Moments 1 and 2 are used for kinematic analysis. Moments 3 and 4 are less common but useful for detailed line profile analysis.
Output Units#
For moment 0, output is in flux * spectral_unit (e.g., Jy * μm).
For moments ≥ 1, choose output units:
Wavelength/Spectral Unit: Output in spectral axis units (μm, Angstrom, Hz, etc.)
Velocity: Output in velocity units (km/s) relative to reference wavelength
Velocity conversion requires specifying a reference wavelength (typically the rest wavelength of the spectral line of interest).
Continuum Subtraction#
For clean moment maps of emission or absorption lines, continuum subtraction is essential. The plugin supports:
None: Use original data (for continuum emission or pre-subtracted data)
Fitted: Use continuum model from Model Fitting plugin
Subset-based: Define continuum regions via spectral subsets
When using continuum subtraction, specify:
Continuum dataset: Which dataset contains the continuum
Continuum width: For subset-based, fractional width of endpoints to use
Spectral Region#
Limit the integration to a specific spectral region:
Entire Spectrum: Use all wavelengths
Spectral Subset: Use defined spectral region (recommended for lines)
For line moment maps, create a spectral subset around the line of interest to exclude contamination from other features and reduce noise.
UI Access#
Control data and subset layer order and visibility for each viewer. Toggle layer visibility, reorder layers by dragging, and manage which data appears in the viewer.
dm = jd.viewers[viewer].data_menu
Opening the Plugin#
- Cubeviz:
Click the Moment Maps icon in the plugin toolbar.
Workflow#
Load cube into Cubeviz
Select dataset from Data dropdown
Set spectral region:
Draw subset around spectral feature in spectrum viewer, OR
Select subset from Spectral region dropdown, OR
Use Entire Spectrum
Configure continuum (for line maps):
Select Continuum subtraction method
Choose Continuum dataset if using fitted continuum
Set Continuum width if using subset-based
Set moment order in Moment field
Configure output units (for moment ≥ 1):
Select Output unit (Spectral Unit or Velocity)
If Velocity, set Reference wavelength
Set output label (auto-generated by default)
Click Calculate to create moment map
(Optional) Click Save as FITS to export
Results#
The moment map is:
Displayed in selected image viewer
Available in data dropdown menus
Can be saved to FITS file
API Access#
Accessing the Plugin#
from jdaviz import Cubeviz
cubeviz = Cubeviz()
cubeviz.show()
cubeviz.load('cube.fits', format='3D Spectrum')
# Access plugin
plg = cubeviz.plugins['Moment Maps']
Moment 0 Map (Line Flux)#
# Configure for moment 0
plg.dataset = 'cube[FLUX]'
plg.spectral_subset = 'Subset 1' # Around emission line
plg.n_moment = 0
# Calculate
moment_map = plg.calculate_moment(add_data=True)
Moment 1 Map (Velocity)#
# Configure for velocity moment 1
plg.n_moment = 1
plg.output_unit = 'Velocity'
plg.reference_wavelength = 6562.8 # H-alpha in Angstroms
velocity_map = plg.calculate_moment(add_data=True)
Continuum Subtraction#
# Use fitted continuum
plg.continuum = 'Fitted'
plg.continuum_dataset = 'fitted_continuum'
# Or use subset-based continuum
plg.continuum = 'Subset'
plg.continuum_width = 0.1 # Use 10% of endpoints
moment_map = plg.calculate_moment(add_data=True)
Moment 2 Map (Dispersion)#
# Velocity dispersion in km/s
plg.n_moment = 2
plg.output_unit = 'Velocity'
plg.reference_wavelength = 6562.8
dispersion_map = plg.calculate_moment(add_data=True)
Custom Output#
# Control output
plg.add_results.label = 'halpha_moment0'
plg.add_results.viewer = 'flux-viewer'
# Calculate without adding to app
moment_map = plg.calculate_moment(add_data=False)
# Access data
flux_array = plg.moment.data
wcs = plg.moment.wcs
Batch Processing#
# Calculate multiple moments
lines = {
'halpha': {'subset': 'Subset 1', 'ref_wave': 6562.8},
'nii': {'subset': 'Subset 2', 'ref_wave': 6583.5}
}
for line_name, params in lines.items():
plg.spectral_subset = params['subset']
plg.reference_wavelength = params['ref_wave']
for n in [0, 1, 2]:
plg.n_moment = n
plg.add_results.label = f'{line_name}_m{n}'
plg.calculate_moment(add_data=True)
API References#
- Only the following attributes and methods are available through the
-
dataset(DatasetSelect): Dataset to use for computing line statistics.spectral_subset(SubsetSelect): Subset to use for the line, orEntire Spectrum.continuum(SubsetSelect): Subset to use for the continuum, orNoneto skip continuum subtraction, orSurroundingto use a region surrounding the subset set inspectral_subset.continuum_dataset(DatasetSelect): Dataset of the extracted 1D spectrum to use when visualizing the continuum. The continuum will be redetermined based on the input cube (dataset) when computing the moment map.continuum_width: Width, relative to the overall line spectral region, to fit the linear continuum (excluding the region containing the line). If 1, will use endpoints within line region only.n_momentoutput_unitChoice of “Wavelength” or “Velocity”, applicable for n_moment >= 1.reference_wavelengthReference wavelength for conversion of output to velocity units.add_results(AddResults)
For detailed API documentation, see MomentMap.
Example Notebooks#
CubevizExample.ipynb - Includes moment map examples
See Also#
Moment Maps - Detailed Cubeviz moment maps documentation
Collapse - Alternative collapse method
3D Spectral Extraction - Extract 1D spectra