# yt.analysis_modules.absorption_spectrum.absorption_spectrum_fit module¶

yt.analysis_modules.absorption_spectrum.absorption_spectrum_fit.generate_total_fit(x, fluxData, orderFits, speciesDicts, minError=0.0001, complexLim=0.995, fitLim=0.97, minLength=3, maxLength=1000, splitLim=0.99, output_file=None)[source]

This function is designed to fit an absorption spectrum by breaking the spectrum up into absorption complexes, and iteratively adding and optimizing voigt profiles to each complex.

Parameters: x – 1d array of wavelengths fluxData – array of flux corresponding to the wavelengths given in x. (needs to be the same size as x) orderFits (list) – list of the names of the species in the order that they should be fit. Names should correspond to the names of the species given in speciesDicts. (ex: [‘lya’,’OVI’]) speciesDicts (dictionary) – Dictionary of dictionaries (I’m addicted to dictionaries, I confess). Top level keys should be the names of all the species given in orderFits. The entries should be dictionaries containing all relevant parameters needed to create an absorption line of a given species (f,Gamma,lambda0) as well as max and min values for parameters to be fit complexLim (float, optional) – Maximum flux to start the edge of an absorption complex. Different from fitLim because it decides extent of a complex rather than whether or not a complex is accepted. fitLim (float,optional) – Maximum flux where the level of absorption will trigger identification of the region as an absorption complex. Default = .98. (ex: for a minSize=.98, a region where all the flux is between 1.0 and .99 will not be separated out to be fit as an absorbing complex, but a region that contains a point where the flux is .97 will be fit as an absorbing complex.) minLength (int, optional) – number of cells required for a complex to be included. default is 3 cells. maxLength (int, optional) – number of cells required for a complex to be split up. Default is 1000 cells. splitLim (float, optional) – if attempting to split a region for being larger than maxlength the point of the split must have a flux greater than splitLim (ie: absorption greater than splitLim). Default= .99. output_file (string, optional) – location to save the results of the fit. allSpeciesLines (dictionary) – Dictionary of dictionaries representing the fit lines. Top level keys are the species given in orderFits and the corresponding entries are dictionaries with the keys ‘N’,’b’,’z’, and ‘group#’. Each of these corresponds to a list of the parameters for every accepted fitted line. (ie: N[0],b[0],z[0] will create a line that fits some part of the absorption spectrum). ‘group#’ is a similar list but identifies which absorbing complex each line belongs to. Lines with the same group# were fit at the same time. group#’s do not correlate between species (ie: an lya line with group number 1 and an OVI line with group number 1 were not fit together and do not necessarily correspond to the same region) yFit ((N) ndarray) – array of flux corresponding to the combination of all fitted absorption profiles. Same size as x.