mangadap.proc.emissionlinemoments module

A class hierarchy that measures moments of the observed emission lines.


License

Copyright © 2019, SDSS-IV/MaNGA Pipeline Group


class mangadap.proc.emissionlinemoments.EmissionLineMoments(database, binned_spectra, stellar_continuum=None, emission_line_model=None, redshift=None, database_list=None, artifact_path=None, bandpass_path=None, output_path=None, output_file=None, hardcopy=True, overwrite=None, checksum=False, loggers=None, quiet=False)[source]

Bases: object

Class that holds the emission-line moment measurements.

Parameters:
  • loggers (list) – (Optional) List of logging.Logger objects to log progress; ignored if quiet=True. Logging is done using mangadap.util.log.log_output(). Default is no logging.

  • quiet (bool) – (Optional) Suppress all terminal and logging output. Default is False.

loggers

List of logging.Logger objects to log progress; ignored if quiet=True. Logging is done using mangadap.util.log.log_output().

Type:

list

quiet

Suppress all terminal and logging output.

Type:

bool

_assign_image_arrays()[source]

Set image_arrays, which contains the list of extensions in hdu that are on-sky image data.

_assign_redshifts(redshift, measure_on_unbinned_spaxels, good_snr, default_redshift=None)[source]

Set the redshift to use for each spectrum for the emission-line moments.

In terms of precedence, directly provided redshifts override those in any available EmissionLineModel.

If emission_line_model and redshift are None, the default redshift is used (or 0.0 if this is also None).

To get the emission-line stellar kinematics, the function calls mangadap.proc.emissionlinemodel.EmissionLineModel.matched_kinematics(). The method must have a fit_vel_name define for this use!

In this function, the provided redshift must be a single value or None; therefore, the means of any vectors should be provided instead of the full vector.

Parameters:
  • redshift (float, numpy.ndarray) – Redshifts (\(z\)) to use for each spectrum.

  • measure_on_unbinned_spaxels (bool) – Flag that method expects to measure moments on unbinned spaxels.

  • good_snr (numpy.ndarray) – Boolean array setting which spectra have sufficient S/N for the measurements.

  • default_redshift (float, optional) – Only used if there are stellar kinematics available. Provides the default redshift to use for spectra without stellar measurements; see redshift in mangadap.proc.stellarcontinuummodel.StellarContinuumModel.matched_kinematics(). If None (default), the median of the unmasked stellar velocities will be used.

_flag_good_spectra(measure_on_unbinned_spaxels)[source]
_get_missing_bins(unique_bins=None)[source]
_initialize_primary_header(hdr=None, measurements_binid=None)[source]

Construct the primary header for the reference file.

Parameters:
  • hdr (astropy.io.fits.Header, optional) – Input base header for added keywords. If None, uses the cube header (if there is one) and then cleans the header using mangadap.util.fitsutil.DAPFitsUtil.clean_dap_primary_header().

  • measurements_binid (numpy.ndarray, optional) – Bin IDs for moment measurements. Only use is to check if this is None, and the boolean result is saved to the header to indicate if the emission-line moment measurements are disconnected from the stellar-continuum measurements.

Returns:

Initialized header object.

Return type:

astropy.io.fits.Header

channel_names()[source]
static continuum_subtracted_moments(wave, spec, mainbands, restwave, bcen, bcont, rcen, rcont, spec_n=None, err=None, sres=None)[source]

Calculate the continuum-subtracted moments

err and sres are single vectors that are the same for all spec!

Returns:

cntm cntb flux fluxerr mom1 mom1err mom2 mom2err sinst incomplete empty divbyzero undefined_mom2

static default_paths(cube, method_key, rdxqa_method, binning_method, stelcont_method=None, elmodel_method=None, output_path=None, output_file=None)[source]

Set the default directory and file name for the output file.

Parameters:
  • cube (mangadap.datacube.datacube.DataCube) – Datacube to analyze.

  • method_key (str) – Keyword designating the method used for the reduction assessments.

  • rdxqa_method (str) – The method key for the basic assessments of the datacube.

  • binning_method (str) – The method key for the spatial binning.

  • stelcont_method (str, optional) – The method key for the stellar-continuum fitting method. If None, not included in output file name.

  • elmodel_method (str, optional) – The method key for the emission-line modeling method. If None, not included in the output file name.

  • output_path (str, Path, optional) – The path for the output file. If None, the current working directory is used.

  • output_file (str, optional) – The name of the output “reference” file. The full path of the output file will be directory_path/output_file. If None, the default is to combine cube.output_root and the method keys. The order of the keys is the order of operations (rdxqa, binning, stellar continuum, emission-line model).

