Use Astropy API to create a Fittable1DModel
mchalela opened this issue · comments
Martin Chalela commented
Change custom_model
to Fittable1DModel
to allow parallelization.
Lines 46 to 77 in 76d8591
@custom_model | |
def normalized_blackbody(nu, T=None): | |
"""Normalize blackbody model. | |
The equation for calculating the blackbody model is the same as in | |
the Astropy blackbody model except that the "scale" parameter is | |
eliminated, i.e. is allways equal to 1. | |
The normalization is performed by dividing the blackbody flux by its | |
numerical mean. | |
Parameters | |
---------- | |
nu: SpectralAxis object | |
Frequency axis in units of Hz. | |
T: float, default is None | |
Temperature of the blackbody. | |
Returns | |
------- | |
out: normalized blackbody model. | |
""" | |
cv = c.value | |
kv = k_B.value | |
hv = h.value | |
bb = 2 * hv * nu ** 3 / (cv ** 2 * (np.exp(hv * nu / (kv * T)) - 1)) | |
mean = np.mean(bb) | |
return bb / mean |