Handling SKIRT units. More...
Functions | |
def | _flavor (flavorunit) |
This helper function returns a numeric code corresponding to the specified flavor or unit: More... | |
def | convertToFlavor (wavelength, flux, flavor) |
This function accepts a flux density, surface brightness, spectral radiance, or spectral luminosity (generically called "flux" for the purposes of this function), converts this flux from an arbitrary unit in any "flavor" (neutral, per wavelength, per frequency, or per energy) to an equivalent unit in the specified flavor, and returns the result. More... | |
def | hasReverseWavelengthOrder (unitlike) |
This function returns True if the units represented by the "unit-like" input are those for frequency ( | |
def | latexForSpectralFlux (unitlike) |
This function returns a latex-formatted string representation for a flux density ( | |
def | latexForSpectralFluxWithUnit (unitlike) |
This function returns the result of latexForSpectralFlux() + latexForUnit() with the same argument. More... | |
def | latexForSpectralLuminosity (unitlike) |
This function returns a latex-formatted string representation for the spectral luminosity ( | |
def | latexForSpectralLuminosityWithUnit (unitlike) |
This function returns the result of latexForSpectralLuminosity() + latexForUnit() with the same argument. More... | |
def | latexForSpectralRadiance (unitlike) |
This function returns a latex-formatted string representation for the mean intensity or spectral radiance ( | |
def | latexForSpectralRadianceWithUnit (unitlike) |
This function returns the result of latexForSpectralRadiance() + latexForUnit() with the same argument. More... | |
def | latexForUnit (unitlike) |
This function returns a latex-formatted string representation for the "unit-like" input, enclosed in square brackets and preceded by a short space. More... | |
def | latexForWavelength (unitlike) |
This function returns a latex-formatted string representation for wavelength ( | |
def | latexForWavelengthWithUnit (unitlike) |
This function returns the result of latexForWavelength() + latexForUnit() with the same argument. More... | |
def | unit (unitlike) |
This function returns an astropy unit for any of the following "unit-like" inputs: More... | |
Handling SKIRT units.
This module offers functions for converting SKIRT units to astropy units, and for handling conversions that may not be trivial to perform using pure astropy.
|
private |
This helper function returns a numeric code corresponding to the specified flavor or unit:
def pts.simulation.units.convertToFlavor | ( | wavelength, | |
flux, | |||
flavor | |||
) |
This function accepts a flux density, surface brightness, spectral radiance, or spectral luminosity (generically called "flux" for the purposes of this function), converts this flux from an arbitrary unit in any "flavor" (neutral, per wavelength, per frequency, or per energy) to an equivalent unit in the specified flavor, and returns the result.
Both the wavelength and the flux must be astropy quantities in one of the following shape combinations:
The target flavor can be specified in one of two ways:
def pts.simulation.units.hasReverseWavelengthOrder | ( | unitlike | ) |
This function returns True if the units represented by the "unit-like" input are those for frequency (
The input argument is interpreted as described for the unit() function in this module.
def pts.simulation.units.latexForSpectralFlux | ( | unitlike | ) |
This function returns a latex-formatted string representation for a flux density (
The input argument is interpreted as described for the unit() function in this module. If no match is found, the function returns an empty string.
def pts.simulation.units.latexForSpectralFluxWithUnit | ( | unitlike | ) |
This function returns the result of latexForSpectralFlux() + latexForUnit() with the same argument.
def pts.simulation.units.latexForSpectralLuminosity | ( | unitlike | ) |
This function returns a latex-formatted string representation for the spectral luminosity (
The input argument is interpreted as described for the unit() function in this module. If no match is found, the function returns an empty string.
def pts.simulation.units.latexForSpectralLuminosityWithUnit | ( | unitlike | ) |
This function returns the result of latexForSpectralLuminosity() + latexForUnit() with the same argument.
def pts.simulation.units.latexForSpectralRadiance | ( | unitlike | ) |
This function returns a latex-formatted string representation for the mean intensity or spectral radiance (
The input argument is interpreted as described for the unit() function in this module. If no match is found, the function returns an empty string.
def pts.simulation.units.latexForSpectralRadianceWithUnit | ( | unitlike | ) |
This function returns the result of latexForSpectralRadiance() + latexForUnit() with the same argument.
def pts.simulation.units.latexForUnit | ( | unitlike | ) |
This function returns a latex-formatted string representation for the "unit-like" input, enclosed in square brackets and preceded by a short space.
The input argument is interpreted as described for the unit() function in this module.
def pts.simulation.units.latexForWavelength | ( | unitlike | ) |
This function returns a latex-formatted string representation for wavelength (
The input argument is interpreted as described for the unit() function in this module. If no match is found, the function returns an empty string.
def pts.simulation.units.latexForWavelengthWithUnit | ( | unitlike | ) |
This function returns the result of latexForWavelength() + latexForUnit() with the same argument.
def pts.simulation.units.unit | ( | unitlike | ) |
This function returns an astropy unit for any of the following "unit-like" inputs:
While the function is mainly intended for converting SKIRT units to astropy units, supporting the other input types is useful when the function is invoked directly or indirectly from some other context.