Photometry#
stelpar collects and transforms measured photometry with MeasuredPhotometry
to compare with the synthetic photometry in the evolution model. With
SyntheticPhotometry photometry is extinction-corrected and a measured
photometry model is formed for direct comparison with the evolutionary model.
- class stelpar.MeasuredPhotometry(name, coords=None, photometry_meta=None, user_plx=None, search_radius=None, radius_step=None, tol=0, lazy_tol=False, vizier_kwargs=None, isochrone_cols=None)[source]#
Handles all the photometry-getting from online databases for a single target.
- Parameters:
name (str) – The name of the target as would be accepted by Vizier or Simbad.
coords (SkyCoord, optional) – The coordinates (astropy SkyCoord object) of the target. If None (default), the name is used to query the object, otherwise, the coordinates are used.
photometry_meta (DataFrame, optional) – The metadata used to access Vizier data and index DataFrames like photometry.
user_plx (list-like, optional) – A (parallax, error) pair given in arcsec. If provided, these values will be used to convert photometry from apparent to absolute magnitudes. If None (default), will rely on Gaia or Simbad to find parallax
search_radius (None, float, or astropy.units.quantity.Quantity, optional) – The initial search radius for the Vizier query. If None, default is 5 arcsecond.
radius_step (None, float, or astropy.units.quantity.Quantity, optional) – How much is the search radius decreased every query if it needs to be iterated? If None, default is 1 arcsecond.
tol (int, optional) – Minimum number of magnitudes needed to run the simulation. Default is 0.
lazy_tol (bool, optional) – If True (default), will find the search radius where all queried tables contain 1 target. If False, will save each table successively once they contain only 1 target (attempting to maximize photometry amount).
vizier_kwargs (dict, optional) – Keyword arguments passable to astroquery.vizier.Vizier or related methods. See https://astroquery.readthedocs.io/en/latest/api/astroquery.vizier.VizierClass.html#astroquery.vizier.VizierClass for available attributes.
isochrone_cols (list, optional) – If the found photometry is not in the list of columns for the working isochrone model grid, they are dropped from the photometry DataFrame. The default is None.
Methods
get_data()Grabs the target photometry from Vizier.
Grabs the target parallax and error from Simbad.
- get_data()[source]#
Grabs the target photometry from Vizier.
- Returns:
photometry (DataFrame) – Contains the measured photometry found for each filter band, the parallax and error, and the magnitude system for each band.
termination_message (str) – Indicates whether the data-grab was unsuccessful and why, or whether it was successful.
- class stelpar.SyntheticPhotometry(photometry_df, model_grid=None, interp_method='true', extinction_kwargs=None, interp_kwargs=None)[source]#
Uses synphot to calculate extinction and add it to the estimated magnitudes. See https://learn.astropy.org/tutorials/color-excess.html for an example.
- Parameters:
photometry_df (DataFrame) – The DataFrame containing the target’s measured photometry.
model_grid (DataFrame or str, optional) – The full isochrone grid DataFrame or the file location (string) of the cached, serialized grid. The latter is preferred when using the pre-interpolated grid because the memory usage of that DataFrame is higher than the uninterpolated frame. The default is None which is acceptable if only using extinction methods.
interp_method (str, optional) – If ‘true’, uses the standard interpolation method of DFInterpolator. If ‘nearest’ uses nearest-neighbor interpolation. If ‘hybrid’ uses nearest-neighbor interpolation for age and DFInterpolator for mass. The default is ‘true’.
extinction_kwargs (dict, optional) – Can pass additional keyword arguments to be used by the extinction functions.
interp_kwargs (dict, optional) – Can pass additional keyword arguments to be used by the interpolator function.
Methods
calculate_extinction(Av, Teff[, ...])Calculates extinction using the results from self._synphot_extinction or self._numpy_extinction.
Wrapper for interpolation functions so it can be pickled properly with multiprocessing.Pool.
photometry_model(age, mass, Av[, ...])Combines the estimated photometry from the isochrone with the calculated extinction to form a model which can be used as a fit against the measured photometry.
- calculate_extinction(Av, Teff, use_synphot=False, pivot_quantum_eff=False)[source]#
Calculates extinction using the results from self._synphot_extinction or self._numpy_extinction. If the latter (i.e., use_synphot=False) the values are converted to the desired flux units within this function (synphot does it internally).
- Parameters:
Av (float) – The V-band extinction in mag from which the extinction for other bands is calculated.
Teff (float) – The effective temperature of the target in K.
use_synphot (bool, optional) – Use the built-in synphot calculation or calculate extinction with numpy arrays which is faster. The default is False.
pivot_quantum_eff (bool, optional) – Should the ‘quantum-efficiency’ convention be used to calculate the pivot wavelength (as opposed to the equal-energy convention). The default is False.
- Returns:
Contains the calculated extinction and the extinction-corrected photometry for the target.
- Return type:
self._extinction, DataFrame
- interpolate_isochrone(idx)[source]#
Wrapper for interpolation functions so it can be pickled properly with multiprocessing.Pool.
- Parameters:
idx (list of floats) – The [age, mass] index to interpolate the model grid.
- Returns:
The interpolated data point of the isochrone with idx as its index.
- Return type:
DataFrame
- photometry_model(age, mass, Av, Teff_prior=None, Teff_bounds=None, zero_extinction=False)[source]#
Combines the estimated photometry from the isochrone with the calculated extinction to form a model which can be used as a fit against the measured photometry.
- Parameters:
age (float) – The age in Myr of the target.
mass (float) – The mass in M_Sun of the target.
Av (float) – The V-band extinction in mag.
Teff_prior (tuple, optional) – The (mean, std) pair used to calculate the logarithm of the effective temperature prior using a normal distribution. The default is None.
Teff_bounds (tuple, optional) – The (lower, upper) pair used to draw the bounds of the effective temperature. The default is None.
zero_extinction (bool, optional) – If True, set extinction to zero (Av=0). The default is False.
- Returns:
model (DataFrame) – Contains the interpolated magnitudes, the calculated extinction (if not set to zero), and the sum of these for each band.
log_teff_prior (float) – The effective temperature prior to be added to the probability functions. If Teff_prior is None or contains NaN values, log_teff_prior will be 0.