[AstroPy] blackbody_lambda

Derek Homeier derek at astro.physik.uni-goettingen.de
Sat Sep 11 12:27:15 EDT 2021


Holà,

> On 10 Sep 2021, at 1:41 pm, eperez <eperez at iaa.es> wrote:
> 
> I am not able to reproduce these two lines of code, where i am interested in the BB in Flux_lambda units:
> 
>  from astropy.analytic_functions import blackbody_lambda
>  flux_lam = blackbody_lambda(wv*u.AA, temperature*u.K)
> 
> I understand that astropy.analytic_functions is no longer available, but i cannot find the equivalent blackbody_lambda in the current: from astropy.modeling.models import BlackBody

there is no longer a specific function for B_lamba; with the new model class you can
either transform the default return in B_nu as

from astropy.units.equivalencies import spectral_density
bnu_of_t = BlackBody(temperature*u.K)
flux_lam = bb_of_t(wv*u.AA).to('erg / (cm2 AA s sr)', equivalencies=spectral_density(wv*u.AA))

or directly set up the model to return B_lambda:
blam_of_t = BlackBody(temperature*u.K, scale=1*u.Unit('W / (m2 nm sr)'))

– see
https://docs.astropy.org/en/v4.1/modeling/blackbody_deprecated.html#blackbody-functions-deprecated

Cheers,
				Derek



More information about the AstroPy mailing list