fidanka.isochrone package
Submodules
fidanka.isochrone.MIST module
- fidanka.isochrone.MIST.read_iso(filename: str) dict[float, pandas.core.frame.DataFrame]
Read in a MIST formated isochrone to a list of DataFrame
- Parameters:
filename (str) – filepath pointing to the isochrone file
- Returns:
isos – Dictionary of isochrones loaded and indexed by their ages in Gyr
- Return type:
dict[float, pd.DataFrame]
- fidanka.isochrone.MIST.read_iso_metadata(filename: str) dict[str, Any]
Efficiently read in isochrone metadata without opening entire file
- Parameters:
filename (str) – filepath pointing to the isochrone file.
- Returns:
metadata – Dictionary of metadata relating to isochrone pulled from the first 7 rows of the isochrone file.
- Return type:
dict[str, Any]
fidanka.isochrone.isochrone module
- fidanka.isochrone.isochrone.calc_extinction_coef(wEffective, Rv=3.1)
Calculate the extinction coefficient for a given wavelength in nanometers. This is used to calculate the color excess of an isochrone.
Calculations are based on the CCM 1989 extinction law. Cardelli, Clayton, and Mathis 1989, ApJ, 345, 245
- Parameters:
wEffective (float) – Effective wavelength in nanometers
Rv (float) – Ratio of total to selective extinction. Default is 3.1
- Returns:
extinctionCoef – Extinction coefficient for the given wavelength
- Return type:
float
- fidanka.isochrone.isochrone.interCMDatMag(color: ndarray[Any, dtype[float64]] | Series, mag: ndarray[Any, dtype[float64]] | Series, targetMag: float) float | ndarray[Any, dtype[float64]]
Given some color and magnitude, assumed to be relativley clean and from an isochrone shifted into the approproate filters. Then linearlly interpolate, parmeterized by magnitude, to the target magnitude.
- Parameters:
color (Union[ndarray[float64], pd.Series]) – 1D array of color of shape m
mag (Union[ndarray[float64], pd.Series]) – 1D array of magnitude of shape m
targetMag (float) – Magnitude to evaluate interpolation result at.
- Returns:
colorAtMag – colors of the isochrone at the requested magnitude(s)
- Return type:
Union[float, ndarray[float64]]
- fidanka.isochrone.isochrone.interp_isochrone_age(iso: dict[float, pandas.core.frame.DataFrame], targetAgeGyr: float) DataFrame
Given some dictionary of isochrones where the keys are the ages of those isochrones in Gyr, interpolate between isochrones of two bounding ages to find the isochrones at a target age. Do this using pandas efficient apply functions. Works for MIST and pysep formated isochrones so long as they have been loaded into pandas using the routines in this library.
- Parameters:
iso (dict[float, pd.DataFrame]) – Dictionary of isochrones indexed by isochrones age in Gyr
targetAgeGyr (float) – Target age to interpolate to (in Gyr). This age must be greater than the minimum age and less than the max age in iso.
- Returns:
interpolate – Isochrones with all columns and rows interpolated to the targetAge linearlly from the upper and lower bounding aged isochrones
- Return type:
pd.DataFrame
- fidanka.isochrone.isochrone.iso_color_mag(iso, filter1, filter2, reverseFilterOrder: bool = False)
- fidanka.isochrone.isochrone.load_ISO_CMDs(root)
Load the isochrone color-magnitude diagrams (CMDs) and metadata from a specified root directory.
This function recursively searches the root directory for isochrone text files (“isochrones.txt”). It organizes the data by population type (PopA or PopE), helium content (Y), and alpha enhancement (alpha). It returns two nested dictionaries. The first contains the CMDs and the second contains the metadata corresponding to the CMDs.
- Parameters:
root (str) – The root directory to begin the search for “isochrones.txt” files.
- Returns:
lookup (dict) – A nested dictionary with the CMD data, indexed by the population type, helium content, and alpha enhancement. The structure is {population: {helium: {alpha: CMD}}}.
FeHLookup (dict) – A nested dictionary with the CMD metadata, indexed by the population type, helium content, and alpha enhancement. The structure is {population: {helium: {alpha: metadata}}}.
Notes
The function uses regular expressions to extract the population type, helium content, and alpha enhancement from the file path. It assumes the path is structured as follows: “Pop(A|E)+(Y)/alpha-(alpha)”.
Progress bars from the tqdm module are displayed during the operation to provide visual feedback.
The ‘read_iso’ and ‘read_iso_metadata’ functions are assumed to be available in the same scope.
If a tuple of parameters (population, helium, alpha) is not found in the list of extracted parameters, it is skipped and not included in the dictionaries.
The function uses the walrus operator ‘:=’ which is only available in Python 3.8 and later.
- fidanka.isochrone.isochrone.shift_full_iso(iso: ndarray, distance: float, reddening: float, effectiveWavelengths: list, columnNames: list, responseFunctions: dict)
Shift the isochrone around in distance and reddining.
- fidanka.isochrone.isochrone.shift_isochrone(color: ndarray[Any, dtype[float64]] | Series, magnitude: ndarray[Any, dtype[float64]] | Series, distance: float, reddening: float, filter1EffectiveWavelength: float = 275, filter2EffectiveWavelength: float = 814, rFilterOrder: bool = True) Tuple[ndarray[Any, dtype[float64]] | Series, ndarray[Any, dtype[float64]] | Series]
Shift the isochrone around in distance and reddining. Note! This is currently wrong. I have not had time to fix it yet but be aware that to get true distances and reddinings out this function will need to be fixed!
TODO: FIX
- Parameters:
color (Union[ndarray[float64], pd.Series]) – 1D array of color of shape m
magniude (Union[ndarray[float64], pd.Series]) – 1D array of magnitude of shape m
distance (float) – Distance, in parsecs, to shift the isochrone by
reddining (float) – Reddining, in magnitudes E(B-V)
filter1EffectiveWavelength (float, default=275) – Effective wavelength of the first filter in nanometers
filter2EffectiveWavelength (float, default=814) – Effective wavelength of the second filter in nanometers
rFilterOrder (bool, default=True) – If true reverse the standard filter order. This is used for isochrones that are in the HST filter order.
- Returns:
aptMag (Union[ndarray[float64], pd.Series]) – Apparent magnitude, shifted by the distance
aptCol (Union[ndarray[float64], pd.Series]) – Apparent color, shifted by distance and reddining