Stellib¶
- class beast.physicsmodel.stars.stellib.Stellib(*args, **kargs)[source]¶
Bases:
object
Basic stellar library class
Contructor
Attributes Summary
return the number of bytes of the object
Methods Summary
genQ
(qname, r, **kwargs)Generate a composite value from a previously calculated
genSpectrum
(T0[, g0, Z0, weights])Generate a composite sprectrum Does the interpolation or uses a previously calculated interpolation Works on 1 desired star or a population of stars
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
get_radius
(logl, logt)Returns the radius of a star given its luminosity and temperature
interp
(T0, g0, Z0, L0[, dT_max, eps])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
plot_boundary
([ax, dlogT, dlogg])- Parameters:
points_inside
(xypoints[, dlogT, dlogg])Returns if a point is inside the polygon defined by the boundary of the library
Attributes Documentation
- nbytes¶
return the number of bytes of the object
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
- Parameters:
- qname: str
quantity name from self.grid
- r: ndarray
the result from a previous interpolation
- Returns:
- val: ndarray
an array containing the value
- 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
if T0 and g0 are iterable, it calls interpMany
- Parameters:
- T0: float or sequence
log(Teff) of each star or a 2d-array containing the result from a previous interpolation
- g0: float or sequence
log(g) of each stars
- Z0: float or sequence
metallicity
- weights: float or sequence
individual weights of each star
- **kwargs: forwarded to interpMany
- Returns:
- s: ndarray
an array containing the composite spectrum
- 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 grid.get_stellib_boundaries) default: {dlogT:0.1, dlogg:0.3}
- Returns:
- g: SpectralGrid
Spectral grid (in memory) containing the requested list of stars and associated spectra
- get_boundaries(dlogT=0.1, dlogg=0.3, **kwargs)[source]¶
Returns the closed boundary polygon around the stellar library with given margins
- Parameters:
- s: Stellib
Stellar library object
- dlogT: float
margin in logT
- dlogg: float
margin in logg
- Returns:
- b: ndarray[float, ndim=2]
closed boundary edge points: [logT, logg]
Note
as computing the boundary could take time, it is saved in the object and only recomputed when parameters are updated
- get_radius(logl, logt)[source]¶
Returns the radius of a star given its luminosity and temperature
- Assuming a black body, it comes:
R ^ 2 = L / ( 4 pi sigma T ^ 4 ),
- with:
L, luminosity in W, pi, 3.141592… sig, Stephan constant in W * m**-2 * K**-4 T, temperature in K
- Parameters:
- logl: ndarray[float, ndim=1]
log luminosities from the isochrones, in Lsun
- logt: ndarray[float, ndim=1]
log temperatures from the isochrones, in K
- Returns:
- radii: ndarray[float, ndim=1]
array of radii in m (SI units)
- interp(T0, g0, Z0, L0, dT_max=0.1, eps=1e-06)[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
- Returns:
- Returns 3 to 12 star indexes and associated weights
- see __interp__
- TODO: compute new weights accounting for Z
- interpMany(T0, g0, Z0, L0, dT_max=0.1, eps=1e-06, weights=None, 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: float
temperature sensitivity under which points are considered to have the same temperature
- weights: ndarray(float)
luminosity weigths to apply after interpolation
- pool: Pool-like object
specify a multiprocessing pool for parallel processing
- nthreads: int
number of processes to use by default
- Returns:
- r: ndarray
Returns 3 to 12 star indexes and associated weights
- see __interp__
- TODO: compute new weights accounting for Z
- plot_boundary(ax=None, dlogT=0.0, dlogg=0.0, **kwargs)[source]¶
- Parameters:
- dlogT: float
margin in logT (see get_boundaries)
- dlogg: float
margin in logg (see get_boundaries)
- agg_filter: unknown
- alpha: float or None
- animated: [True | False]
- antialiased or aa: [True | False] or None for default
- axes: an :class:`~matplotlib.axes.Axes` instance
- clip_box: a :class:`matplotlib.transforms.Bbox` instance
- clip_on: [True | False]
- clip_path: [ (:class:`~matplotlib.path.Path`, :class:`~matplotlib.transforms.Transform`) | :class:`~matplotlib.patches.Patch` | None ]
- color: matplotlib color spec
- contains: a callable function
- edgecolor or ec: mpl color spec, or None for default, or ‘none’ for no color
- facecolor or fc: mpl color spec, or None for default, or ‘none’ for no color
- figure: a :class:`matplotlib.figure.Figure` instance
- fill: [True | False]
- gid: an id string
- hatch: [ ‘/’ | ‘' | ‘|’ | ‘-’ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
- label: string or anything printable with ‘%s’ conversion.
- linestyle or ls: [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’]
- linewidth or lw: float or None for default
- lod: [True | False]
- path_effects: unknown
- picker: [None|float|boolean|callable]
- rasterized: [True | False | None]
- snap: unknown
- transform: :class:`~matplotlib.transforms.Transform` instance
- url: a url string
- visible: [True | False]
- zorder: any number
- .. seealso::
Patch
For additional kwargs
- points_inside(xypoints, dlogT=0.1, dlogg=0.3)[source]¶
Returns if a point is inside the polygon defined by the boundary of the library
- Parameters:
- xypoints: sequence
a sequence of N logg, logT pairs.
- dlogT: float
margin in logT
- dlogg: float
margin in logg
- Returns:
- r: ndarray(dtype=bool)
a boolean ndarray, True for points inside the polygon. A point on the boundary may be treated as inside or outside.