Returns:

Returns a Path with the output directory and a str with the output file name.

Return type:

tuple

file_name()[source]

Return the name of the output file.

file_path()[source]

Return the full path to the output file.

measure(binned_spectra, stellar_continuum=None, emission_line_model=None, redshift=None, output_path=None, output_file=None, hardcopy=True, overwrite=None, loggers=None, quiet=False)[source]

Measure the emission-line moments using the binned spectra.

If neither stellar-continuum nor emission-line models are provided:

  • Moments are measure on the binned spectra

  • No continuum subtraction is performed

If a stellar-continuum model is provided without an emission-line model:

  • Moments are measured on the binned spectra

  • The best-fitting stellar continuum is subtracted

If an emission-line model is provided without a stellar-continuum model:

  • Moments are measured on the relevant (binned or unbinned) spectra

  • If the emission-line model includes data regarding the stellar-continuum fit (template spectra and template weights), the continuum is subtracted before the measurements are made; otherwise, no continuum is subtracted

If both stellar-continuum and emission-line models are provided, and if the stellar-continuum and emission-line fits are performed on the same spectra:

  • Moments are measured on the relevant (binned or unbinned) spectra

  • If the emission-line model includes data regarding the stellar-continuum fit (template spectra and template weights), the continuum is subtracted before the measurements are made; otherwise, the stellar continuum is used.

If both stellar-continuum and emission-line models are provided, and if the stellar-continuum and emission-line fits are performed on different spectra:

  • The behavior is exactly as if the stellar-continuum model was not provided.

Parameters:
  • output_path (str, Path, optional) – The path for the output file. If None, the current working directory is used.

  • output_file (str, optional) – The name of the output “reference” file. The full path of the output file will be directory_path/output_file. If None, the default is to combine cube.output_root and the method keys. The order of the keys is the order of operations (rdxqa, binning, stellar continuum, emission-line model).

static measure_moments(momdb, wave, flux, ivar=None, mask=None, sres=None, continuum=None, redshift=None, bitmask=None)[source]

Measure the emission-line moments.

If not input as masked arrays, flux is converted to one.

read(ifile=None, strict=True, checksum=False)[source]

Read an existing file with a previously binned set of spectra.

static sideband_pseudocontinua(wave, spec, sidebands, spec_n=None, err=None, log=True)[source]

Get the side-band integrals.

err is a single vector that is the same for all spec!

Returns:

Return five arrays or floats: (1) The center of each passband, (2) the mean continuum level, (3) the propagated error in the continuum level (will be None if no errors are provided), (4) flag that part of the passband was masked, (5) flag that the passband was fully masked or empty.

Return type:

float, numpy.ndarray

static single_band_moments(wave, spec, passband, restwave, err=None)[source]

Measure the moments for a single band.

If spectrum errors are not provided, moment errors are returned as 0.0.

Parameters:
  • wave (numpy.ndarray) – Wavelengths in angstroms

  • spec (numpy.ndarray) – Flux in flux density (per angstrom)

  • restwave (float) – The rest wavelength of the line.

  • err (numpy.ndarray) – The 1-sigma errors in the flux density.

Returns:

flux fluxerr mom1 mom1err mom2 mom2err incomplete band empty band division by zero undefined 1st moment undefined 2nd moment

write(overwrite=False)[source]

Write the hdu object to the file.

class mangadap.proc.emissionlinemoments.EmissionLineMomentsBitMask[source]

Bases: DAPBitMask

Derived class that specifies the mask bits for the emission-line moment measurements. The maskbits defined are:

Key

Bit

Description

DIDNOTUSE

0

Pixel was ignored because it was flagged as DONOTUSE or FORESTAR by the DRP, or as LOW_SPECCOV, LOW_SNR, or NONE_IN_STACK in the binning step.

FORESTAR

1

Pixel was ignored because it was flagged as FORESTAR by the DRP.

LOW_SNR

2

Pixel was ignored because the S/N estimate of the spectrum was below the set threshold; see header keyword ELMMINSN.

MAIN_EMPTY

5

Line moments not measured because the main passband had no observed fluxes.

BLUE_EMPTY

6

Line moments not measured because the blue passband had no observed fluxes.

RED_EMPTY

7

Line moments not measured because the red passband had no observed fluxes.

MAIN_INCOMP

8

There were masked fluxes in the main passband.

BLUE_INCOMP

9

There were masked fluxes in the blue passband.

RED_INCOMP

10

There were masked fluxes in the red passband.

DIVBYZERO

11

