specex.rrspecex module
SPECEX - SPECtra EXtractor.
redrock wrapper tools for python-specex spectra. This program is based on the structure of redrock.external.boss function.
Copyright (C) 2022-2023 Maurizio D’Addona <mauritiusdadd@gmail.com>
- specex.rrspecex.get_template_types()[source]
Get the available types of templates.
Returns
- typeslist of str
List of types of available templates.
- specex.rrspecex.get_templates(template_types=[], filepath=False, templates=None)[source]
Get avilable templates.
Parameters
- template_typeslist of str, optional
List of template types to retrieve. If it’s empty all available templates will be returned. The default is [].
- filepathboot, optional
If it’s true then return the file paths instead of actual templates.
- templatesstr, optional
The path of a template file or of a directory containing templates files. If None, templates are searched in the default redrock path. The default value is None.
Returns
- available_templateslist of redrock.templates.Template or file paths
The available templates or the corresponding file paths.
- specex.rrspecex.read_spectra(spectra_fits_list, spec_hdu=None, var_hdu=None, wd_hdu=None, memmap=True, resolution=2.51, smoothing=0, quite=False)[source]
Read input spectra fits files.
Parameters
- spectra_fits_listlist
List of fits files containing the input spectra.
- spec_hduint or None, optional
The index of the HDU that contains the spectral data itself. If it is None, then the index is determined automatically by the name of the HDU. If this operation fails ValueError exception is raised. The default value is None.
- var_hduint or None, optional
The index of the HDU that contains the variance of the spectral data. If it is None, then the index is determined automatically by the name of the HDU. If this operation fails ValueError exception is raised. The default value is None.
- wd_hduint or None, optional
The index of the HDU that contains the wavelength dispersion in pixels. If it is None, then the index is determined automatically by the name of the HDU. If this operation fails, no wavelenght dispersion will be used and the spectra will be considered having a uniform resolution. The default value is None.
- memmapbool, optional
Whether to use memmap or not. The default value is False.
- resolutionfloat, optional
A fixed spectral resolution in Angrstrom to be used if no dispersion information is available from the spectrum file itself. The default value is 2.51 (the MUSE resolution).
- smoothingint, optional
A smooting to be applyed before redshift estimation. A value of 0 means no smoothing. The default value is 0.
- quitebool, optional
Reduce the verbosity of the output.
Raises
- ValueError
If cannot automatically determine the HDU containing the specral data or its variance.
Returns
- targetslist of redrock.targets.Target
The target spectra for which redshift will be computed.
- metatableastropy.table.Table
A table containing metadata.
- specex.rrspecex.rrspecex(options=None, comm=None)[source]
Estimate redshifts for spectra extracted with python-specex using redrock.
This loads targets serially and copies them into a DistTargets class. It then runs redshift fitting and writes the output to a catalog.
Parameters
- optionslist, optional
lLst of commandline options to parse. The default is None.
- commmpi4py.Comm, optional
MPI communicator to use. The default is None.
Returns
- targetslist of redrock.targets.Target objects
list of target spectra.
- zfitastropy.table.Table
Table containing the fit results.
- scandatadict
A dictionary containing the redshift scanning information for each target