mangadap.proc.stellarcontinuummodel module¶
A class hierarchy that performs the stellar-continuum fitting.
Copyright © 2019, SDSS-IV/MaNGA Pipeline Group
- class mangadap.proc.stellarcontinuummodel.StellarContinuumModel(method_key, binned_spectra, guess_vel, guess_sig=None, method_list=None, dapver=None, analysis_path=None, directory_path=None, output_file=None, hardcopy=True, symlink_dir=None, tpl_symlink_dir=None, clobber=False, checksum=False, loggers=None, quiet=False)[source]¶
Bases:
object
Class that holds the stellar-continuum model results.
Todo
Update attributes
- Parameters
method_key (
str
) – The keyword that designates which method, provided inmethod_list
, to use for the continuum-fitting procedure.binned_spectra (
mangadap.proc.spatiallybinnedspectra.SpatiallyBinnedSpectra
) – The binned spectra to fit. Must be able to access parentmangadap.datacube.datacube.DataCube
attribute (cube
).guess_vel (
float
, numpy.ndarray) – A single or spectrum-dependent initial estimate of the redshift in km/s (\(cz\)).guess_sig (
float
, numpy.ndarray, optional) – A single or spectrum-dependent initial estimate of the velocity dispersion in km/s. If None, default set to 100 km/s.method_list (
list
, optional) – List ofStellarContinuumModelDef
objects that define one or more methods to use for the stellar continuum fitting. The default list is provided by the config files in the DAP source directory and compiled into this list usingavailable_stellar_continuum_modeling_methods()
.dapver (
str
, optional) – The DAP version to use for the analysis. Only used to construct paths, and overrides the default defined bymangadap.config.defaults.dap_version()
.analysis_path (
str
, optional) – The top-level path for the DAP output files, used to override the default defined bymangadap.config.defaults.dap_analysis_path()
.directory_path (
str
, optional) – The exact path to the directory with DAP output that is common to number DAP “methods”. Seedirectory_path
.output_file (
str
, optional) – Exact name for the output file. The default is to usemangadap.config.defaults.dap_file_name()
.hardcopy (
bool
, optional) – Flag to write the HDUList attribute to disk. If False, the core astropy.io.fits.HDUList attribute (hdu
) is only kept in memory and would have to be reconstructed.symlink_dir (
str
, optional) – Create a symbolic link to the created file in the supplied directory. If None, no symbolic link is created.tpl_symlink_dir (
str
, optional) – Create a symbolic link to the created template library file in the supplied directory. If None, no symbolic link is created.clobber (
bool
, optional) – Overwrite any existing files. Default is to use any existing file instead of redoing the analysis and overwriting the existing output.checksum (
bool
, optional) – Use the checksum in the fits header to confirm that the data has not been corrupted. The checksum is always written to the fits header when the file is created.loggers (
list
, optional) – List of logging.Logger objects to log progress; ignored if quiet=True. Logging is done usingmangadap.util.log.log_output()
. Default is no logging.quiet (
bool
, optional) – Suppress all terminal and logging output.
- loggers¶
List of logging.Logger objects to log progress.
- Type
list
- quiet¶
Suppress all terminal and logging output.
- Type
bool
- _add_method_header(hdr)[source]¶
Add method-specific metadata to the header.
Note that the header object is both edited in-place and returned.
- Parameters
hdr (astropy.io.fits.Header) – Input base header for added keywords. Expected to have been initialized using
_initialize_primary_header()
.- Returns
Edited header object.
- Return type
- _assign_image_arrays()[source]¶
Set
image_arrays
, which contains the list of extensions inhdu
that are on-sky image data.
- _assign_spectral_arrays()[source]¶
Set
spectral_arrays
, which contains the list of extensions inhdu
that contain spectral data.
- _construct_2d_hdu(good_snr, model_flux, model_mask, model_par)[source]¶
Construct
hdu
that is held in memory for manipulation of the object. Seeconstruct_3d_hdu()
to convert the object into a datacube.- Parameters
good_snr (numpy.ndarray) – Boolean array selecting the bins with good S/N.
model_flux (numpy.ndarray) – Best-fitting model spectra for each bin.
model_mask (numpy.ndarray) – Bitmask flags for each model pixel.
( (model_par) – class`~mangadap.proc.spectralfitting.StellarKinematicsFitDataTable`): Data table with the best-fitting model parameters.
- _fill_method_par(dapver=None, analysis_path=None, tpl_symlink_dir=None)[source]¶
Fill in any remaining modeling parameters.
This method:
creates/reads the template library,
populates the full arrays for the guess redshifts and velocity dispersions.
- Parameters
dapver (
str
, optional) – The DAP version to use for the analysis. Only used to construct paths, and overrides the default defined bymangadap.config.defaults.dap_version()
.analysis_path (
str
, optional) – The top-level path for the DAP output files, used to override the default defined bymangadap.config.defaults.dap_analysis_path()
.tpl_symlink_dir (
str
, optional) – Create a symbolic link to the created template library file in the supplied directory. If None, no symbolic link is created.
- _finalize_cube_mask(mask)[source]¶
Finalize the mask after the 2D mask has been reconstructed into a 3D cube.
This mostly handles the masks for regions outside the datacube field of view.
Note that the input mask is both edited in-place and returned.
Todo
This needs to be abstracted for non-DRP datacubes.
Describe MAPMASK usage
- Parameters
mask (numpy.ndarray) – 3D array with the current bitmask data.
- Returns
Edited bitmask data.
- Return type
- _get_missing_models(debug=False)[source]¶
Find the spectra with missing models, either because there is no model or the bin is also missing.
- Parameters
debug (
bool
, optional) – When checking the S/N limits, runmangadap.proc.spatiallybinnedspectra.SpatiallyBinnedSpectra.above_snr_limit()
in debug mode.- Returns
Sorted list of missing models.
- Return type
- _initialize_primary_header(hdr=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 datacube header from
binned_spectra
(if there is one) and then cleans the header usingmangadap.util.fitsutil.DAPFitsUtil.clean_dap_primary_header()
.- Returns
Initialized header object.
- Return type
- _set_paths(directory_path, dapver, analysis_path, output_file)[source]¶
Set the
directory_path
andoutput_file
. If not provided, the defaults are set using, respectively,mangadap.config.defaults.dap_common_path()
andmangadap.config.defaults.dap_file_name()
.- Parameters
directory_path (
str
, optional) – The exact path to the directory with DAP output that is common to number DAP “methods”. Seedirectory_path
.dapver (
str
, optional) – The DAP version to use for the analysis. Only used to construct paths, and overrides the default defined bymangadap.config.defaults.dap_version()
.analysis_path (
str
, optional) – The top-level path for the DAP output files, used to override the default defined bymangadap.config.defaults.dap_analysis_path()
.output_file (
str
, optional) – Exact name for the output file. The default is to usemangadap.config.defaults.dap_file_name()
.
- construct_3d_hdu()[source]¶
Reformat the model spectra into a cube matching the shape of the DRP fits file.
- construct_models(replacement_templates=None, redshift_only=False, deredshift=False, corrected_dispersion=False)[source]¶
Reconstruct the best fitting models.
This is largely a wrapper for a
construct_models()
method provided by themethod
fitting class. As such, this method will raise an exception if the fitting class has no such method.- Parameters
replacement_templates (
mangadap.proc.templatelibary.TemplateLibrary
, optional) – Instead of using the template library used to fit the data, use this library instead. The number of spectra in the replacement library must match the original number of templates. This is only really useful when replacing the original set of templates with ones at a different spectral resolution.redshift_only (
bool
, optional) – When constructing the models, only redshift the spectra, effectively providing the best-fitting model with a velocity dispersion of 0 km/s.deredshift (
bool
, optional) – Return the best-fitting models in the rest frame.corrected_dispersion (
bool
, optional) – Return the best-fitting models with a LOSVD that has been corrected for any resolution difference between the fitted templates and the binned spectra.
- Returns
The best-fitting models.
- Return type
- Raises
ValueError – Raised if there is no defined fitting class.
AttributeError – Raised if the fitting class has no method called
construct_models()
.TypeError – Raised if the provided
replacement_templates
are not an instance ofmangadap.proc.templatelibary.TemplateLibrary
.
- copy_to_array(ext='FLUX', waverange=None, include_missing=False)[source]¶
Wrapper for
mangadap.util.fitsutil.DAPFitsUtil.copy_to_array()
specific forStellarContinuumModel
.Return a copy of the selected data array. The array size is always \(N_{\rm models} \times N_{\rm wavelength}\); i.e., the data is always flattened to two dimensions and the unique spectra are selected.
- Parameters
ext (
str
, optional) – Name of the extension from which to draw the data. Must be allowed for the currentmode
; seedata_arrays
.waverange (array-like, optional) – Two-element array with the first and last wavelength to include in the computation. If None, use the full wavelength range.
include_missing (
bool
, optional) – Create an array with a size that accommodates the missing models.
- Returns
A 2D array with a copy of the data from the selected extension.
- Return type
- copy_to_masked_array(ext='FLUX', flag=None, waverange=None, include_missing=False)[source]¶
Wrapper for
mangadap.util.fitsutil.DAPFitsUtil.copy_to_masked_array()
specific forStellarContinuumModel
.Return a copy of the selected data array as a masked array. This is functionally identical to
copy_to_array()
, except the output format is a numpy.ma.MaskedArray. The pixels that are considered to be masked can be specified using flag.- Parameters
ext (
str
, optional) – Name of the extension from which to draw the data. Must be allowed for the currentmode
; seedata_arrays
.flag (
str
,list
, optional) – (List of) Flag names that are considered when deciding if a pixel should be masked. The names must be a valid bit name as defined bybitmask
. If not provided, ANY non-zero mask bit is omitted.waverange (array-like, optional) – Two-element array with the first and last wavelength to include in the computation. If None, use the full wavelength range.
include_missing (
bool
, optional) – Create an array with a size that accommodates the missing models.
- Returns
A 2D array with a copy of the data from the selected extension.
- Return type
- static default_paths(plate, ifudesign, rdxqa_method, binning_method, method_key, directory_path=None, drpver=None, dapver=None, analysis_path=None, output_file=None)[source]¶
Set the default directory and file name for the output file.
- Parameters
plate (
int
) – Plate numberifudesign (
int
) – IFU design numberrdxqa_method (
str
) – Keyword designating the method used to construct the reductions assessments.bin_method (
str
) – Keyword designating the method use for the spatial binning.method_key (
str
) – Keyword designating the method used for the stellar-continuum fitting.directory_path (
str
, optional) – The exact path to the directory with DAP output that is common to number DAP “methods”. Seedirectory_path
.drpver (
str
, optional) – The DRP version. Only used to construct paths, and overrides the default defined bymangadap.config.defaults.drp_version()
.dapver (
str
, optional) – The DAP version to use for the analysis. Only used to construct paths, and overrides the default defined bymangadap.config.defaults.dap_version()
.analysis_path (
str
, optional) – The top-level path for the DAP output files, used to override the default defined bymangadap.config.defaults.dap_analysis_path()
.output_file (
str
, optional) – Exact name for the output file. The default is to usemangadap.config.defaults.dap_file_name()
.
- Returns
Two strings with the path for the output file and the name of the output file.
- Return type
tuple
- static define_method(method_key, method_list=None)[source]¶
Select the continuum-fitting method.
- Parameters
method_key (
str
) – Method keyword.method_list (
list
, optional) – List of methods to choose from. If None, list is provided byavailable_stellar_continuum_modeling_methods()
.
- Returns
Object with the fitting method parameters.
- Return type
- fill_to_match(binid, replacement_templates=None, redshift_only=False, deredshift=False, corrected_dispersion=False, missing=None)[source]¶
Get the stellar-continuum model from this objects that matches the input bin ID matrix.
The output is a 2D matrix ordered by the bin ID; any skipped index numbers in the maximum of the union of the unique numbers in the
binid
andmissing
input are masked.All this does is find the stellar continuum from spaxels in this model and match them to the input spaxels. Depending on how differently the data sets have been binned, this says nothing about whether or not the returned models are a good fit to the data!
- Parameters
binid (numpy.ndarray) – A map of the bin IDs with shape that matches the spatial shape of the parent datacube; see
spatial_shape
. This provides the mapping between the current stellar continuum models and the output data array.replacement_templates (
mangadap.proc.templatelibary.TemplateLibrary
, optional) – Instead of using the template library used to fit the data, use this library instead. The number of spectra in the replacement library must match the original number of templates. This is only really useful when replacing the original set of templates with ones at a different spectral resolution.redshift_only (
bool
, optional) – When constructing the models, only redshift the spectra, effectively providing the best-fitting model with a velocity dispersion of 0 km/s.deredshift (
bool
, optional) – Return the best-fitting models in the rest frame.corrected_dispersion (
bool
, optional) – Return the best-fitting models with a LOSVD that has been corrected for any resolution difference between the fitted templates and the binned spectra.missing (array-like, optional) – Include empty spectra for binids with these numbers. Ignored if None or an empty array.
- Returns
The best-fitting models matched to the input bin ID array.
- Return type
- Raises
ValueError – Raised if the shape of
binid
does not matchspatial_shape
.
- fit(binned_spectra, guess_vel, guess_sig=None, dapver=None, analysis_path=None, directory_path=None, output_file=None, hardcopy=True, symlink_dir=None, tpl_symlink_dir=None, clobber=False, loggers=None, quiet=False)[source]¶
Fit the binned spectra using the specified method.
- Parameters
binned_spectra (
mangadap.proc.spatiallybinnedspectra.SpatiallyBinnedSpectra
) – The binned spectra to fit. Must be able to access parentmangadap.datacube.datacube.DataCube
attribute (cube
).guess_vel (
float
, numpy.ndarray) – A single or spectrum-dependent initial estimate of the redshift in km/s (\(cz\)).guess_sig (
float
, numpy.ndarray, optional) – A single or spectrum-dependent initial estimate of the velocity dispersion in km/s.dapver (
str
, optional) – The DAP version to use for the analysis paths, used to override the default defined bymangadap.config.defaults.dap_version()
. This only sets the path names and does not change the version of the code being used.analysis_path (
str
, optional) – The top-level path for the DAP output files, used to override the default defined bymangadap.config.defaults.dap_analysis_path()
.directory_path (
str
, optional) – The exact path to the directory with DAP output that is common to number DAP “methods”. Seedirectory_path
.output_file (
str
, optional) – Exact name for the output file. The default is to usemangadap.config.defaults.dap_file_name()
.hardcopy (
bool
, optional) – Flag to write the HDUList attribute to disk. Default is True; if False, the HDUList is only kept in memory and would have to be reconstructed.symlink_dir (
str
, optional) – Create a symbolic link to the created file in the supplied directory. Default is to produce no symbolic link.tpl_symlink_dir (
str
, optional) – Create a symbolic link to the created template library file in the supplied directory. Default is to produce no symbolic link.clobber (
bool
, optional) – Overwrite any existing files. Default is to use any existing file instead of redoing the analysis and overwriting the existing output.loggers (
list
, optional) – List of logging.Logger objects to log progress; ignored if quiet=True. Logging is done usingmangadap.util.log.log_output()
. Default is no logging.quiet (
bool
, optional) – Suppress all terminal and logging output.
- get_template_library(dapver=None, analysis_path=None, tpl_symlink_dir=None, velocity_offset=None, match_resolution=False, resolution_fwhm=None, hardcopy=False)[source]¶
Construct the template library for the continuum fitting.
If the FWHM (in angstroms; see
resolution_fwhm
) is not provided, this method is a simple wrapper that returns amangadap.proc.templatelibrary.TemplateLibrary
. Otherwise, the provided FWHM is used to construct the spectral resolution for the template library.In either case, the sampling is set to match the spectra in
binned_spectra
(up to the velocity-scale ratio set bymethod
).- Parameters
dapver (
str
, optional) – The DAP version to use for the analysis. Only used to construct paths, and overrides the default defined bymangadap.config.defaults.dap_version()
.analysis_path (
str
, optional) – The top-level path for the DAP output files, used to override the default defined bymangadap.config.defaults.dap_analysis_path()
.tpl_symlink_dir (
str
, optional) – Create a symbolic link to the created template library file in the supplied directory. If None, no symbolic link is created.velocity_offset (
float
, optional) – Velocity offset to use when matching the spectral resolution between the template library and the galaxy spectra.match_resolution (
bool
, optional) – Match the spectral resolution of the template library to the resolution provided by thecube
; the latter must be provided for this argument to have any use.resolution_fwhm (
float
, optional) – The target resolution for the template library set by a constant FWHM of the resolution element in angstroms over all wavelengths. If None, the resolution is either matched to the binned spectra (seematch_resolution
) or kept at the native resolution of the library.hardcopy (
bool
, optional) – Flag to keep a hardcopy of the processed template library.
- Returns
The template library prepared for fitting the binned spectra.
- Return type
- matched_kinematics(binid, redshift=None, dispersion=100.0, constant=False, cz=False, corrected=False, min_dispersion=None, nearest=False, missing=None)[source]¶
Get the stellar kinematics from this objects that matches the input bin ID matrix.
This method has a similar intent to
fill_to_match()
, but instead of matching the model spectra, its intent is to match the stellar kinematics.For spectra the were not fit but have a bin ID (see
binid
), the method uses the median (unmasked) kinematic measurement if no default values are provided (seeredshift
anddispersion
).- Parameters
binid (numpy.ndarray) – 2D array with the bin ID associate with each spaxel in the datacube. Shape must be the same as
spatial_shape
.redshift (
float
, optional) – The default redshift to use for spectra without a stellar-continuum fit. Default is to use the median of the unmasked measurementsdispersion (
float
, optional) – The default velocity dispersion to use for spectra without a stellar-continuum fit. Default is 100 km/s.constant (
bool
, optional) – Force the function to return a constant redshift and dispersion for each spectrum, regardless of any fitted kinematics.cz (
bool
, optional) – Return the redshift as cz in km/s, as opposed to unitless z.corrected (
bool
, optional) – Return the velocity dispersions corrected for any resolution difference between the templates and the galaxy data. If False, return the uncorrected data.min_dispersion (
float
, optional) – Impose a minimum dispersion.nearest (
bool
, optional) – Instead of the median of the results for the spectra that were not fit, use the value from the nearest bin.missing (array-like, optional) – Any bin ID numbers missing from the input
binid
image needed for constructing the output matched data.
- Returns
Returns numpy.ndarray objects with a redshift (or cz) and dispersion for each binned spectrum. Shape is \((N_{\rm bin},)\).
- Return type
tuple
- Raises
TypeError – Raised if the input redshift or dispersion values are not single numbers.
ValueError – Raised if the shape of
binid
does not matchspatial_shape
.
- read(ifile=None, strict=True, checksum=False, debug=False)[source]¶
Read an existing file with a previously fit set of continuum models.
- Parameters
ifile (
str
, optional) – Name of the file with the data. Default is to use the name provided byfile_path()
.strict (
bool
, optional) – Force a strict reading of the file to make sure that it adheres to the expected format. At the moment, this only checks to make sure the method keyword printed in the header matches the expected value inmethod
.checksum (
bool
, optional) – Use the checksum in the header to check for corruption of the data.debug (
bool
, optional) – Run check for missing models in debugging mode.
- Raises
FileNotFoundError – Raised if the file does not exist.
ValueError – Raised if
strict
is true and the header keywordSCKEY
does not match the method keyword.
- static reset_continuum_mask_window(continuum, dispaxis=1, quiet=False)[source]¶
Reset the mask of the stellar continuum to a continuous window from the minimum to maximum valid wavelength.
Todo
Allow continuum to be n-dimensional and use numpy.apply_along_axis.
- Parameters
continuum (numpy.ma.MaskedArray) – Stellar continuum models.
dispaxis (
int
, optional) – Wavelength axis in providedcontinuum
object.quiet (
bool
, optional) – Suppress terminal output.
- Returns
Continuum object but unmasked over the full continuous window between the minimum and maximum valid wavelength.
- Return type
- unmasked_continuum_model(replacement_templates=None, redshift_only=False, deredshift=False, corrected_dispersion=False)[source]¶
Return the stellar continuum unmasked over the full continuous fitting region.
Models are reconstructed based on the model parameters if new template fluxes are provided or if the returned models should not include the LOSVD convolution (redshift_only=True). As such, this is largely a wrapper for
construct_models()
andreset_continuum_mask_window()
.- Parameters
replacement_templates (
mangadap.proc.templatelibary.TemplateLibrary
, optional) – Instead of using the template library used to fit the data, use this library instead. The number of spectra in the replacement library must match the original number of templates. This is only really useful when replacing the original set of templates with ones at a different spectral resolution.redshift_only (
bool
, optional) – When constructing the models, only redshift the spectra, effectively providing the best-fitting model with a velocity dispersion of 0 km/s.deredshift (
bool
, optional) – Return the best-fitting models in the rest frame.corrected_dispersion (
bool
, optional) – Return the best-fitting models with a LOSVD that has been corrected for any resolution difference between the fitted templates and the binned spectra.
- Returns
The best-fitting models.
- Return type
- write(match_datacube=False, clobber=False)[source]¶
Write the hdu object to the file.
- Parameters
match_datacube (
bool
, optional) – Match the shape of the data arrays to the input datacube. I.e., convert them to 3D and replicate the binned spectrum to each spaxel in the bin.clobber (
bool
, optional) – Overwrite any existing file.
- class mangadap.proc.stellarcontinuummodel.StellarContinuumModelBitMask[source]¶
Bases:
mangadap.util.dapbitmask.DAPBitMask
Derived class that specifies the mask bits for the stellar-continuum modeling. The maskbits defined are:
Key
Bit
Description
DIDNOTUSE
0
Pixel was ignored because it was flagged in the binning step; see the DRPFits.do_not_stack_flags() and SpatiallyBinnedSpectra.do_not_fit_flags().
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 SCMINSN.
ARTIFACT
3
Pixel was ignored during the stellar-continuum fit because it was designated as containing an artifact.
OUTSIDE_RANGE
4
Pixel was ignored during the stellar-continuum fit because it was outside the designated spectral range of the fit; see the header keyword FITWAVE.
EML_REGION
5
Pixel was ignored during the stellar-continuum fit because it contains an emission-line.
TPL_PIXELS
6
These pixels were removed to ensure that the number of template spectral pixels was >= the number of fitted object pixels during the stellar-continuum fit.
TRUNCATED
7
This region was truncated to avoid convolution errors at the edges of the spectral range during the stellar-continuum fit.
PPXF_REJECT
8
Pixel was rejected during the pPXF fit via the clean parameter.
INVALID_ERROR
9
Pixel ignored because the flux error was invalid.
NO_FIT
10
Spectrum not fit such that not parameters are provided.
MAXITER
11
The fit optimizer reached the maximum number of iterations during the fit, which may imply failure to converge.
LARGE_CHI2
12
This pixel has a large chi^2 (definition of large TBD).
LARGE_RESID
13
This pixel has a large residual (definition of large TBD).
INSUFFICIENT_DATA
14
There were insufficient data in the fitting window to fit the line profile(s).
FIT_FAILED
15
Stellar-continuum fit failed according to status returned by scipy.optimize.least_squares.
NEAR_BOUND
16
Fit parameters are within at or near the imposed boundaries in parameter space.
NEGATIVE_WEIGHTS
17
Weights for templates were negative.
BAD_SIGMA
18
Corrected velocity dispersion is below 50 km/s or above 400 km/s
MIN_SIGMA
19
The fitted velocity dispersion is at the minimum allowed by pPXF (1/100th of a pixel)
BAD_SIGMACORR_SRES
20
The instrumental dispersion correction for the velocity dispersion, based on the quadrature difference in the spectral resolution, is invalid.
BAD_SIGMACORR_EMP
21
The instrumental dispersion correction for the velocity dispersion, based on fitting the native resolution template to the resolution matched template, is invalid.
- cfg_root = 'stellar_continuum_model_bits'¶
- class mangadap.proc.stellarcontinuummodel.StellarContinuumModelDef(key=None, minimum_snr=None, fit_type=None, fitpar=None, fitclass=None, fitfunc=None)[source]¶
Bases:
mangadap.par.parset.KeywordParSet
A class that holds the parameters necessary to perform the stellar-continuum fitting.
The provided
fitfunc
must have the form:model_wave, model_flux, model_mask, model_par = fitfunc(self, binned_spectra, par=None)
where
binned_spectra
has typemangadap.proc.spatiallybinnedspetra.SpatiallyBinnedSpectra
, and the returned objects are the wavelength vector, the fitted model flux, a bitmask for the model, and the set of model parameters. For example, seemangadap.proc.ppxffit.PPXFFit.fit_SpatiallyBinnedSpectra()
.The defined parameters are:
Key
Type
Options
Default
Description
key
str
Keyword used to distinguish between different spatial binning schemes.
minimum_snr
int, float
Minimum S/N of spectrum to fit
fit_type
str
Currently can be anything. In the DAP, this is used to identify the primary purpose of the fit as either producing stellar kinematics, composition measurements, or emission line fits; see
mangadap.proc.spectralfitting
. The purpose for this type is to isolate the expected format of the binary table data; see, e.g.,StellarKinematicsFitDataTable
.fitpar
ParSet, dict
Any additional parameters, aside from the spectra themselves, required by the fitting function.
fitclass
Undefined
Instance of class object to use for the model fitting. Needed in case fitfunc is a non-static member function of a class.
fitfunc
Undefined
The function that models the spectra
- mangadap.proc.stellarcontinuummodel.available_stellar_continuum_modeling_methods()[source]¶
Return the list of available stellar-continuum modeling methods.
pPXF methods:
Todo
Fill in these docs more
Somehow add a python call that reads the databases and constructs the table for presentation in sphinx so that the text above doesn’t have to be edited with changes in the available databases.
- Returns
A list of
mangadap.proc.stellarcontinuummodel.StellarContinuumModelDef()
objects, each defining a stellar-continuum modeling approach.- Return type
list
- Raises
IOError – Raised if no stellar-continuum fitting configuration files could be found.
ValueError – Raised if the fitting method is unrecognized.
KeyError – Raised if the continuum-fitting method keywords are not all unique.
- mangadap.proc.stellarcontinuummodel.validate_stellar_continuum_modeling_method_config(cnfg)[source]¶
Validate the
mangadap.util.parser.DefaultConfig
object with the stellar-continuum-modeling method parameters.- Parameters
cnfg (
mangadap.util.parser.DefaultConfig
) – Object with the stellar-continuum-modeling method parameters to validate.- Raises
KeyError – Raised if any required keywords do not exist.
ValueError – Raised if the fitting method is not recognized.