CompositeStellib¶
- class beast.physicsmodel.stars.stellib.CompositeStellib(osllist, *args, **kwargs)[source]¶
Bases:
StellibGenerates an object from the union of multiple individual libraries
Contructor
Attributes Summary
return a common wavelength sampling to all libraries.
Methods Summary
genQ(qname, r, **kwargs)Generate a composite value from a previously calculated
genSpectrum(T0[, g0, Z0, weights])Generate a composite sprectrum
gen_spectral_grid_from_given_points(pts[, ...])Reinterpolate a given stellar spectral library on to an Isochrone grid
get_boundaries([dlogT, dlogg])Returns the closed boundary polygon around the stellar library with given margins
interp(T0, g0, Z0, L0[, dT_max, eps, bounds])Interpolation of the T,g grid
interpMany(T0, g0, Z0, L0[, dT_max, eps, ...])run interp on a list of inputs and returns reduced results
which_osl(xypoints[, dlogT, dlogg])Returns the library indice that contains each point in xypoints
Attributes Documentation
- source¶
- wavelength¶
return a common wavelength sampling to all libraries. This can be used to reinterpolate any spectrum onto a common definition
Methods Documentation
- genQ(qname, r, **kwargs)[source]¶
- Generate a composite value from a previously calculated
interpolation Works on 1 desired star or a population of stars
- genSpectrum(T0, g0=None, Z0=None, weights=None, **kwargs)[source]¶
- Generate a composite sprectrum
Does the interpolation or uses a previously calculated interpolation Works on 1 desired star or a population of stars
- Parameters:
- Returns:
s (ndarray) – an array containing the composite spectrum reinterpolated onto self.wavelength
.. note:: – if T0 and g0 are iterable, it calls interpMany
- gen_spectral_grid_from_given_points(pts, bounds={'dlogT': 0.1, 'dlogg': 0.3})[source]¶
Reinterpolate a given stellar spectral library on to an Isochrone grid
- Parameters:
pts (dict like structure of points) – dictionary like or named data structure of points to interpolate at pts must contain: logg surface gravity in log-scale logT log of effective temperatures (in Kelvins) logL log of luminosity in Lsun units Z metallicity
bounds (dict) – sensitivity to extrapolation (see
:func: Stellib.get_boundaries) default: {dlogT:0.1, dlogg:0.3}
- Returns:
g – Spectral grid (in memory) containing the requested list of stars and associated spectra
- Return type:
- get_boundaries(dlogT=0.1, dlogg=0.3, **kwargs)[source]¶
Returns the closed boundary polygon around the stellar library with given margins
- Parameters:
- Returns:
b (ndarray[float, ndim=2]) – (closed) boundary points: [logg, Teff] (or [Teff, logg] is swap is True)
.. note:: – as computing the boundary could take time, it is saved in the object and only recomputed when parameters are updated
- interp(T0, g0, Z0, L0, dT_max=0.1, eps=1e-06, bounds={})[source]¶
Interpolation of the T,g grid
Interpolate on the grid and returns star indices and associated weights, and Z. 3 to 12 stars are returned. It calls _interp_, but reduce the output to the relevant stars.
- Parameters:
T0 (double) – log(Teff) to obtain
g0 (double) – log(g) to obtain
T (double) – log(Teff) of the grid
g (double) – log(g) of the grid
dT_max (float) – If, T2 (resp. T1) is too far from T compared to T1 (resp. T2), i2 (resp. i1) is not used. (see below for namings)
eps (foat) – temperature sensitivity under which points are considered to have the same temperature
bounds (dict) – sensitivity to extrapolation (see
:func: Stellib.get_boundaries) default: {dlogT:0.1, dlogg:0.3}
- Returns:
(osl, r) – osl: is the library index starting from 1. 0 means no coverage. r: is the result from interp call on the corresponding library. a 3 to 12 star indexes and associated weights
- Return type:
- interpMany(T0, g0, Z0, L0, dT_max=0.1, eps=1e-06, weights=None, bounds={}, pool=None, nthreads=1)[source]¶
run interp on a list of inputs and returns reduced results
Interpolation of the T,g grid at Z0 metallicity
Interpolate on the grid and returns star indices and associated weights, and Z. 3 to 12 stars are returned. It calls _interp_, but reduce the output to the relevant stars.
- Parameters:
T0 (ndarray(float)) – log(Teff) to obtain
g0 (ndarray(float)) – log(g) to obtain
Z0 (ndarray(float)) – metallicity values
L0 (ndarray(float)) – luminosity values
dT_max (float) – If, T2 (resp. T1) is too far from T compared to T1 (resp. T2), i2 (resp. i1) is not used. (see below for namings)
eps (foat) – temperature sensitivity under which points are considered to have the same temperature
weights (ndarray(float)) – luminosity weigths to apply after interpolation
bounds (dict) – sensitivity to extrapolation (see
:func: Stellib.get_boundaries) default: {dlogT:0.1, dlogg:0.3}pool (Pool-like object) – specify a multiprocessing pool for parallel processing
nthreads (int) – number of processes to use by default
- Returns:
(osl, r) – osl is the library index starting from 1. 0 means no coverage. r is the result from interp call on the corresponding library. a 3 to 12 star indexes and associated weights
- Return type:
- which_osl(xypoints, dlogT=0.0, dlogg=0.0)[source]¶
Returns the library indice that contains each point in xypoints
- The decision is made from a two step search:
first, each point is checked against the strict boundary of each library (i.e., dlogT = 0, dlogg = 0).
second, if points are not found in strict mode, the boundary is relaxed and a new search is made.
- Each point is associated to the first library matching the above
conditions.