Converting cgs to 'custom' units in Astropy

268 Views Asked by At

I have the following

from astropy import units as u
from astropy.modeling.models import BlackBody

bb = BlackBody(temperature=303.15*u.K)
wav = np.arange(1.0, 50.0) * u.micron
flux = bb(wav)

where flux has units:

 erg / (cm2 Hz s sr)

I'd like to convert these to:

 W / (m2 sr Hz)

but simply doing

flux.si 

gives flux but with 10^-3 values and units of kg / (rad2 s2).

1

There are 1 best solutions below

0
npross On
flux.to(u.W/u.m**2/u.steradian/u.Hz)

seems to do the trick nicely.