mangadap.config.manga module
Class defining the I/O configuration for MaNGA files in the DAP.
Copyright © 2019, SDSS-IV/MaNGA Pipeline Group
- class mangadap.config.manga.MaNGAAnalysisPlan(planlist, cube=None, analysis_path=None)[source]
Bases:
AnalysisPlan
Define the analysis plan and output paths for MaNGA data.
This class only redefines the output paths from the base class.
- method_path(plan_index=0, qa=False, ref=False)[source]
Return the path for method-specific output.
- Parameters:
cube (
DataCube
, optional) – Cube being analyzed. Passed for cube-specific path specification. Not used by this base class.plan_index (
int
, optional) – The index of the plan. This is used to select the ‘key’ of the analysis plan being used, which is used as the subdirectory for the output.qa (
bool
, optional) – Flag that the output is specifically quality assessment plots.ref (
bool
, optional) – Flag that the output is specifically reference data.
- Returns:
Path object for the method-specific output
- Return type:
- Raises:
ValueError – Raised if the plan index is invalid or if both qa and ref are true.
- class mangadap.config.manga.MaNGAConfig(plate, ifudesign, mode='CUBE', log=True, drpver=None, redux_path=None, chart_path=None, directory_path=None)[source]
Bases:
object
- property cfg_root
Generate the root name of the MaNGA DAP configuration and script files.
- Returns:
Root name for the DAP file:
mangadap-[PLATE]-[IFUDESIGN]-LOG[MODE]
- Return type:
str
- static check_mode(mode)[source]
Check that the mode is valid.
Valide modes are set by
mode_options()
.- Parameters:
mode (
str
) – Mode value to check.- Raises:
ValueError – Raised if the mode is undefined.
- static cube_recenter()[source]
Return the default recentering flag used when regridding the DRP RSS spectra into the CUBE format.
- static cube_width_buffer()[source]
Return the default width buffer in pixels used when regridding the DRP RSS spectra into the CUBE format.
- property file_name
- property file_path
- classmethod from_file(datafile)[source]
Initialize the I/O configuration from the datafile for the DAP to process.
- property image_path
- instrument = 'manga'
- property output_root
- static propagate_flags()[source]
Flags that should be propagated from the observed data to the analysis data.
- static regrid_rlim()[source]
Return the default limiting radius for the Gaussian kernel used when regridding the DRP RSS spectra into the CUBE format.
- static regrid_sigma()[source]
Return the default standard deviation of the Gaussian kernel used when regridding the DRP RSS spectra into the CUBE format.
- static spectral_resolution(hdu, ext=None, fill=False, median=False)[source]
Return the spectral resolution for all spectra.
See
spectral_resolution_extension()
for a description of the precedence used whenext
is None.- Parameters:
hdu (astropy.io.fits.HDUList) – The opened MaNGA DRP file.
ext (
str
, optional) – Specify the extension with the spectral estimate to use. Seespectral_resolution_extension()
.fill (
bool
, optional) – Fill masked values by interpolation. Default is to leave masked pixels in returned array.median (
bool
, optional) – Return a single vector with the median spectral resolution instead of a per spectrum array. When using theSPECRES
extension, this just returns the vector provided by the DRP file; when using either of theLSF
extensions, this performs a masked median across the array and then interpolates any wavelengths that were masked in all vectors.
- Returns:
Returns a
str
with the name of the extension used for the spectral-resolution measurements and a numpy.ma.MaskedArray with the spectral resolution data. Even if interpolated such that there should be no masked values, the function returns a masked array. Array contains the spectral resolution (\(R = \lambda/\Delta\lambda\)) pulled from the DRP file.- Return type:
tuple
- static spectral_resolution_extension(hdu, ext=None)[source]
Determine the spectral resolution channel to use.
Precedence follows this order:
LSFPRE
,PRESPECRES
,LSFPOST
,SPECRES
.- Parameters:
hdu (astropy.io.fits.HDUList) – The opened MaNGA DRP file.
ext (
str
, optional) – Specify the extension with the spectral estimate to use. Should be in None,LSFPRE
,PRESPECRES
,LSFPOST
, orSPECRES
. The default is None, which means it will return the extension found first in the order above. None is returned if none of the extensions are present.
- Returns:
The name of the preferred extension to use.
- Return type:
str
- static write_config(ofile, plate, ifudesign, log=True, z=None, vdisp=None, ell=None, pa=None, reff=None, sres_ext=None, sres_fill=None, covar_ext=None, drpver=None, redux_path=None, directory_path=None, overwrite=True)[source]
Write the configuration file that can be used to instantiate a MaNGA data object (
mangadap.datacube.manga.MaNGADataCube
ormangadap.spectra.manga.MaNGARSS
).See
from_config()
.- Parameters:
ofile (
str
, optional) – Name of the configuration file.plate (
int
) – Plate numberifudesign (
int
) – IFU designlog (
bool
, optional) – Use the datacube that is logarithmically binned in wavelength.z (
float
, optional) – Estimated bulk redshift. If None, some of the DAP analysis modules will fault.vdisp (
float
, optional) – Estimated velocity dispersion. If None, some of the DAP analysis modules will assume an initial guess of 100 km/s.ell (
float
, optional) – Characteristic isophotal ellipticity (1-b/a). If None, some of the DAP modules will issue a warning and continue by assumingell=0
.pa (
float
, optional) – Characteristic isophotal position angle (through E from N). If None, some of the DAP modules will issue a warning and continue by assumingpa=0
.reff (
float
, optional) – Effective (half-light) radius in arcsec. If None, some of the DAP modules will issue a warning and continue by assumingreff=1
.sres_ext (
str
, optional) – The extension to use when constructing the spectral resolution vectors. Seespectral_resolution()
.sres_fill (
bool
, optional) – Fill masked values by interpolation. Default is to leave masked pixels in returned array.covar_ext (
str
, optional) – Extension to use as the single spatial correlation matrix for all wavelength channels, read from the DRP file. For generating the covariance matrix directly for an arbitrary wavelength channel using the RSS file, seemangadap.datacube.datacube.DataCube.covariance_matrix()
.drpver (
str
, optional) – DRP version, which is used to define the default DRP redux path. Default is defined bymangadap.config.manga.drp_version()
redux_path (
str
, optional) – The path to the top level directory containing the DRP output files for a given DRP version. Default is defined bymangadap.config.manga.drp_redux_path()
.directory_path (
str
, optional) – The exact path to the DRP file. Default is defined bymangadap.config.manga.drp_directory_path()
. Providing this ignores anything provided fordrpver
orredux_path
.overwrite (
bool
, optional) – Overwrite any existing parameter file.
- mangadap.config.manga.dap_analysis_path(drpver=None, dapver=None)[source]
Return the main output path for the DAP using the environmental variable MANGA_SPECTRO_ANALYSIS.
- Parameters:
drpver (
str
, optional) – DRP version. Default is to usedrp_version()
.dapver (
str
, optional) – DAP version. Default is to usedap_version()
.
- Returns:
Path to analysis directory
- Return type:
str
- mangadap.config.manga.dap_config(plate, ifudesign, drpver=None, dapver=None, analysis_path=None, directory_path=None)[source]
Return the full path to the DAP configuration file.
The configuration file provides the input data necessary to instantiate a
mangadap.datacube.manga.MaNGADataCube
.- Parameters:
plate (
int
) – Plate numberifudesign (
int
) – IFU design numberdrpver (
str
, optional) – DRP version. Default is to usedrp_version()
.dapver (
str
, optional) – DAP version. Default is to usedap_version()
.analysis_path (
str
, optional) – Path to the root analysis directory. Default is to usedap_analysis_path()
.directory_path (
str
, optional) – Path to the directory with the DAP output files. Default is to usedap_common_path()
- Returns:
Full path to the DAP par file
- Return type:
str
- mangadap.config.manga.dap_version()[source]
Return the DAP version defined by the environmental variable MANGADAP_VER. If that environmental variable does not exist, mangadap.__version__ is returned.
- mangadap.config.manga.dapall_file(drpver=None, dapver=None, analysis_path=None)[source]
Return the path to the DAPall file.
- Parameters:
drpver (
str
, optional) – DRP version. Default is to usedrp_version()
.dapver (
str
, optional) – DAP version. Default is to usedap_version()
.analysis_path (
str
, optional) – Path to the root analysis directory. Default is to usedap_analysis_path()
- Returns:
Full path to the DAPall fits file.
- Return type:
str
- mangadap.config.manga.drp_directory_path(plate, drpver=None, redux_path=None)[source]
Return the exact directory path with the DRP file.
- Parameters:
plate (
int
) – Plate numberdrpver (
str
, optional) – DRP version. Default is to usedrp_version()
.redux_path (
str
, optional) – Path to the root reduction directory. Default is to usedrp_redux_path()
.
- Returns:
Path to the directory with the 3D products of the DRP
- Return type:
str
- mangadap.config.manga.drp_finding_chart_path(plate, drpver=None, redux_path=None)[source]
Return the exact directory path with the finding charts for a given plate.
- Parameters:
plate (
int
) – Plate numberdrpver (
str
, optional) – DRP version. Default is to usedrp_version()
.redux_path (
str
, optional) – Path to the root reduction directory. Default is to usedrp_redux_path()
.
- Returns:
Path to the directory with the finding charts.
- Return type:
str
- mangadap.config.manga.drp_redux_path(drpver=None)[source]
Return the main output path for the DRP products using the environmental variable MANGA_SPECTRO_REDUX.
- Parameters:
drpver (
str
, optional) – DRP version. Default is to usedrp_version()
.- Returns:
Path to reduction directory
- Return type:
str
- mangadap.config.manga.drp_version()[source]
Return the DRP version defined by the environmental variable MANGADRP_VER.
- mangadap.config.manga.drpall_file(drpver=None, redux_path=None)[source]
Return the path to the DRPall file.
- Parameters:
drpver (
str
, optional) – DRP version. Default is to usedrp_version()
.redux_path (
str
, optional) – Path to the root reduction directory. Default is to usedrp_redux_path()
.
- Returns:
Full path to the DRPall fits file.
- Return type:
str
- mangadap.config.manga.manga_fits_root(plate, ifudesign, mode=None)[source]
Generate the main root name for the output MaNGA fits files for a given plate/ifudesign/mode.
- Parameters:
plate (
int
) – Plate numberifudesign (
int
) – IFU design numbermode (
str
, optional) – Mode of the output fits file. Options are:'LINCUBE'
,'LINRSS'
,'LOGCUBE'
,'LOGRSS'
, or'MAPS'
. Default is that no mode is included in the name.
- Returns:
Root name for a MaNGA fits file:
manga-[PLATE]-[IFUDESIGN]-[MODE]
- Return type:
str
- Raises:
ValueError – Raised if mode is not a valid option.
- mangadap.config.manga.parse_plate_ifu_from_file(name)[source]
Parse the plate and ifu numbers from the file name of a MaNGA DRP file.
- mangadap.config.manga.photometry_fix_file()[source]
Return the path to the default photometry fix file.
- Returns:
Expected path to the photometry-fix parameter file.
- Return type:
str
- mangadap.config.manga.plate_target_files()[source]
Return the default plateTarget files in mangacore and their associated catalog indices. The catalog indices are determined assuming the file names are of the form:
'plateTargets-{0}.par'.format(catalog_id)
- Returns:
Two arrays: the first contains the identified plateTargets files found using the default search string, the second provides the integer catalog index determined for each file.
- Return type: