pyraliddemo.example.classes

CLASSES MODULE.

This module provides examples of how write classes according to the standards proposed by this template.

Warning

The D107 error is supressed througout the package to avoid havving to document __init__ methods, which is permitted by numpydoc standards.

class StefBoltz(radius: float, eff_temp: float)[source]

Bases: object

The Stefan–Boltzmann Law.

A basic class implementation of the Stefan-Boltzmann law.

sigma

Stefan-Boltzmann constant (\(5.6704\times 10^{-8} \mathrm{W} \mathrm{m}^{-2}\mathrm{K}^{-4}\))

Type

float

Parameters
  • radius (float) – Stellar radius

  • eff_temp (float) – Effective temperature

luminosity()float[source]

Luminosity.

Calculate the luminosity of a star.

Returns

Stellar luminosity in Watts

Return type

float

Examples

Calculate the luminosity of the Sun

python
>>> from pyraliddemo.example.classes import StefBoltz
>>> r_sun = 7e8
>>> t_sun = 5800
>>> StefBoltz(r_sun, t_sun).luminosity()
3.951223664081994e+26

Notes

This method implements the following equation

\[L = 4\pi R^2\sigma T_e^4\]

where:

  • \(L\) is the luminosity,

  • \(R\) is the stellar radius,

  • \(\sigma\) is Stefan-Boltzmann constant,

  • and \(T_e\) is the effective temperature.