BlackBody bolometric flux is wrong if scale has units of dimensionless_unscaled
See original GitHub issueThe astropy.modeling.models.BlackBody
class has the wrong bolometric flux if scale
argument is passed as a Quantity with dimensionless_unscaled
units, but the correct bolometric flux if scale
is simply a float.
Description
Expected behavior
Expected output from sample code:
4.823870774433646e-16 erg / (cm2 s)
4.823870774433646e-16 erg / (cm2 s)
Actual behavior
Actual output from sample code:
4.5930032795393893e+33 erg / (cm2 s)
4.823870774433646e-16 erg / (cm2 s)
Steps to Reproduce
Sample code:
from astropy.modeling.models import BlackBody
from astropy import units as u
import numpy as np
T = 3000 * u.K
r = 1e14 * u.cm
DL = 100 * u.Mpc
scale = np.pi * (r / DL)**2
print(BlackBody(temperature=T, scale=scale).bolometric_flux)
print(BlackBody(temperature=T, scale=scale.to_value(u.dimensionless_unscaled)).bolometric_flux)
System Details
>>> import numpy; print("Numpy", numpy.__version__)
Numpy 1.20.2
>>> import astropy; print("astropy", astropy.__version__)
astropy 4.3.dev758+g1ed1d945a
>>> import scipy; print("Scipy", scipy.__version__)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'scipy'
>>> import matplotlib; print("Matplotlib", matplotlib.__version__)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'matplotlib'
Issue Analytics
- State:
- Created 2 years ago
- Comments:34 (34 by maintainers)
Top Results From Across the Web
Source code for astropy.modeling.physical_models
If no units are given, this defaults to Hz (or AA if `scale` was initialized ... k_B * temp) boltzm1 = np.expm1(log_boltz) #...
Read more >Astronomy Lecture Number 2
An ideal body that absorbs all wavelengths of electromagnetic radiation is called a blackbody. Such an ideal body has a spectrum that shows...
Read more >Theoretical quantities: blackbody radiation
So, if we could measure the flux from a star, and we knew its distance, and we assume it emits radiation isotropically, we...
Read more >phy217 - instruments - photometers - magnitudes and fluxes
The former is a logarithmic brightness scale, whereas the latter is a linear ... This collected quantity is known as the flux, F,...
Read more >Solution Set 1 by Roger O'Brient and Eugene Chiang
Then divide the luminosity by dA to calculate the total flux (in units of energy/time/area) emitted by the patch. You should recover the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Can’t be worse than the episode when we deprecated
clobber
inio.fits
… 😅synphot
never used the new blackbody stuff here, so I think it can be safely left out of the changes here. If you feel strongly about its model names, feel free to open issue at https://github.com/spacetelescope/synphot_refactor/issues but I don’t think it will affect anything atastropy
or vice versa. 😅