Converting between effective temperature and stellar color

Conversion between effective temperature and stellar color according to Ramirez and Melendez (several bands, metallicity dependent) and Ballesteros 2012 (black-body approximation).

Conversion according to Ramirez and Melendez 2005

In their 2005 publication, Ramírez and Meléndez (ApJ 626, 465-485) present metallicity-dependent relations between stellar effective temperature and color. Based on these relations, the class Ramirez2005 allows to convert between effective temperature and color. All 17 color indices given by the authors can be used.

Example:

from __future__ import print_function, division
from PyAstronomy import pyasl

# Create class instance
r = pyasl.Ramirez2005()

# Which color bands are available
print("Available color bands: ", r.availableBands())

# Convert B-V to effective temperature and back
bv = 0.75
feh = 0.0
teff = r.colorToTeff("B-V", bv, feh)
bv1 = r.teffToColor("B-V", teff, feh)
# Watch out for differences between input bv and the output bv1
print("B-V = ", bv, ", Teff = ", teff, ", bv1 = ", bv1, ", bv-bv1 = ", bv-bv1)

Conversion according to Ballesteros 2012

Ballesteros 2012 (EPL 97, 34008) present a conversion between effective temperature and B-V color index based on a black body spectrum and the filter functions.

Comparison to Ramirez and Mendelez 2005

Below, a comparison between the effective temperatures derived using the Ballesteros 2012 and Ramirez and Mendelez 2005 procedures is given. Solar metallicity main-sequence stars were assumed in the conversion. Clearly, the difference reaches about 200 K for hot stars in the 7000 K range and becomes smaller for cooler stars.

from __future__ import print_function, division
from PyAstronomy import pyasl

b = pyasl.BallesterosBV_T()
r = pyasl.Ramirez2005()

# Convert B-V to effective temperature and back
for bv in [0.35, 0.45, 0.55, 0.65, 0.75, 0.85, 0.95, 1.05, 1.15, 1.25, 1.35, 1.45]:
  tr = r.colorToTeff("B-V", bv, 0.0)
  tb = b.bv2T(bv)

  print(("B-V [mag] = {3:4.2f} : Teff (R05) = {0:4.0f} K, " + \
          "Teff (B12) = {1:4.0f} K, dTeff = {2: 4.0f} K").format(tr, tb, tr - tb, bv))


Output:
-------

B-V [mag] = 0.35 : Teff (R05) = 6952 K, Teff (B12) = 7158 K, dTeff = -206 K
B-V [mag] = 0.45 : Teff (R05) = 6453 K, Teff (B12) = 6625 K, dTeff = -171 K
B-V [mag] = 0.55 : Teff (R05) = 6033 K, Teff (B12) = 6170 K, dTeff = -138 K
B-V [mag] = 0.65 : Teff (R05) = 5672 K, Teff (B12) = 5778 K, dTeff = -106 K
B-V [mag] = 0.75 : Teff (R05) = 5358 K, Teff (B12) = 5436 K, dTeff =  -78 K
B-V [mag] = 0.85 : Teff (R05) = 5082 K, Teff (B12) = 5134 K, dTeff =  -53 K
B-V [mag] = 0.95 : Teff (R05) = 4835 K, Teff (B12) = 4866 K, dTeff =  -31 K
B-V [mag] = 1.05 : Teff (R05) = 4612 K, Teff (B12) = 4626 K, dTeff =  -13 K
B-V [mag] = 1.15 : Teff (R05) = 4410 K, Teff (B12) = 4409 K, dTeff =    1 K
B-V [mag] = 1.25 : Teff (R05) = 4225 K, Teff (B12) = 4213 K, dTeff =   13 K
B-V [mag] = 1.35 : Teff (R05) = 4055 K, Teff (B12) = 4034 K, dTeff =   21 K
B-V [mag] = 1.45 : Teff (R05) = 3897 K, Teff (B12) = 3870 K, dTeff =   27 K

Example:

from __future__ import print_function, division
from PyAstronomy import pyasl

b = pyasl.BallesterosBV_T()

bv = 0.65

# Convert B-V into effective temperature
teff = b.bv2T(0.65)
print("B-V = {0:4.2f} mag -> Teff = {1:4.0f} K".format(bv, teff))

# Convert effective temperature into B-V color
teff = 4568.0
bv = b.t2bv(teff)
print("Teff = {0:4.0f} K -> B-V = {1:4.2f} mag".format(teff, bv))

API documentation (Ramirez2005)

class PyAstronomy.pyasl.Ramirez2005

Relation between effective temperature and color given by Ramirez and Melendez 2005.

Ramirez and Melendez 2015, ApJ 626, 465-485 (please not that Ramirez has a non-ASCII accent on the i and Melendez an accent on the second e) give a relation between the stellar effective temperature and the color concerning various bands. This class allows to carry out the conversion in both directions.

Methods

availableBands()

Get a list of available band identifiers.

colorToTeff(band, X, feH[, stype, ignoreRange])

