sccala.speclib.linefit ====================== .. py:module:: sccala.speclib.linefit Classes ------- .. autoapisummary:: sccala.speclib.linefit.LineFit Module Contents --------------- .. py:class:: LineFit(wav, flux, error, numcode=100) Base class encapsulating line fits of a spectrum .. py:attribute:: wav .. py:attribute:: norm_factor .. py:attribute:: flux .. py:attribute:: error .. py:attribute:: numcode :value: 100 .. py:attribute:: fits .. py:attribute:: lines .. py:method:: __get_builtin_lines__() .. py:method:: __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_low : float Lower boundary of the line feature. cr_high : float Upper boundary of the line feature. rest : float Rest wavelength of the feature. ae_feature : bool Specifies if absorption to emission ratio is to be fit. .. py:method:: __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_low : float Lower boundary of the line feature. cr_high : float Upper boundary of the line feature. rest : float Rest wavelength of the feature. ae_feature : bool Specifies if absorption to emission ratio is to be fit. .. py:method:: __reset_builtin_lines__() Resets builtin lines in case their properties have been overwritten .. py:method:: 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 ---------- line : str Specifies the name of the line. Will not overwrite existing lines. cr_low : float Lower boundary of the line feature. cr_high : float Upper boundary of the line feature. rest : float Rest wavelength of the feature. ae_feature : bool Specifies if absorption to emission ratio is to be fit. Default: False overwrite : bool If set to True, existing lines will be overwritten. Default: False Returns ------- None .. py:method:: 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 ---------- line : str Specifies the name of the line. Has to match the predefined line names, unless cr_low, cr_high and rest are specified. cr_low : float or None Lower boundary of the line feature. Default: None cr_high : float or None Upper boundary of the line feature. Default: None rest : float or None Rest wavelength of the feature. Default: None ae_feature : bool Specifies if absorption to emission ratio is to be fit. Default: False emission : bool Specifies if the line is an emission line. If ae_feature is set to True, this parameter is ignored. Default: False noisefit : bool Determines if correlated noise is to be fit. If false, only one kernel is used, otherwise two will be used. Default: True hodlrsolver : bool Determines if george.HODLRSolver is to be used. Default: True size : int Number of flux predictions to be drawn. Total number of samples drawn is ^2. Default: 100 diagnostic : str Determines if diagnostic plots are to be saved in specified directory. Default: False num_live_points : float Number of live points used in sampling routine. Default: 800 Returns ------- results : dict Dictonary containing all the different fit quantities .. py:method:: diagnostic_plot(line, save) Creates a diagnostic plot of a line fit. Parameters ---------- line : str Specifies the name of the line. Has to match the predefined line names, unless cr_low, cr_high and rest are specified. save : str or None Directory in which the figure is saved. If figure should not be saved, None or False can be passed. Returns ------- fig : matplotlib figure object Diagnostic figure .. py:method:: get_results(line) Function that returns either the velocities or a/e values for a specific lines Parameters ---------- line : str 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