species.data.model_data package

Submodules

species.data.model_data.custom_model module

Module for adding a custom grid of model spectra to the database.

species.data.model_data.custom_model.add_custom_model_grid(model_name: str, data_path: str | Path, parameters: list[str], database: File, wavel_range: tuple[float, float] | None, teff_range: tuple[float, float] | None, wavel_sampling: float | None, fit_from: float | None = None, extend_from: float | None = None) None[source]

Function for adding a custom grid of model spectra to the database. The spectra are read from the data_path and should contain the model_name and parameters in the filenames in the following format example: model-name_teff_1000_logg_4.0_feh_0.0_spec.dat. The list with parameters should contain the same parameters as are included in the filename. Each datafile should contain two columns with the wavelengths in \(\mu\text{m}\) and the fluxes in \(\text{W} \text{m}^{-2} \mu\text{m}^{-1}\). Each file should contain the same number and values of wavelengths. The wavelengths should be logarithmically sampled, so with a constant \(\lambda/\Delta\lambda\). If not, then the wavel_range and wavel_sampling parameters should be used such that the wavelengths are resampled when reading the data into the species database.

Parameters:
  • model_name (str) – Name of the model grid. Should be identical to the model name that is included in the filenames.

  • data_path (str, Path) – Path where the files with the model spectra are located. Either a relative or absolute path. Either a string or a Path object from pathlib.

  • parameters (list(str)) – List with the model parameters. The following parameters are supported: teff (for \(T_\mathrm{eff}\)), logg (for \(\log\,g\)), feh (for [Fe/H]), co (for C/O), fsed (for \(f_\mathrm{sed}\)), logkzz (for \(\log\,K_\mathrm{zz}\)), and adindex (for \(\gamma_\mathrm{ad}\)). Please contact the code maintainer if support for other parameters should be added.

  • database (h5py._hl.files.File) – Database.

  • wavel_range (tuple(float, float), None) – Wavelength range (\(\mu\text{m}\)). The original wavelength points are used if the argument is set to None.

  • teff_range (tuple(float, float), None) – Effective temperature range (K) for adding a subset of the model grid. The full parameter grid will be added if the argument is set to None.

  • wavel_sampling (float, None) – Wavelength spacing \(\lambda/\Delta\lambda\) to which the spectra will be resampled. Typically this parameter is not needed so the argument can be set to None. The only benefit of using this parameter is limiting the storage in the HDF5 database. The parameter should be used in combination with setting the wavel_range.

  • fit_from (float, None) – Extend the spectra with a Rayleigh-Jeans slope. To do so, the red end of the spectra will be fitted by setting fit_from to the minimum wavelength (in um) beyond which fluxes will be included in the least-squares fit. The spectra are not extended when setting the argument to None.

  • extend_from (float, None) – This parameter can be used in combination with fit_from. The argument of extend_from is the minimum wavelength (in um) from which the spectra will be extended with the Rayleigh-Jeans slope. The spectra will be extended from the last available wavelength when setting the argument to None. Typically, the value of fit_from will be smaller than the value of extend_from.

Returns:

None

Return type:

NoneType

species.data.model_data.model_spectra module

Module for adding a grid of model spectra to the database.

species.data.model_data.model_spectra.add_model_grid(model_tag: str, input_path: str, database: File, wavel_range: tuple[float, float] | None = None, teff_range: tuple[float, float] | None = None, wavel_sampling: float | None = None, unpack_tar: bool = True, fit_from: float | None = None, extend_from: float | None = None) None[source]

Function for adding a grid of model spectra to the database. The original spectra had been resampled to logarithmically- spaced wavelengths, so with at a constant \(\lambda/\Delta\lambda\). This function downloads the model grid, unpacks the tar file, and adds the spectra and parameters to the database.

Parameters:
  • model_tag (str) – Tag of the grid of model spectra.

  • input_path (str) – Folder where the data is located.

  • database (h5py._hl.files.File) – HDF5 database.

  • wavel_range (tuple(float, float), None) – Wavelength range (\(\mu\text{m}\)). The original wavelength points are used if the argument is set to None.

  • teff_range (tuple(float, float), None) – Range of effective temperatures (K) for which the spectra will be extracted from the TAR file and added to the database. All spectra are selected if the argument is set to None.

  • wavel_sampling (float, None) – Wavelength spacing \(\lambda/\Delta\lambda\) to which the spectra will be resampled. Typically this parameter is not needed so the argument can be set to None. The only benefit of using this parameter is limiting the storage in the HDF5 database. The parameter should be used in combination with setting the wavel_range.

  • unpack_tar (bool) – Unpack the TAR file with the model spectra in the data_folder. The argument can be set to False if the TAR file had already been unpacked previously.

  • fit_from (float, None) – Extend the spectra with a Rayleigh-Jeans slope. To do so, the red end of the spectra will be fitted by setting fit_from to the minimum wavelength (in um) beyond which fluxes will be included in the least-squares fit. The spectra are not extended when setting the argument to None.

  • extend_from (float, None) – This parameter can be used in combination with fit_from. The argument of extend_from is the minimum wavelength (in um) from which the spectra will be extended with the Rayleigh-Jeans slope. The spectra will be extended from the last available wavelength when setting the argument to None. Typically, the value of fit_from will be smaller than the value of extend_from.

Returns:

None

Return type:

NoneType

Module contents