Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

astropy.modeling.models has no Planck function #170

Closed
ibusko opened this issue Feb 29, 2016 · 8 comments
Closed

astropy.modeling.models has no Planck function #170

ibusko opened this issue Feb 29, 2016 · 8 comments

Comments

@ibusko
Copy link
Contributor

ibusko commented Feb 29, 2016

That seems to me a pretty basic model for spectra fitting. Should we formally post a request in astropy? Or develop our own?

@pllim
Copy link
Contributor

pllim commented Feb 29, 2016

There is one. I added it to astropy. It just is not in modeling because that function is highly depended on units and modeling cannot handle Quantity yet. See http://docs.astropy.org/en/stable/analytic_functions/index.html#using-astropy-analytic-functions

I hacked together a Blackbody model for pysynphot a while back but that project is on hold.

@ibusko
Copy link
Contributor Author

ibusko commented Feb 29, 2016

So, should we add it to specviz's list? Or the units dependency may create new issues that we won't be able to deal before the release?

@pllim
Copy link
Contributor

pllim commented Feb 29, 2016

@ibusko
Copy link
Contributor Author

ibusko commented Feb 29, 2016

The blackbody_lambda and blackbody_nu models are in fact functions, as suggested by the example. Is that right? If so, in order to be usable in specviz, they should instead subclass Fittable1DModel In that case, they can be used as the core of a model class that we will have to develop ourselves.

@nmearl
Copy link
Collaborator

nmearl commented Feb 29, 2016

A basic custom one should be straightforward

from astropy.modeling.models import custom_model
from astropy.units import Quantity
from astropy.analytic_functions import blackbody_lambda

@custom_model
def blackbody(wavelength, temperature):
    wavelength = Quantity(wavelength, "Angstrom")
    temperature = Quantity(temperature, "K")
    return blackbody_lambda(wavelength, temperature).value

@pllim
Copy link
Contributor

pllim commented Feb 29, 2016

If you can make it work, go for it. The only thing that stopped me was lack of unit support in modeling machinery. And as I understood from astropy/astropy#4615, the fitting itself would not support units internally. So, whatever you put together now will break when that PR is merged.

@pllim pllim modified the milestone: Future Mar 1, 2016
@ibusko
Copy link
Contributor Author

ibusko commented Apr 11, 2016

Implemented Blackbody model. Hence, this ticket can be closed.

@ibusko ibusko closed this as completed Apr 11, 2016
@cheekujodhpur
Copy link

@ibusko Where is this model implemented? I do not see it in the latest code.

What am I doing wrong?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants