-
Notifications
You must be signed in to change notification settings - Fork 171
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
extract1d for IFU data version 2- JP 1736 #5506
extract1d for IFU data version 2- JP 1736 #5506
Conversation
…rrison/jwst into jemorrison-extract1d_datamodel_JP_1736_v2 Problem with branch conflicts
Codecov Report
@@ Coverage Diff @@
## master #5506 +/- ##
==========================================
- Coverage 74.41% 71.21% -3.20%
==========================================
Files 417 415 -2
Lines 38115 41147 +3032
Branches 5636 5891 +255
==========================================
+ Hits 28362 29303 +941
- Misses 9753 11001 +1248
- Partials 0 843 +843
*This pull request uses carry forward flags. Click here to find out more.
Continue to review full report at Codecov.
|
@jemorrison This is meant to be a copy of PR-5383, but it looks like they each have different numbers of files changed? (14 here, 23 there) E.g., PR-5383 modified CHANGES.rst but this PR-5506 does not? Trying to figure out the best way to compare the relevant code between these two PRs, and if it's best to just check out this new PR and rerun my various tests again. |
________________________________
From: David Law <[email protected]>
Sent: Wednesday, December 2, 2020 3:36 PM
To: spacetelescope/jwst <[email protected]>
Cc: Jane Morrison <[email protected]>; Mention <[email protected]>
Subject: [EXT]Re: [spacetelescope/jwst] extract1d for IFU data version 2- JP 1736 (#5506)
External Email
External Email
@jemorrison<https://github.com/jemorrison> This is meant to be a copy of PR-5383, but it looks like they each have different numbers of files changed? (14 here, 23 there) E.g., PR-5383 modified CHANGES.rst but this PR-5506 does not?
Trying to figure out the best way to compare the relevant code between these two PRs, and if it's best to just check out this new PR and rerun my various tests again.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#5506 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AENCOWOEOCB44PGEBD7IP7TSS26PHANCNFSM4ULCZA7Q>.
|
Yes I just do not understand why the old PR had files changes related to associations. I did not touch code related to associations. I must of created the branch in a non-standard way. I just wanted the PR to include the extract1d changes. I think this is a clean pr how. I need to update the change log and I will do that and push that change over. |
Ok, I think I see now. I will see if it's possible to check everything just by comparing the line-by-line diffs for the non-association related files rather than by rerunning various simulations/tests. |
What are all of the warnings (e.g., Added lines #L399 - L400 were not covered by tests) in apply_apcorr.py in the diff file about? They make it hard to scan the actual diffs as they break up the page so much. |
@drlaw1558 I think the warnings are that I have added code but I do not have a unit test that tests these new lines. |
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.
Wow, this represents a LOT of work! Just a few comments and questions here and there. Can't really properly review the actual new functionality for IFU data, since I'm not completely sure how it's supposed to work.
jwst/datamodels/__init__.py
Outdated
@@ -21,6 +21,7 @@ | |||
from .drizpars import DrizParsModel | |||
from .drizproduct import DrizProductModel | |||
from .extract1dimage import Extract1dImageModel | |||
from .extract1d_spec import IFUExtract1dModel |
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 suppose it would throw a big wrench into things at this late stage to rename this new model class to Extract1dIFUModel
just for consistency in naming with the existing Extract1dImageModel
? If so, it's not a big deal.
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.
That is fine I can change the names of models to be more consistent
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.
changed
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.
Ok, I think that means I'll have to change some things about my generation code as well. Are the 'datamodl' keywords still meant to be MirMrsExtract1dModel and MirMrsApcorrModel ? If so I should only need to change the names of the schema files.
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.
Yes @drlaw1558 that does imply that the actual class name of the data model used for the extract1d reference file will be changing from IFUExtract1dModel
to Extract1dIFUModel
. That's only for the extract1d reference file model. The apcorr ref files models remain unchanged. I don't see MirMrsExtract1dModel
referenced anywhere, or am I just missing it?
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.
Hm, it looks like this was the name Jane used in creating a test asdf file back in October; maybe that's now been superseded by MirMrsExtract1dModel -> IFUExtract1dModel -> Extract1dIFUModel. In this case I'll need to change both my code and the reference file to make sure the data model keyword is up to date.
It doesn't look like the update has been made in the schema for this branch yet though? @jemorrison your comment above said that it had been changed, but the relevant branch still seems to have the old names?
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 just pushed over the new code. It is Extract1DIFUModel now.
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.
Ok, I see it. If we're now using schemas/extract1difu.schema.yaml should we remove the old schemas/mirmrs_extract1d.schema.yaml ?
@@ -0,0 +1,48 @@ | |||
%YAML 1.1 |
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.
Again in terms of file naming consistency, could this new schema file be renamed to extract1difu.schema.yaml
, in keeping with the existing extract1dimage.schema.yaml
file?
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.
changed
type: string | ||
wavelength: | ||
datatype: float32 |
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.
Why are some data type attributes named type
while others are datatype
? Does it make a difference? My inner hob goblin of foolish consistency suggests having them all the same.
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.
It was trial and error to get this to work. This worked that is all I know
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.
So from trial and error I have found that when I create the asdf reference files, write them to disk and then read them in
using asdf.open and test them using asdf validate - all values that are strings that are called datatype in the schema fail in the validate. The error message says they are not arrays. So I am guessing that 'datatype' is for arrays and 'type' is for single values.
datatype: float32 | ||
apcorr_err: | ||
datatype: float32 | ||
apcorr_table_f070lp_g140h: |
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 know it'd be a huge pain to do at this late stage of the development, but having cal data for all the filter+grating combinations in a single ref file forces the pipeline to do the selection of the proper data, while having them split into separate ref files would put the selection in CRDS, which is what it was built for.
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.
So at one point we thought about pulling out filter/grating and having a different reference file for each. We ended up just leaving it in the code mainly because I was not sure how CRDS would handle the cases of multiple bands, channels, gratings or filters. After testing I think 'MULTIPLE' is set if that is the case - so we can go ahead and break then up into separate reference files. NOTHING has been loaded into CRDS.
|
||
def apply(self, spec_table: fits.FITS_rec): |
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.
Now that the apcorr ref files have been migrated to ASDF format, does the fits.FITS_rec
still work properly? Or is the spec_table
object the spectral data that've already been extracted and are still stored as a FITS 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.
the spec_table is still stored as a FITS table.
jwst/extract_1d/extract.py
Outdated
@@ -115,13 +116,23 @@ def open_extract1d_ref(refname: str) -> dict: | |||
If the extract1d reference file is in JSON format, ref_dict will be the | |||
dictionary returned by json.load(), except that the file type | |||
('JSON') will also be included with key 'ref_file_type'. | |||
If the extract1d reference file is in asdf format, the ref_dict will | |||
be a containing two keys: ref_dict['ref_file_type'] = 'ASDF' |
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 like a typo here: "will be a containing two ..." will be a what?
jwst/extract_1d/extract.py
Outdated
if refname == "N/A": | ||
ref_dict = None | ||
elif exptype == 'MIR_MRS' or exptype == 'NRS_IFU': |
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.
Doesn't affect functionality, but you could condense this to:
elif exptype in ['MIR_MRS', 'NRS_IFU']:
@@ -5,12 +5,12 @@ | |||
from astropy.io import fits | |||
from astropy.table import Table | |||
|
|||
from jwst.datamodels import JwstDataModel | |||
from jwst.extract_1d.apply_apcorr import ApCorr, ApCorrRadial, ApCorrPhase, select_apcorr | |||
from jwst.datamodels import DataModel |
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.
Hmmm, this might need to be JwstDataModel
, because I think DataModel
went away with the migration to using the new stdatamodels
package. Need to confirm.
@@ -35,7 +33,7 @@ def inputs(request): | |||
|
|||
instrument, exptype = request.param | |||
|
|||
dm = JwstDataModel() | |||
dm = DataModel() |
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.
Same comment here about JwstDataModel
…ne per grating/band
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 to me. I recreated new reference files using the updated schema names, and reran some of my tests just to make sure.
flake8 issues need fixing before we merge |
Fix flake8 whitespace issues.
This is just a copy of #5383. Somehow that PR got confused on my system and I could not resolve conflicts.
This is just a clean copy.
Fixes JP-1615
Fixes JP-1633
Fixes JP-1730