-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Standardize units (extended) #284
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Let's save the docstring stuff for another PR. I'd like to merge this one first, then can try for #283 and fix conflicts.
pahfit/features/features.py
Outdated
The value and bounds as a 3 element tuple (value, min, max). | ||
Any missing bound is replaced with the numpy `masked' value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These doc changes seem out of bounds here. And this last one is not true. Any missing value is replaced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I can rebase and drop the "docstring improvements" commit (35944ee)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use magit
this is the perfect opportunity for branch
spin-out
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds interesting, but I love the interactive rebase interface of magit too ;). Rebased branch has been pushed.
pahfit/features/features.py
Outdated
|
||
Note that each parameter has an associated `kind', and that each | ||
kind has an associated set of allowable parameters (see | ||
`KIND_PARAMS`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing close )
pahfit/features/features.py
Outdated
If reading a YAML file, read it in as a science pack and | ||
return the new table. Otherwise, use astropy's normal Table | ||
Parameters | ||
---------- | ||
|
||
file : str | ||
The name of the file to read, either a full valid path, | ||
or named file in the PAHFIT science_packs directory. | ||
|
||
Returns | ||
------- | ||
table : Features | ||
A filled `~pahfit.features.Features` table. | ||
|
||
Notes | ||
----- | ||
If reading a YAML file, reads it in as a science pack and | ||
return the new table. Otherwise, uses astropy's normal Table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's set aside all the docstring improvements to increase the chance that #283 and this one merge cleanly. Can do those in a subsequent PR.
if kind == "_ratios": | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is my first foray into tied parameters. I suppose we can leave it in as harmless for now.
The unit of the input spectrum has to be a multiple of MJy / sr, | ||
the internal intensity unit. The output of this function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to allow flux units at some point. FYI, I haven't really looked much through Model
, so don't get too wedded to any particular aspects.
pahfit/model.py
Outdated
""" | ||
if not spec.flux.unit.is_equivalent(units.intensity): | ||
raise PAHFITModelError("PAHFIT only supports intensity units, i.e. convertible to MJy / sr.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now ;)
I do realize now that a lot of our test spectra are loaded in Jy units... So all the test are failing there because of my new MJy / sr requirement. I will try to adjust the read_spectrum function so that it converts the example spectra. |
I guess the issue of dual support for flux or intensity units is that you ought to be able to apply a model to any spectrum? And that the spectrum "arrives late" on use. One idea is to have the units for |
I have pushed a temporary fix to Once the power-based features are implemented, I will have a better grip on how to design this. Somehow, the power-based feature classes will need to be configurable for both units. The unit type can definitely be an option at the initialization of Model, just like other keywords e.g. to choose the fitter backend. These keywords can then be passed to configure Fitter in the right way, so that it can determine how to set up the power-based components (in practice, this will come down to setting a few scaling factors for the evaluation function). |
Switched this to target |
The tests work on my machine with astropy==6.0.1, but I found that astropy 6.1.0 causes an issue with using So I think we're good to go here. |
OK merged. We do need to get all our |
This includes the exact same commits as #259 , but adds a few extra changes
units.intensity
or MJy / sr. After the "power gaussian" and "power drude" have been implemented, we will switch this tounits.intensity_power