trident.spectrum_generator.SpectrumGenerator.apply_lsf
- SpectrumGenerator.apply_lsf(function=None, width=None, filename=None)[source]
Postprocess a spectrum to apply a line spread function. If the SpectrumGenerator already has an LSF_kernel set, it will be used when no keywords are supplied. Otherwise, the user can specify a filename of a user-defined kernel or a function+width for a kernel. Valid functions are: “boxcar” and “gaussian”.
For more information, see
LSF
andInstrument
.Parameters
- Function
string, optional
Desired functional form for the applied LSF kernel. Valid options are currently “boxcar” or “gaussian” Default: None
- Width
int, optional
Width of the desired LSF kernel in bin elements Default: None
- Filename
string, optional
The filename of the user-supplied kernel for applying the LSF Default: None
Example
Make a one zone ray and generate a COS spectrum for it. Apply the COS line spread function to it.
>>> import trident >>> ray = trident.make_onezone_ray() >>> sg = trident.SpectrumGenerator('COS') >>> sg.make_spectrum(ray) >>> sg.apply_lsf() >>> sg.plot_spectrum('spec_lsf_corrected.png')
Make a one zone ray and generate a spectrum with bin width = 1 angstrom. Apply a boxcar LSF to it with width 50 angstroms.
>>> import trident >>> ray = trident.make_onezone_ray() >>> sg = trident.SpectrumGenerator(lambda_min=1100, lambda_max=1200, dlambda=1) >>> sg.make_spectrum(ray) >>> sg.apply_lsf(function='boxcar', width=50) >>> sg.plot_spectrum('spec_lsf_corrected.png')