sccala.speclib.linefit
Classes
Base class encapsulating line fits of a spectrum |
Module Contents
- class sccala.speclib.linefit.LineFit(wav, flux, error, numcode=100)
Base class encapsulating line fits of a spectrum
- wav
- norm_factor
- flux
- error
- numcode = 100
- fits
- lines
- __get_builtin_lines__()
- __set_builtin_lines__(line, cr_low, cr_high, rest, ae_feature)
Sets a new builtin line if it does not already exist Parameters ———- line : str
Specifies the name of the line. Has to be in the list of existing lines
- cr_lowfloat
Lower boundary of the line feature.
- cr_highfloat
Upper boundary of the line feature.
- restfloat
Rest wavelength of the feature.
- ae_featurebool
Specifies if absorption to emission ratio is to be fit.
- __modify_builtin_lines__(line, **kwargs)
Modifies the builtin lines, e.g. changes the cr_ranges Parameters ———- line : str
Specifies the name of the line. Has to be in the list of existing lines
- kwargs:
- cr_lowfloat
Lower boundary of the line feature.
- cr_highfloat
Upper boundary of the line feature.
- restfloat
Rest wavelength of the feature.
- ae_featurebool
Specifies if absorption to emission ratio is to be fit.
- __reset_builtin_lines__()
Resets builtin lines in case their properties have been overwritten
- add_line(line, cr_low, cr_high, rest, ae_feature=False, overwrite=False) None
Adds a new line to the line dictionary so that it can be fitted later.
Parameters
- linestr
Specifies the name of the line. Will not overwrite existing lines.
- cr_lowfloat
Lower boundary of the line feature.
- cr_highfloat
Upper boundary of the line feature.
- restfloat
Rest wavelength of the feature.
- ae_featurebool
Specifies if absorption to emission ratio is to be fit. Default: False
- overwritebool
If set to True, existing lines will be overwritten. Default: False
Returns
None
- fit_line(line, cr_low=None, cr_high=None, rest=None, ae_feature=False, emission=False, noisefit=True, hodlrsolver=True, size=1000, diagnostic=None, num_live_points=800)
Fits a specific line to the spectrum. Lines can either be choosen from the predefined set or specified manually
Parameters
- linestr
Specifies the name of the line. Has to match the predefined line names, unless cr_low, cr_high and rest are specified.
- cr_lowfloat or None
Lower boundary of the line feature. Default: None
- cr_highfloat or None
Upper boundary of the line feature. Default: None
- restfloat or None
Rest wavelength of the feature. Default: None
- ae_featurebool
Specifies if absorption to emission ratio is to be fit. Default: False
- emissionbool
Specifies if the line is an emission line. If ae_feature is set to True, this parameter is ignored. Default: False
- noisefitbool
Determines if correlated noise is to be fit. If false, only one kernel is used, otherwise two will be used. Default: True
- hodlrsolverbool
Determines if george.HODLRSolver is to be used. Default: True
- sizeint
Number of flux predictions to be drawn. Total number of samples drawn is <size>^2. Default: 100
- diagnosticstr
Determines if diagnostic plots are to be saved in specified directory. Default: False
- num_live_pointsfloat
Number of live points used in sampling routine. Default: 800
Returns
- resultsdict
Dictonary containing all the different fit quantities
- diagnostic_plot(line, save)
Creates a diagnostic plot of a line fit.
Parameters
- linestr
Specifies the name of the line. Has to match the predefined line names, unless cr_low, cr_high and rest are specified.
- savestr or None
Directory in which the figure is saved. If figure should not be saved, None or False can be passed.
Returns
- figmatplotlib figure object
Diagnostic figure
- get_results(line)
Function that returns either the velocities or a/e values for a specific lines
Parameters
- linestr
Specifies the name of the line. Has to match the predefined line names, unless cr_low, cr_high and rest are specified.
Returns
velocity : float vel_err_lower : float vel_err_upper : float
or
ae : float ae_err_lower : float ae_err_upper : float