Stellib

class beast.physicsmodel.stars.stellib.Stellib(*args, **kargs)[source]

Bases: object

Basic stellar library class

Contructor

Attributes Summary

nbytes

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])

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 – an array containing the value

Return type:

ndarray

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 – an array containing the composite spectrum

Return type:

ndarray

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 – Spectral grid (in memory) containing the requested list of stars and associated spectra

Return type:

SpectralGrid

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 – array of radii in m (SI units)

Return type:

ndarray[float, ndim=1]

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:
  • double (g) – log(Teff) to obtain

  • double – log(g) to obtain

  • double – log(Teff) of the grid

  • 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:
  • ndarray(float) (L0) – log(Teff) to obtain

  • ndarray(float) – log(g) to obtain

  • ndarray(float) – metallicity values

  • 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])

  • aa (antialiased or)

  • axes (an Axes instance)

  • clip_box (a matplotlib.transforms.Bbox instance)

  • clip_on ([True | False])

  • clip_path ([ (Path, Transform) | Patch | None ])

  • color (matplotlib color spec)

  • contains (a callable function)

  • ec (edgecolor or)

  • fc (facecolor or)

  • figure (a matplotlib.figure.Figure instance)

  • fill ([True | False])

  • gid (an id string)

  • hatch ([ '/' | '' | '|' | '-' | '+' | 'x' | 'o' | 'O' | '.' | '*' ])

  • label (string or anything printable with '%s' conversion.)

  • ls (linestyle or)

  • lw (linewidth or)

  • lod ([True | False])

  • path_effects (unknown)

  • picker ([None|float|boolean|callable])

  • rasterized ([True | False | None])

  • snap (unknown)

  • transform (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 – a boolean ndarray, True for points inside the polygon. A point on the boundary may be treated as inside or outside.

Return type:

ndarray(dtype=bool)