Converts color into effective temperature according to Eq.

colorToTeff_nop(band, X, feH[, stype])

Converts color into effective temperature according to Eq.

teffToColor(band, teff, feH[, stype, dteff, ...])

Converts effective temperature into color according to Eq.

teffToColor_nop(band, teff, feH[, stype, ...])

Converts effective temperature into color according to Eq.

_checkBand(band)

Check whether band identifier is valid.

_checkST(st)

Check whether stellar type (main-sequence/giant) is valid.

_convertBandName(bn)

Convert band name used in tables to internal representation.

Parameters
bnstring

Band name used in table.

Returns
Band IDstring

Identifier used in the class.

_extractTableData(lines, tableno)

Extract lines pertaining to specified table.

Parameters
lineslist of strings

Content of the data file.

tablenoint

Number of the table to be extracted.

Returns
Table datalist of strings

Part of the file belonging to the specified table.

_readData(fn)

Read the table data.

Parameters
fnstring

Filename.

_readTab23(lines, tableno)

Read tables 2 and 3.

Parameters
lineslist of strings

Content of the data file.

tablenoint

Number of the table to be extracted.

Returns
bandslist of strings

IDs of all bands in the table.

resultarray

Table data as array.

_readTab45(lines, tableno)

Read tables 4 and 5.

Parameters
lineslist of strings

Content of the data file.

tablenoint

Number of the table to be extracted.

Returns
resultarray

Table data as array.

_resolveMetallicityIndex(feh)

Determine where to find coefficients for given metallicity in Tables 4 and 5.

Parameters
fehfloat

Metallicity

availableBands()

Get a list of available band identifiers.

Returns
Band IDslist of strings

All strings used to identify bands.

colorToTeff(band, X, feH, stype='ms', ignoreRange=False)

Converts color into effective temperature according to Eq. 2.

This method takes the polynomial correction into account. Note that no interpolation is implemented between the polynomials defined in Tables 4 and 5, but the appropriate polynomial (according to footnote (a) on under the tables) is used.

Parameters
bandstring

Band identifier.

Xfloat

The color index (e.g., value of B-V).

feHfloat

Metallicity

stypestring, {ms, g}

Type of star (main sequence or giant).

ignoreRangeboolean, optional

If True, the validity range of the relations will be ignored. Otherwise (default) an exception will be raised when a value outside the range is encountered.

Returns
Tefffloat

The effective temperature in K.

colorToTeff_nop(band, X, feH, stype='ms')

Converts color into effective temperature according to Eq. 1.

The conversion using to Eq. 1 neglects a polynomial correction for metallicity. According to RM05, this causes a systematic error on the order of ‘30 or 40 K’.

Parameters
bandstring

Band identifier.

Xfloat

The color index (e.g., value of B-V).

feHfloat

Metallicity

stypestring, {ms, g}

Type of star (main sequence or giant).

Returns
Tefffloat

The effective temperature in K.

teffToColor(band, teff, feH, stype='ms', dteff=0.01, maxiter=100)

Converts effective temperature into color according to Eq. 2.

This method inverts Eq. 2 using an iterative scheme.

Parameters
bandstring

Band identifier.

tefffloat

Effective temperature in K.

feHfloat

Metallicity

stypestring, {ms, g}, optional

Type of star (main sequence or giant).

dtefffloat, optional

Temperature difference to be reached by the iteration [K]. Default is 0.01.

maxiterint, optional

The maximum number of iterations to be carried out. Default is 100.

Returns
Xfloat

Color in the specified band.

teffToColor_nop(band, teff, feH, stype='ms', noRaise=False)

Converts effective temperature into color according to Eq. 1.

This method inverts Eq. 1. Note that the equation is parabolic in the color (i.e., X). Therefore, there are two solutions of which the one falling within the validity ranges specified in Tables 4 and 5 of RM05 is selected. If none or both of the solutions are valid, an exception is raised.

Parameters
bandstring

Band identifier.

tefffloat

Effective temperature in K.

feHfloat

Metallicity

stypestring, {ms, g}

Type of star (main sequence or giant).

noRaiseboolean, optional

If True, no exceptions will be raised, but warnings will be given Both candidate solutions will be returned in this case.

Returns
Xfloat

Color in the specified band.

API documentation (BallesterosBV_T)

class PyAstronomy.pyasl.BallesterosBV_T

Black-body based conversion between effective temperature and B-V color.

Ballesteros 2012 (EPL 97, 34008) present a conversion between effective temperature and B-V color index based on a black body spectrum and the filter functions.

Methods

bv2T(bv)

Convert B-V color into temperature.

t2bv(T)

Convert temperature into B-V color.

bv2T(bv)

Convert B-V color into temperature.

Parameters
bvfloat

B-V color index [mag]

Returns
Tfloat

Temperature [K]

t2bv(T)

Convert temperature into B-V color.

Parameters
Tfloat

Temperature in K.

Returns
bvfloat

B-V color index [mag].