Could not compute emission-line moment or its error because of a zero devision.

NO_ABSORPTION_CORRECTION

12

Moment has not been corrected for underlying absorption because no stellar-continuum model was provided or the model did not cover the necessary spectral range.

MAIN_JUMP

13

Some fraction of, but less than all, the pixels in the main passband were not fit by the stellar-continuum model, meaning the bandpass integral should not be trusted.

BLUE_JUMP

14

Some fraction of, but less than all, the pixels in the blue sideband were not fit by the stellar-continuum model, meaning the bandpass integral should not be trusted.

RED_JUMP

15

Some fraction of, but less than all, the pixels in the red sideband were not fit by the stellar-continuum model, meaning the bandpass integral should not be trusted.

JUMP_BTWN_SIDEBANDS

16

The stellar-continuum was subtracted from one sideband, but not the other, meaning that the determination of the continuum beneath the line is invalid.

UNDEFINED_MOM1

17

First moment is undefined, likely because the passband was empty

UNDEFINED_MOM2

18

Second moment is undefined, likely because it leads to the square-root of a negative number.

UNDEFINED_BANDS

19

No moments calculated because the bandpasses were not, or improperly, defined.

NON_POSITIVE_CONTINUUM

20

Equivalent width measurements were not computed because the continuum in either the blue or red sidebands was not positive.

cfg_root = 'emission_line_moments_bits'
class mangadap.proc.emissionlinemoments.EmissionLineMomentsDataTable(neml=1, bitmask=None, shape=None)[source]

Bases: DataTable

Primary data table with the results of the emission-line-moment calculations.

Table includes:

Key

Type

Description

BINID

int64

Spectrum/Bin ID number

BINID_INDEX

int64

Index of the spectrum in the list of provided spectra.

REDSHIFT

float64

Redshift used for shifting the passbands

MASK

bool

Bad-value boolean or bit mask value for the moments

BCEN

float64

Center of the blue sideband.

BCONT

float64

Pseudo-continuum in the blue sideband

BCONTERR

float64

Error in the blue-sideband pseudo-continuum

RCEN

float64

Center of the red sideband.

RCONT

float64

Pseudo-continuum in the red sideband

RCONTERR

float64

Error in the red-sideband pseudo-continuum

CNTSLOPE

float64

Continuum slope used to determine the continuum at the line center.

FLUX

float64

Summed flux (0th moment)

FLUXERR

float64

Error in the summed flux

MOM1

float64

Line centroid redshift (\(cz\); 1st moment)

MOM1ERR

float64

Error in the line centroid redshift

MOM2

float64

Line standard deviation (2nd moment)

MOM2ERR

float64

Error in the line standard deviation

SINST

float64

Instrumental dispersion at the line centroid

BMED

float64

Median flux in the blue sideband used for EW

RMED

float64

Median flux in the red sideband used for EW

EWCONT

float64

Continuum value used for EW calculation

EW

float64

Equivalent width (FLUX/pseudo continuum)

EWERR

float64

Error in the equivalent width

Parameters:
  • neml (int) – Number of emission lines being measured.

  • bitmask (BitMask, optional) – Object used to flag mask bits. If None, flags are simply boolean.

  • shape (int, tuple, optional) – The shape of the initial array. If None, the data array will not be instantiated; use init() to initialize the data array after instantiation.

class mangadap.proc.emissionlinemoments.EmissionLineMomentsDef(key='EMOMMPL11', minimum_snr=0.0, pixelmask=None, passbands='ELBMPL9', redo_postmodeling=True, fit_vel_name='Ha-6564', overwrite=False)[source]

Bases: KeywordParSet

A class that holds the parameters necessary to perform the emission-line moment measurements.

The defined parameters are:

Key

Type

Options

Default

Description

key

str

EMOMMPL11

Keyword used to distinguish between different emission-line moment databases.

minimum_snr

int, float

0.0

Minimum S/N of spectrum to analyze

pixelmask

SpectralPixelMask

Object used to mask spectral pixels

passbands

str

ELBMPL9

Either a string identifying the emission-line bandpass filter database to use, or the direct path to the parameter file defining the database

redo_postmodeling

bool

True

Redo the moment measurements after the emission-line modeling has been performed

fit_vel_name

str

Ha-6564

The name of the emission line used to set the redshift of each spaxel used to set the observed wavelength of the bandpasses.

overwrite

bool

False

If the output file already exists, redo all the calculations and overwrite it.

_validate()[source]

Validate the object and instantiate the passband database to use for the emission-line moments.

classmethod from_dict(d)[source]

Instantiate from a dictionary.