fidanka.bolometric package

Subpackages

Submodules

fidanka.bolometric.URLS module

fidanka.bolometric.URLS.get_valid_bol_table_URLS()
fidanka.bolometric.URLS.get_valid_bol_table_names()

fidanka.bolometric.bctab module

class fidanka.bolometric.bctab.BolometricCorrector(paths: str | Sequence[str], FeH: float, bolTablePaths: str | None = None)

Bases: object

apparent_mags(Teff: ndarray[Any, dtype[ScalarType]], logg: ndarray[Any, dtype[ScalarType]], logL: ndarray[Any, dtype[ScalarType]], Av: float = 0, Rv: float = 3.1, mu: float = 0, filters: None | Tuple[str] = None) Dict[str, ndarray[Any, dtype[ScalarType]]]

Get the apparent magnitudes at a given Teff, Logg, and LogL using a MIST formated bolometric correction table. If the requested Av is not in the table but is inbetween two values which are in the table then a table will be linearlly interpolated between its upper and lower neighbors. If the Av value is above or below the domain of the tables then the table will be interpolatd using a line drawn through the two nearest tables extrapolated out. Finally, if Av is in the tale then that bolometric correction will simply be returned.

The final results will be the magnitutes at the given Av, Rv, and mu for Teff, Logg, and LogL based on the FeH and Bolometric correction table provided at object instantiation.

Parameters:
  • Teff (np.ndarray[np.float64]) – Effective Temperature of the theoretical model

  • logg (np.ndarray[np.float64]) – Log 10 surface gravity of the theoretical model

  • logL (np.ndarray[np.float64]) – Log 10 surface bolometric luminiosity of the theoretical model

  • Av (float, default=0) – V band reddening

  • Rv (float, default = 3.1) –

    Specific extinction (Note: Currently, july 2023, the MIST tables

    have only been computed for Rv=3.1)

  • mu (float, default=0) – Distance modulus.

Returns:

dustCorrectedMags – Dictionary of arrays of magnitudes parallel to Teff, logg, and logL. Each key is the name of a filter pulled from the given bolometric correction table

Return type:

dict[str,np.ndarray[np.float64]]

fidanka.bolometric.color module

fidanka.bolometric.color.get_interpolated_FeHTable(BC1, BC2, Av, Rv, FeH)

Get the bolometric correction table for a given metallicity, Av, and Rv. If that mettallicity is not in the BC tables, linearlly interpolate between the two closest metallicity tables.

fidanka.bolometric.load module

fidanka.bolometric.load.download_MIST_bol_table(ID: str, folder=None) Tuple[str, str]

Download bolometric correction tables from the MIST data-products site. Valid keys can be checked with fidanka.bolometric.URLS.get_valid_bol_table_names().

By default files will be downloaded to ~/.fidanka/bol/MIST/ however, this can be changed using the folder keyword argument. Note, this function will not extract or verify downloads.

If the file already exists then nothing will be downloaded.

Parameters:
  • ID (str) – Name of bol correction table to fetch. Valid names can be checked using the fidanka.bolometric.URLS.get_valid_bol_table_names() function

  • folder (Union[str, None], default=None) – The folder to save bolometric correction tables too. By default this will be ~/.fidanka/bol/MIST/

Returns:

  • filePath (str) – The path to the downloaded file

  • folder (str) – the folder where the file was saved to (same as the input parameter folder)

Raises:

ValueError – If ID is not a key in the lookup_table.

Examples

If you want to download the JWST bolometric correction tables to the default directory

>>> download_MIST_bol_table("JWST")

then if you do

>>> ls ~/.fidanka/bol/MIST/
>>> Out[1]: JWST.tar.gz
fidanka.bolometric.load.fetch_MIST_bol_table(ID: str, folder=None) Tuple[str, str]

Fetch (download, extract, and verify) bolometric correction tables for a given MIST table ID (valid names can be checked with fidanka.bolometric.URLS.get_valid_bol_table_names())

First, a check will be done to check if files for a given ID have already been downloaded and extracted to <folder>. If so they will have their checksums validated. If all checks passed then the function will stop here.

If some of the checks fail then the tarball will be redownloaded from the MIST website, these tarballs will then be extracted to some folder ~/.fidanka/bol/MIST/<ID> (or more generally <folder>/<ID>).

Parameters:
  • ID (str) – Name of bol correction table to fetch. Valid names can be checked using the fidanka.bolometric.URLS.get_valid_bol_table_names() function

  • folder (Union[str, None], default=None) – The folder to save bolometric correction tables too. By default this will be ~/.fidanka/bol/MIST/

Returns:

  • ID (str) – The MIST id requested

  • sfp (str) – Path to the “subfolder” where files are extracted too. This will be <folder>/<ID>. By default then ~/.fidanka/bol/MIST/<ID>

Warning

  • If the bolometric correction tables checksums cannot be validated after being downloaded and extracted

Examples

If you want to download the JWST bolometric correction tables to the default directory

>>> fetch_MIST_bol_table("JWST")

then if you do

>>> ls ~/.fidanka/bol/MIST/JWST

you should see all of the JWST bolometric correction tables, named like feh[m|p][0-9]{3}.JWST

fidanka.bolometric.load.get_MIST_paths_FeH(paths: List[str])

Given some list of paths to files names in the schema that the mist bolometric correction tables are named, parse out the FeH values for each table in the list.

Parameters:

paths

fidanka.bolometric.load.load_bol_table(filename: str) Dict[str, DataFrame]

Load a MIST formated bolometric correction table into a dictionary of pandas DataFrames. The dictionary will be keyed by the Av and Rv.

Parameters:

filename (str) – Path to the bolometric correction table

Returns:

out – Dictionary of pandas DataFrames keyed by Av and Rv.

Return type:

Dict[str, pd.DataFrame]

fidanka.bolometric.load.load_bol_table_metadata(filename: str) Dict[str, str | int]

Load the metadata from a MIST formated bolometric correction table. Do this efficiently by only reading the first few lines of the file.

Parameters:

filename (str) – Path to the bolometric correction table

Returns:

out – Dictionary containing the metadata

Return type:

Dict[str, Union[str, int]]

fidanka.bolometric.load.load_sub_bol_table(contents: str, names: list) DataFrame

Load a single sub-table from a MIST formated bolometric correction table.

Parameters:

contents (str) – Contents of the sub-table

Returns:

table – Pandas DataFrame containing the sub-table

Return type:

pd.DataFrame

fidanka.bolometric.load.load_sub_table_metadata(filename: str, pointer: int) Tuple[int, List[str]]

Load the metadata from a single sub-table in a MIST formated bolometric correction table.

Parameters:
  • filename (str) – Path to the bolometric correction table

  • pointer (int) – Pointer to the start of the sub-table

Returns:

out – Tuple containing the number of filters and the column names

Return type:

Tuple[int, List[str]]

fidanka.bolometric.load.verify_MIST_bol_tables(paths: List[str]) bool

Verify extracted files from the MIST bolometric correction tables (based on their versions July 4th 2023). If all of the files given in paths match the checksums stashed in the fidanka package data then this function will return true otherwise this will return false.

Parameters:

paths (List[str]) – List of paths to files. Each path must have a basename which exists within the stashed checksum file. This should include every bolometric correction table avalible from MIST as of July 4th 2023.

Returns:

okay – flag defining paths as either verified or not. If all files in the paths are both in the stashed checksums and the MD5 checksums of all files in paths match, then this will be true. In all other senarios this will return as false

Return type:

bool

Warns:

- If a file in paths is not found in the stashed checksums then a warning will – be raised.

Module contents