mangadap.proc.reductionassessments module

Class that performs basic assessments of the reduced data products needed for handling of the data by the DAP. These assessments need only be done once per data file.


License

Copyright © 2019, SDSS-IV/MaNGA Pipeline Group


class mangadap.proc.reductionassessments.ReductionAssessment(method, cube, pa=None, ell=None, reff=None, output_path=None, output_file=None, hardcopy=True, symlink_dir=None, checksum=False, loggers=None, quiet=False)[source]

Bases: object

Perform basic assessments of the datacube.

These assessments are needed for handling of the data by the DAP and only to be done once per datacube.

See compute() for the provided data.

Parameters:
  • method (ReductionAssessmentDef) – Object that defines the main parameters used for the assessment method.

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

  • pa (float, optional) – On-sky position angle of the major axis used to calculate elliptical, semi-major-axis coordinates, defined as the angle from North through East and denoted \(\phi_0\).

  • ell (float, optional) – Ellipticity defined as \(\varepsilon=1-b/a\), based on the semi-minor to semi-major axis ratio (\(b/a\)) of the isophotal ellipse used to calculate elliptical, semi-major-axis coordinates.

  • reff (float, optional) – Effective radius of the galaxy. If None, set to 1.

  • 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_key. See default_paths().

  • hardcopy (bool, optional) – Flag to write the data to a fits file.

  • symlink_dir (str, optional) – Create a symlink to the file in this directory.

  • checksum (bool, optional) – Compare the checksum when reading the data.

  • 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 terminal and logging output.

method

Parameters defining the method to use for the reduction assessments.

Type:

ReductionAssessmentDef

cube

Datacube to analyze.

Type:

mangadap.datacube.datacube.DataCube

pa

On-sky position angle of the major axis used to calculate elliptical, semi-major-axis coordinates, defined as the angle from North through East and denoted \(\phi_0\).

Type:

float

ell

Ellipticity defined as \(\varepsilon=1-b/a\), based on the semi-minor to semi-major axis ratio (\(b/a\)) of the isophotal ellipse used to calculate elliptical, semi-major-axis coordinates.

Type:

float

reff

Effective radius of the galaxy.

Type:

float

output_path

The exact path for the output file.

Type:

str

output_file

The name of the file for the computed assessments. The full path of the output file will be directory_path/output_file.

Type:

str

hardcopy

Flag to write the data to a fits file.

Type:

bool

Create a symlink to the file in this directory.

Type:

str

hdu

HDUList with the data, with columns as described above.

Type:

astropy.io.fits.HDUList

correlation

If requested, provides the spatial correlation matrix for the flux at a fiducial wavelength in the datacube. See covar_wave and covar_channel.

Type:

mangadap.util.covariance.Covariance

covar_wave

The wavelength in angstroms at which the correlation matrix (correlation) was calculated, if available. Can be None if the covariance matrix is pulled directly from cube.

Type:

float

covar_channel

The wavelength channel at which the correlation matrix (correlation) was calculated, if available. Can be None if the covariance matrix is pulled directly from cube.

Type:

int

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 terminal and logging output.

Type:

bool

_initialize_primary_header(hdr=None)[source]

Constuct 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().

Returns:

Initialized header object.

Return type:

astropy.io.fits.Header

compute(cube, pa=None, ell=None, reff=None, output_path=None, output_file=None, hardcopy=True, symlink_dir=None, overwrite=None, loggers=None, quiet=False)[source]

Compute and output the main data products. The list of HDUs are:

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

  • pa (float, optional) – On-sky position angle of the major axis used to calculate elliptical, semi-major-axis coordinates, defined as the angle from North through East and denoted \(\phi_0\).

  • ell (float, optional) – Ellipticity defined as \(\varepsilon=1-b/a\), based on the semi-minor to semi-major axis ratio (\(b/a\)) of the isophotal ellipse used to calculate elliptical, semi-major-axis coordinates.

  • reff (float, optional) – Effective radius of the galaxy. If None, set to 1.

  • 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_key. See default_paths().

  • hardcopy (bool, optional) – Flag to write the data to a fits file.

  • symlink_dir (str, optional) – Create a symlink to the file in this directory.

  • overwrite (bool, optional) – If the output file already exists, this will force the assessments to be redone and the output file to be overwritten. If None, uses the value in method.

  • 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 terminal and logging output.

Raises:
static default_paths(cube, method_key, 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.

  • 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_key.

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 a Path object with the full path to the output file.

info()[source]
class mangadap.proc.reductionassessments.ReductionAssessmentDataTable(shape=None)[source]

Bases: DataTable

Primary data table with the reduction assessments.

The data table includes:

Key

Type

Description

SPAT_INDX

int64

The 2D spatial array indices associated with each measurement. See spatial_index.

SKY_COO

float64

On-sky X and Y coordinates. Coordinates are sky-right offsets from the object center; i.e., positive X is along the direction of positive right ascension. See mangadap.datacube.datacube.DataCube.mean_sky_coordinates.

ELL_COO

float64

Elliptical (semi-major axis) radius and azimuth angle from N through E with respect to the photometric position angle; based on the provided ellipticity parameters. See mangadap.util.geometry.SemiMajorAxisCoo.

FGOODPIX

float64

Fraction of good pixels in each spectrum.

SIGNAL

float64

Per pixel mean flux

VARIANCE

float64

Per pixel mean variance

SNR

float64

Per pixel mean S/N

Parameters:

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.reductionassessments.ReductionAssessmentDef(key='SNRG', waverange=None, response_func_file='gunn_2001_g_response.db', in_vacuum=True, covariance=True, minimum_frac=0.8, overwrite=False)[source]

Bases: KeywordParSet

Define how to assess the reduced data.

The defined parameters are:

Key

Type

Options

Default

Description

key

str

SNRG

Keyword to distinguish the assessment method.

waverange

ndarray, list

A two-element vector with the starting and ending wavelength within which to calculate the signal-to-noise. Mutually exclusive with response_func_file

response_func_file

str

gunn_2001_g_response.db

The name of a file that defines a response function to use for the S/N calculation. Must be a local file or distributed with the DAP source code. Expected to have two columns, with the wavelength and response efficiency. Mutually exclusive with waverange.

in_vacuum

bool

True

Boolean indicating that the wavelengths provided either using waverange or response_func_file are in vacuum (not air).

covariance

bool

True

Provide the fiducial spatial covariance. If this is False, no spatial covariance will be available for calculations that use the results of the reduction assessments. If True and a covariance matrix is available directly from the datacube, it will be used. If True and the datacube does not already provide a computed covariance matrix, one is calculated using covariance_matrix() method. WARNING: If either of these fail, the DAP will issue a warning and continue assuming no spatial covariance.

minimum_frac

int, float

0.8

Minimum fraction of unmasked pixels in a spectrum required for inclusion in the spatial covariance calculation. Note this should match the value used for the spatial-binning module.

overwrite

bool

False

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

_validate()[source]

Validate the parameters.