### Example DAP configuration file Source: https://github.com/sdss/mangadap/blob/main/docs/execution.md An example of an auto-generated DAP configuration file, showing default parameters and metadata for a datacube. ```ini # Auto-generated configuration file # Fri 28 Feb 2020 16:57:19 [default] drpver redux_path directory_path plate = 7815 ifu = 3702 log = True sres_ext sres_fill covar_ext z = 2.9382300e-02 vdisp ell = 1.1084400e-01 pa = 1.6324500e+02 reff = 3.7749500e+00 ``` -------------------------------- ### Build Documentation Locally Source: https://github.com/sdss/mangadap/blob/main/docs/README.md Install Sphinx, clean previous builds, generate HTML documentation, and open the main page. Ensure Sphinx is installed before running. ```bash pip install sphinx make clean ; make html open _build/html/index.html ``` -------------------------------- ### Run DAP Installation Tests Source: https://github.com/sdss/mangadap/blob/main/docs/installation.md Navigate to the tests directory and run pytest to verify the installation. Ignore warnings during the test execution. ```bash cd mangadap/tests pytest . -W ignore ``` -------------------------------- ### Bandhead Index Parameter File Example Source: https://github.com/sdss/mangadap/blob/main/docs/spectralindices.md This C struct and example data define the parameters for bandhead index calculations, including wavelength ranges, reference frame, integrand, and order. ```c typedef struct { int index; char name[9]; double blueside[2]; double redside[2]; char waveref[3]; char integrand[7]; char order[3]; } DAPBHI; DAPBHI 1 D4000 { 3750.000 3950.000 } { 4050.000 4250.000 } air fnu r_b DAPBHI 2 Dn4000 { 3850.000 3950.000 } { 4000.000 4100.000 } air fnu r_b DAPBHI 3 TiOCvD { 8835.000 8855.000 } { 8870.000 8890.000 } vac flambda b_r ``` -------------------------------- ### ParSet from_config Example Source: https://github.com/sdss/mangadap/blob/main/docs/parameters.md Demonstrates creating a ParSet instance from a configuration. This method preserves parameter details like value, default, type, and callable status. ```python # this is a rather long description of the junk parameter. You can # include rst-style references like pointing back to the # :class:`~mangadap.par.parset.ParSet` class, for when this # description is written to an rst table using # :func:`~mangadap.par.parset.ParSet.to_rst_table` and included in an # rst doc synthesized into html using sphinx. junk = None ParSet.from_config(p.to_config()) ``` -------------------------------- ### Install Development Dependencies Source: https://github.com/sdss/mangadap/blob/main/docs/installation.md If you plan to develop the code, install the development dependencies using pip in editable mode. ```bash pip install -e ".[dev]" ``` -------------------------------- ### ParSet from_config Example Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.par.parset.md Demonstrates instantiating a ParSet from a configuration object. This method preserves parameter details like name, value, default, type, and callable status. ```python # this is a rather long description of the junk parameter. You can # include rst-style references like pointing back to the # :class:`~mangadap.par.parset.ParSet` class, for when this # description is written to an rst table using # :func:`~mangadap.par.parset.ParSet.to_rst_table` and included in an # rst doc synthesized into html using sphinx. junk = None >>> ParSet.from_config(p.to_config()) Parameter Value Default Type Callable ---------------------------------------------- test that None Undefined False par 3 None Undefined False lst 0.0 None Undefined False junk None None Undefined False ``` ``` -------------------------------- ### MaNGA Data Cube Initialization and Analysis Setup Source: https://github.com/sdss/mangadap/blob/main/docs/development.md Demonstrates initializing a MaNGA data cube and setting up analysis objects like ReductionAssessment and SpatiallyBinnedSpectra. Used for preparing data for kinematic fitting. ```python # Set the plate, ifu, and initial velocity/redshift plate = 7495 ifu = 12704 vel = 8675.5 nsa_redshift = vel/astropy.constants.c.to('km/s').value # Read the DRP LOGCUBE file cube = MaNGADataCube.from_plateifu(plate, ifu) # Calculate the S/N and coordinates rdxqa = ReductionAssessment('SNRG', cube) # Peform the Voronoi binning to S/N>~10 binned_spectra = SpatiallyBinnedSpectra('VOR10', cube, rdxqa) ``` -------------------------------- ### Implement Aperture Binning Class Source: https://github.com/sdss/mangadap/blob/main/docs/development.md Example of a custom binning class for spatially binned spectra, demonstrating spaxel assignment to apertures. ```python #!/usr/bin/env python3 import time import warnings import numpy import astropy.constants from mangadap.datacube import MaNGADataCube from mangadap.proc.reductionassessments import ReductionAssessment from mangadap.proc.spectralstack import SpectralStackPar, SpectralStack from mangadap.proc.spatiallybinnedspectra import SpatiallyBinnedSpectra, SpatiallyBinnedSpectraDef from mangadap.proc.stellarcontinuummodel import StellarContinuumModel from mangadap.proc.emissionlinemoments import EmissionLineMoments from mangadap.proc.emissionlinemodel import EmissionLineModel from mangadap.proc.spectralindices import SpectralIndices from mangadap.dapfits import construct_maps_file, construct_cube_file #----------------------------------------------------------------------------- class ApertureBinning(): """ Perform aperture binning Args: x (array-like): List of on-sky x coordinates for apertures y (array-like): List of on-sky y coordinates for apertures r (array-like): Single or list of radii of the apertures Attributes: n (:obj:`int`): Number of apertures x (`numpy.ndarray`_): On-sky x coordinates for apertures y (`numpy.ndarray`_): On-sky y coordinates for apertures r (`numpy.ndarray`_): Aperture radii """ def __init__(self, x, y, r): self.x = numpy.asarray(x) if len(self.x.shape) != 1: raise ValueError('On-sky coordinates must be one-dimensional.') self.n = x.size if len(y) != self.n: raise ValueError('Input coordinates are of different lengths.') self.y = numpy.asarray(y) if len(r) != 1 and len(r) != self.n: raise ValueError('Radii must be common to all apertures or unique to each aperture.') self.r = numpy.full(self.n, r, dtype=float) if len(r) == 1 else numpy.asarray(r) def bin_spaxels(self, x, y, par=None): _x = numpy.asarray(x) if len(_x.shape) != 1: raise ValueError('On-sky coordinates must be one-dimensional.') nspaxels = _x.size if len(y) != nspaxels: raise ValueError('Input coordinates are of different lengths.') _y = numpy.asarray(y) # Find which spaxels land in each aperture indx = numpy.square(_x[:,None]-self.x[None,:]) + numpy.square(_y[:,None]-self.y[None,:]) \ < numpy.square(self.r[None,:]) if numpy.any(numpy.sum(indx, axis=1) > 1): warnings.warn('Spaxels found in multiple apertures!') # Return the aperture index that each spaxel is within, # isolating only one aperture per spaxel; spaxels not in any # aperture have a bin ID of -1 binid = numpy.full((nspaxels, self.n), -1, dtype=int) binid[indx] = numpy.array([numpy.arange(self.n)]*nspaxels)[indx] return numpy.amax(binid, axis=1) #----------------------------------------------------------------------------- ``` -------------------------------- ### Plotting a Spectrum Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.proc.sasuke.md This example shows how to plot the first spectrum from a data array. Ensure your flux arrays are ordered with spectra along rows. ```python from matplotlib import pyplot pyplot.plot(obj_wave, obj_flux[0,:]) pyplot.show() ``` -------------------------------- ### Example SDSS-style BitMask Definition Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.util.bitmask.md Illustrates how to define BitMask properties within an SDSS-style parameter file, specifying flag names, bit numbers, labels, and descriptions. ```text masktype IMAGEMASK 16 "Mask bits for image flagging" maskbits IMAGEMASK 0 BPM "Pixel is part of a bad-pixel mask" maskbits IMAGEMASK 1 COSMIC "Pixel is contaminated by a cosmic ray" maskbits IMAGEMASK 2 SATURATED "Pixel is saturated" ``` -------------------------------- ### Example DAP Analysis Script Structure Source: https://github.com/sdss/mangadap/blob/main/docs/execution.md This bash script outlines the typical steps executed for each plate-ifu during DAP analysis, including touching start/done files and running core analysis and plotting scripts. ```bash #!/bin/bash # Example script structure for DAP analysis # Touch start file touch *.started # Execute main DAP analysis manga_dap # Execute QA plotting scripts # (e.g., plotqa.py --cube=...) # Touch done file touch *.done ``` -------------------------------- ### Approximate Covariance Matrix for DAP Map Source: https://github.com/sdss/mangadap/blob/main/docs/aggregation.md Constructs the approximate covariance matrix for a DAP map, starting with the correlation matrix and renormalizing using variance data. This example focuses on H-alpha velocity measurements. ```python # Imports import numpy from astropy.io import fits from mangadap.datacube import MaNGADataCube from mangadap.dapfits import DAPMapsBitMask from mangadap.util.fileio import channel_dictionary # Read the datacube (assumes the default paths) cube = MaNGADataCube.from_plateifu(7815, 3702) # Construct the approximate correlation matrix C = cube.approximate_correlation_matrix(rho_tol=0.01) # Read the MAPS file hdu = fits.open('manga-7815-3702-MAPS-HYB10-MILESHC-MASTARHC2.fits.gz') # Get a dictionary with the emission-line names emlc = channel_dictionary(hdu, 'EMLINE_GFLUX') # Save the masked H-alpha velocity and velocity variance bm = DAPMapsBitMask() vel = numpy.ma.MaskedArray(hdu['EMLINE_GVEL'].data[emlc['Ha-6564'],...], mask=bm.flagged(hdu['EMLINE_GVEL_MASK'].data[emlc['Ha-6564'],...], flag='DONOTUSE')).T vel_var = numpy.ma.power(hdu['EMLINE_GVEL_IVAR'].data[emlc['Ha-6564'],...].T, -1) vel_var[vel.mask] = numpy.ma.masked # Construct the approximate covariance matrix vel_C = C.apply_new_variance(vel_var.filled(0.0).ravel()) vel_C.revert_correlation() ``` -------------------------------- ### Install sdss-mangadap from source Source: https://context7.com/sdss/mangadap/llms.txt Install the MaNGA DAP package from its GitHub repository for development purposes. This involves cloning the repository, checking out the current tag, and installing with development dependencies. ```bash git clone https://github.com/sdss/mangadap.git cd mangadap ./checkout_current_tag pip install -e ".[dev]" ``` -------------------------------- ### Convert Parameters to Configuration and Back Source: https://github.com/sdss/mangadap/blob/main/docs/include/parset_usage.rst Demonstrates converting DemoPar parameters to a configuration object and then creating a DemoPar instance from that configuration. ```python >>> DemoPar.from_config(p.to_config()) ``` -------------------------------- ### Install sdss-mangadap via pip Source: https://context7.com/sdss/mangadap/llms.txt Install the MaNGA DAP package using pip. This is the recommended method for general users. ```bash pip install sdss-mangadap ``` -------------------------------- ### EmissionLineDB Initialization Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.par.emissionlinedb.md Demonstrates how to initialize an EmissionLineDB from a keyword or a parameter file. ```APIDOC ## EmissionLineDB Initialization ### Description Initialize an emission-line database. Can be done using a predefined key or a custom parameter file. ### Method `EmissionLineDB` ### Parameters - **parfile** (str) - Required - Path to the SDSS parameter file with emission-line data. ### Class Methods #### `from_key(key)` Initialize the database using a keyword. #### `available_databases()` Returns a list of available database keywords. ### Request Example (from key) ```python from mangadap.par.emissionlinedb import EmissionLineDB print(EmissionLineDB.available_databases()) emldb = EmissionLineDB.from_key('ELPMPL9') ``` ### Request Example (from file) ```python from mangadap.par.emissionlinedb import EmissionLineDB emldb = EmissionLineDB('/path/to/emission/line/database/myeml.par') ``` ``` -------------------------------- ### Binning Function Coordinate Example Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.proc.spatiallybinnedspectra.md Example of how to extract on-sky Cartesian coordinates (x, y) from the FITS HDU for use with the binning function. ```python x = ReductionAssessment.hdu['SPECTRUM'].data['SKY_COO'][:,0] y = ReductionAssessment.hdu['SPECTRUM'].data['SKY_COO'][:,1] ``` -------------------------------- ### Instantiate BandheadIndexDB from a default database key Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.par.bandheadindexdb.md Use the `from_key` class method to instantiate the BandheadIndexDB using a predefined database keyword. This method is useful for accessing default configurations. ```python from mangadap.par.bandheadindexdb import BandheadIndexDB print(BandheadIndexDB.available_databases()) bhddb = BandheadIndexDB.from_key('BHBASIC') ``` -------------------------------- ### Calculate Bin Starting Radii (Logarithmic) Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.proc.spatialbinning.md Calculates the starting radii for bins using a logarithmic scale. This is useful for creating bins that are logarithmically spaced. ```python rs = self.par['radii'][0] re = self.par['radii'][1] nr = int(self.par['radii'][2]) starting_radii = numpy.logspace(numpy.log10(rs), numpy.log10(re), num=nr, endpoint=False) if self.par['log_step'] else numpy.linspace(rs, re, num=nr, endpoint=False) ``` -------------------------------- ### Create and Inspect Parameter Set Instance Source: https://context7.com/sdss/mangadap/llms.txt Instantiate a custom parameter set and use the `info()` method to display its current values and descriptions. This is useful for verifying configuration. ```python # --- Create and inspect --- p = FitPar(min_snr=3.0, degree=10) p.info() ``` -------------------------------- ### Example Absorption-Line Index Data (C) Source: https://github.com/sdss/mangadap/blob/main/docs/spectralindices.md An example of how absorption-line index data is formatted, including index, name, passband wavelengths, reference frame, units, and component flag. ```c DAPABI 1 CN1 { 4142.125 4177.125 } { 4080.125 4117.625 } { 4244.125 4284.125 } air mag 0 DAPABI 2 CN2 { 4142.125 4177.125 } { 4083.875 4096.375 } { 4244.125 4284.125 } air mag 0 ``` -------------------------------- ### EmissionMomentsDB Initialization Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.par.emissionmomentsdb.md Demonstrates how to initialize the EmissionMomentsDB class using either a predefined key or a custom parameter file. ```APIDOC ## Class usage examples Emission-line moment databases are defined using SDSS parameter files. To define a database, you can use one of the default set of available emission-line moment databases: ```default from mangadap.par.emissionmomentsdb import EmissionMomentsDB print(EmissionMomentsDB.available_databases()) elmom = EmissionMomentsDB.from_key('ELBMPL9') ``` The above call uses the [`from_key()`](mangadap.par.spectralfeaturedb.md#mangadap.par.spectralfeaturedb.SpectralFeatureDB.from_key) method to define the database using its keyword and the database provided with the MaNGA DAP source distribution. You can also define the database directly for an SDSS-style parameter file: ```default from mangadap.par.emissionmomentsdb import EmissionMomentsDB elmom = EmissionMomentsDB('/path/to/emission/moments/database/myelm.par') ``` The above will read the file and set the database keyword to ‘MYELM’ (i.e., the capitalized root name of the `*.par` file). See [Emission-Line Measurements](../emissionlines.md#emissionlines) for the format of the parameter file. ``` -------------------------------- ### Instantiate Template Library Source: https://github.com/sdss/mangadap/blob/main/docs/development.md Instantiate a template library with specified parameters. Available parameters include the list of template libraries, velocity scale ratio, spectral step, logarithmic sampling, and whether to save a hardcopy. ```python tpl = TemplateLibrary('MYLIB', tpllib_list=new_tpl_lst, # Available list of template libraries velscale_ratio=4, # Set the pixel size to 1/4 the MaNGA step spectral_step=1e-4, # The MaNGA step is dlogLambda = 1e-4 log=True, # Sample the templates logarithmically hardcopy=False) # Don't save a hardcopy of the library to disk ``` -------------------------------- ### Example Emission Line Data Entry Source: https://github.com/sdss/mangadap/blob/main/docs/emissionlines.md An example of a single emission line entry conforming to the DAPEML structure, showing values for index, name, restwave, waveref, action, and tie constraints. ```c DAPEML 2 OII 3727.092 vac f { None None } { 34 = } { None None } { 3706.3 3716.3 } { 3738.6 3748.6 } ``` -------------------------------- ### RowStackedSpectra.nspec Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.spectra.md Gets the number of spectra. ```APIDOC ## RowStackedSpectra.nspec ### Description Gets the number of spectra. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters (Not specified in source) ### Request Example (Not specified in source) ### Response #### Success Response (200) (Not specified in source) #### Response Example (Not specified in source) ``` -------------------------------- ### Instantiate and Fit Emission Lines with Sasuke Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.proc.sasuke.md Instantiate the Sasuke class with a BitMask and an EmissionLineDB, then use the fit method to fit emission lines in spectra. Ensure EmissionLineDB is loaded and the bitmask is properly initialized. ```python # Read the emission-line database emldb = EmissionLineDB.from_key('ELPMILES') # Instantiate the emission-line fitter el_fitter = Sasuke(EmissionLineModelBitMask()) # Fit the spectra model_wave, model_flux, model_eml_flux, model_mask, model_fit_par, \ model_eml_par = el_fitter.fit(...) ``` -------------------------------- ### TemplateLibraryBitMask.cfg_root Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.proc.md Gets the configuration root for TemplateLibraryBitMask. ```APIDOC ## cfg_root ### Description Gets the configuration root for TemplateLibraryBitMask. ### Method Not applicable (Python attribute/property) ### Endpoint Not applicable (Python attribute/property) ### Parameters None explicitly documented in this snippet. ### Request Example Not applicable (Python attribute/property) ### Response Not applicable (Python attribute/property) ``` -------------------------------- ### dap_ppxffit_qa Command-Line Help Source: https://github.com/sdss/mangadap/blob/main/docs/help/dap_ppxffit_qa.rst Displays the help message for the dap_ppxffit_qa command, outlining available options and their usage. ```console $ dap_ppxffit_qa -h usage: dap_ppxffit_qa [-h] (-c CONFIG | -f CUBEFILE) [--cube_module [CUBE_MODULE ...]] [-p PLAN] [--plan_module [PLAN_MODULE ...]] [-o OUTPUT_PATH] [-b BEAM] [--normal_backend] [--template_flux_file TEMPLATE_FLUX_FILE] Construct QA plots for pPXF fit. options: -h, --help show this help message and exit -c, --config CONFIG Configuration file used to instantiate the relevant DataCube derived class. (default: None) -f, --cubefile CUBEFILE Name of the file with the datacube data. Must be possible to instantiate the relevant DataCube derived class directly from the file only. (default: None) --cube_module [CUBE_MODULE ...] The name of the module that contains the DataCube derived class used to read the data. (default: mangadap.datacube.MaNGADataCube) -p, --plan PLAN SDSS parameter file with analysis plan. If not provided, a default plan is used. (default: None) --plan_module [PLAN_MODULE ...] The name of the module used to define the analysis plan and the output paths. (default: mangadap.config.manga.MaNGAAnalysisPlan) -o, --output_path OUTPUT_PATH Top-level directory for the DAP output files; default path is set by the provided analysis plan object (see plan_module). (default: None) -b, --beam BEAM Beam FWHM for plot. (default: None) --normal_backend --template_flux_file TEMPLATE_FLUX_FILE template renormalization flux file. Will attempt to read default if not provided. If no file is provided and the default file does not exist, no renormalization of the templates is performed. (default: None) ``` -------------------------------- ### metakeys Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.datacube.datacube.md Get a list of the keys in the datacube metadata. ```APIDOC ## metakeys() ### Description Get a `list` of the keys in the datacube metadata. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **Return type**: `list` - A list of metadata keys. #### Response Example None ``` -------------------------------- ### Instantiate BandheadIndexDB from a custom parameter file Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.par.bandheadindexdb.md Instantiate the BandheadIndexDB by providing the path to a custom SDSS-style parameter file. The database keyword will be derived from the filename. ```python from mangadap.par.bandheadindexdb import BandheadIndexDB bhddb = BandheadIndexDB('/path/to/bandhead/index/database/mybhd.par') ``` -------------------------------- ### map_extent Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.util.mapping.md Get the on-sky extent of a map using the provided WCS coordinates. ```APIDOC ## map_extent ### Description Get the on-sky extent of a map using the provided WCS coordinates. ### Parameters #### Path Parameters - **hdu** (astropy.io.fits.HDUList) - Fits HDU list. - **ext** (str) - Extension of the file with the map. - **offset** (bool) - Optional. Return the extent as the offset from the coordinates of the object in arcseconds. The WCS is assumed to provide RA and declination in units of degrees, and the header must contain the coordinates of the object with keywords OBJRA and OBJDEC. If offset is True and these keywords do not exist, the function will throw a warning and proceed *without* applying any offset. Default is just to return the extent of the WCS coordinates. ### Returns List of four floats: minimum and maximum x and minimum and maximum y. ### Return Type list ``` -------------------------------- ### EmissionLinePar Usage Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.par.emissionlinedb.md Example of how to define an individual emission line parameter using the EmissionLinePar class. ```APIDOC ## EmissionLinePar Usage ### Description Instantiate an emission line with its properties. ### Method `EmissionLinePar` ### Parameters - **index** (int) - Required - Index of the emission line. - **name** (str) - Required - Name of the emission line. - **restwave** (float) - Required - Rest wavelength of the emission line. - **action** (str) - Required - Action associated with the line. - **line** (str) - Required - Line identifier. - **flux** (float) - Required - Flux of the emission line. - **vel** (float) - Required - Velocity of the emission line. - **sig** (float) - Required - Sigma (dispersion) of the emission line. - **mode** (str) - Required - Mode of the emission line. ### Request Example ```python from mangadap.par.emissionlinedb import EmissionLinePar p = EmissionLinePar(index=44, name='Ha', restwave=6564.632, action='f', line='l', flux=1.0, vel=0.0, sig=10., mode='f') ``` ``` -------------------------------- ### AbsorptionIndexDB Class Initialization Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.par.absorptionindexdb.md Demonstrates how to instantiate the AbsorptionIndexDB class using a keyword or a direct file path. ```APIDOC ## Class mangadap.par.absorptionindexdb.AbsorptionIndexDB ### Description Basic container class for the database of absorption-line indices. ### Method __init__ ### Parameters #### Parameters - **parfile** (str) - Required - The SDSS parameter file with the database. ### Class Methods #### from_key(key, datadir=None) Instantiate using a keyword. ### Usage Examples ```python from mangadap.par.absorptionindexdb import AbsorptionIndexDB # Instantiate using a keyword absdb_keyword = AbsorptionIndexDB.from_key('LICKINDX') # Instantiate using a file path absdb_file = AbsorptionIndexDB('/path/to/absorption/index/database/myabs.par') ``` ### Attributes - **key** (str) - Database signifying keyword - **file** (str) - File with the data - **size** (int) - Number of features in the database. - **dummy** (numpy.ndarray) - Boolean array flagging bandpasses as dummy placeholders. ### Methods #### _parse_yanny() Parse the yanny file for the bandhead database. * **Returns:** The list of [`mangadap.par.parset.ParSet`](mangadap.par.parset.md#mangadap.par.parset.ParSet) instances for each line of the database. * **Return type:** list #### channel_names(offset=0) Return a dictionary with the channel names as the dictionary key and the channel number as the dictionary value. An `offset` can be added to the channel number; i.e., if the offset is 2, the channel numbers will be a running number starting with 2. ### Class Attributes #### default_data_dir *= 'absorption_indices'* ``` -------------------------------- ### Instantiate Absorption Database from Parameter File Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.par.absorptionindexdb.md Instantiate an AbsorptionIndexDB object by providing the direct path to an SDSS-style parameter file. The database keyword will be derived from the capitalized root name of the file. ```python from mangadap.par.absorptionindexdb import AbsorptionIndexDB absdb = AbsorptionIndexDB('/path/to/absorption/index/database/myabs.par') ``` -------------------------------- ### Clone mangadap GitHub Repository Source: https://github.com/sdss/mangadap/blob/main/docs/installation.md Clone the SDSS-MANADAP GitHub repository to your local machine to install from source. ```bash git clone https://github.com/sdss/mangadap.git ``` -------------------------------- ### Configure Spatial Binning Key Source: https://github.com/sdss/mangadap/blob/main/docs/plan.md Example TOML configuration to change the keyword identifier for the spatial binning parameter set. ```toml [default.binning] key = 'test' ``` -------------------------------- ### Emission Line Fitting and Analysis Source: https://github.com/sdss/mangadap/blob/main/docs/development.md This snippet demonstrates setting up an emission line fitter, defining a fitting method, and performing spectral analysis including constructing maps and cube files. It requires pre-defined variables like binned_spectra, stellar_continuum, el_init_redshift, cube, rdxqa, emission_line_moments, and nsa_redshift. ```python fitter = XJMCEmissionLineFitter() # Setup the new fitting method fit_method = EmissionLineModelDef('XJMC', # Key for the fitting method 0.0, # Minimum S/N of the binned spectra None, # Keyword for an artifact mask None, # Keyword for an emission-line database fitter.par, # Object with fit parameters fitter, # Fitting class instance fitter.fit) # Fitting function # Fit the emission lines emission_line_model = EmissionLineModel('XJMC', binned_spectra, stellar_continuum=stellar_continuum, redshift=el_init_redshift, dispersion=100.0, method_list=fit_method) # The rest of this is just a single execution of the remaining # analysis steps in # $MANGADAP_DIR/python/mangadap/survey/manga_dap.py , with some # simplifications spectral_indices = SpectralIndices('INDXEN', binned_spectra, redshift=nsa_redshift, stellar_continuum=stellar_continuum, emission_line_model=emission_line_model) construct_maps_file(cube, rdxqa=rdxqa, binned_spectra=binned_spectra, stellar_continuum=stellar_continuum, emission_line_moments=emission_line_moments, emission_line_model=emission_line_model, spectral_indices=spectral_indices, nsa_redshift=nsa_redshift) construct_cube_file(cube, binned_spectra=binned_spectra, stellar_continuum=stellar_continuum, emission_line_model=emission_line_model) print('Elapsed time: {0} seconds'.format(time.perf_counter() - t)) ``` -------------------------------- ### MaNGA DataCube Configuration Source: https://github.com/sdss/mangadap/blob/main/docs/whatsnew.md Example of subclassing MaNGAConfig to define input paths and file names for MaNGA data cubes. ```python class MaNGADataCube(DataCube, MaNGAConfig): pass ``` -------------------------------- ### write_dap_config Help Source: https://github.com/sdss/mangadap/blob/main/docs/help/write_dap_config.rst Displays the help message for the write_dap_config command, outlining its usage, arguments, and options. ```console $ write_dap_config -h usage: write_dap_config [-h] (-c DRPCOMPLETE | -a DRPALL) [--sres_ext SRES_EXT] [--sres_fill SRES_FILL] [--covar_ext COVAR_EXT] [--drpver DRPVER] [--redux_path REDUX_PATH] [--directory_path DIRECTORY_PATH] [-o] plate ifudesign ofile Generate a DAP input configuration file positional arguments: plate Plate number ifudesign IFU design number ofile Output file name options: -h, --help show this help message and exit -c, --drpcomplete DRPCOMPLETE DRP complete fits file (default: None) -a, --drpall DRPALL DRPall fits file (default: None) --sres_ext SRES_EXT Spectral resolution extension to use. Default set by MaNGADataCube class. (default: None) --sres_fill SRES_FILL If present, use interpolation to fill any masked pixels in the spectral resolution vectors. Default set by MaNGADataCube class. (default: None) --covar_ext COVAR_EXT Use this extension to define the spatial correlation matrix. Default set by MaNGADataCube class. (default: None) --drpver DRPVER DRP version. Default set by MaNGADataCube class. (default: None) --redux_path REDUX_PATH Path to the top-level DRP reduction directory. Default set by MaNGADataCube class. (default: None) --directory_path DIRECTORY_PATH Exact path to the directory with the MaNGA DRP datacube. The name of the file itself must match the nominal MaNGA DRP naming convention. Default set by MaNGADataCube class. (default: None) -o, --overwrite Overwrite any existing files. (default: False) ``` -------------------------------- ### Instantiate EmissionMomentsDB from a Parameter File Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.par.emissionmomentsdb.md Define an emission-line moment database directly from an SDSS-style parameter file. The database keyword will be derived from the capitalized root name of the file. ```python from mangadap.par.emissionmomentsdb import EmissionMomentsDB elmom = EmissionMomentsDB('/path/to/emission/moments/database/myelm.par') ``` -------------------------------- ### mangadap.contrib.xjmc._ppxf_component_setup Source: https://github.com/sdss/mangadap/blob/main/docs/api/mangadap.contrib.xjmc.md Sets up kinematic component, moment, and starting point arrays for a pPXF fitting iteration, optionally consolidating gas components. ```APIDOC ## mangadap.contrib.xjmc._ppxf_component_setup(component, moments, gas_template, start, fixed, single_gas_component=False, gas_start=None) ### Description Setup the component, moment, and starting point arrays for a ppxf-fitting iteration. This primarily just sets all the gas components to a single component if requested, restructuring the moment, starting point, and fixed parameter arrays as necessary to reflect this change. ..warning: This function requires that all stellar components have component numbers that are **less than** any gas components. However, this **is not checked** by the function. ### Parameters #### Path Parameters - **component** (numpy.ndarray) - 1D array with the full list of components for all templates. Shape is `(ntpl,)`. The maximum value is `ncomp-1`. - **moments** (numpy.ndarray) - 1D array with the number of moments for each kinematic component. Shape is `(ncomp,)`. - **gas_template** (numpy.ndarray) - A boolean array identifying the gas templates. Shape is `(ntpl,)`. - **start** (numpy.ndarray) - 2D array with the starting kinematics to use for each object spectrum. Shape is `(nobj,sum(moments))`. - **fixed** (numpy.ndarray) - Boolean array selecting kinematic component that should be fixed during the fit. Each spectrum is fit the same, meaning the shape is the same as the 2nd axis of `start`: `(sum(moments),)`. - **single_gas_component** (bool, optional) - Flag to force all gas components to have the same kinematics. - **gas_start** (numpy.ndarray, optional) - Array with the starting kinematics to use for the gas components. Shape must be `(nobj,2)`. ### Returns Three numpy arrays are returned: 1. The list of down-selected and renumbered, if necessary, kinematic components, 2. the down-selected and reordered, if necessary, number of moments to fit, 3. the down-selected and reordered starting guesses for each component, and 4. the down-selected and reordered fixed moments for each component. ### Return type tuple ### Raises **ValueError** - Raised if the provided gas starting kinematics is not correct. ```