-
Notifications
You must be signed in to change notification settings - Fork 28
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
Rcal 406 science array quantities #616
Merged
PaulHuwe
merged 22 commits into
spacetelescope:main
from
PaulHuwe:RCAL-406_ScienceArrayQuantities
Jan 31, 2023
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
d4349c8
Rough test of array quanitties.
PaulHuwe 0af0a45
Changed Quantity object instantiation in order to preserve datatype.
PaulHuwe 89ba28b
Saving for rebase.
PaulHuwe 75d1d95
Merge branch 'main' of https://github.com/spacetelescope/romancal int…
PaulHuwe f4a663a
Updates unit tests.
PaulHuwe d4dfd2d
Code clean up.
PaulHuwe 3ede27a
Updated Changelog.
PaulHuwe c47288c
Corrected some array dtypes for quantities.
PaulHuwe a6de70c
Updated tests for units.
PaulHuwe c8ae852
Temporarilly pointing to PR of RDM.
PaulHuwe 0fea09b
Code cleanup.
PaulHuwe 2c59414
Rebase.
PaulHuwe f6c8140
Temporarilly redirected RDM link.
PaulHuwe f9b44bc
Updated Changelog.
PaulHuwe cd10324
Updated asdf dependency to match RDM.
PaulHuwe 9744fc5
Pointed RDM dependency to main.
PaulHuwe b6d8d64
Rebased
PaulHuwe a80a56e
Rebased
PaulHuwe 8d6a135
Updated changelog.
PaulHuwe 0b53ad8
Rebasing
PaulHuwe 6be7840
Tweaked for merging with RCAL-440
PaulHuwe e6f9747
Addressed PR Comments.
PaulHuwe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,15 +44,15 @@ def create_optional_results_model(input_model, opt_info): | |
crmag.dtype = np.float32 | ||
|
||
inst = {'meta': meta, | ||
'slope': np.squeeze(slope), | ||
'sigslope': np.squeeze(sigslope), | ||
'var_poisson': np.squeeze(var_poisson), | ||
'var_rnoise': np.squeeze(var_rnoise), | ||
'yint': np.squeeze(yint), | ||
'sigyint': np.squeeze(sigyint), | ||
'pedestal': np.squeeze(pedestal), | ||
'slope': u.Quantity(np.squeeze(slope), ru.electron / u.s, dtype=slope.dtype), | ||
'sigslope': u.Quantity(np.squeeze(sigslope), ru.electron / u.s, dtype=sigslope.dtype), | ||
'var_poisson': u.Quantity(np.squeeze(var_poisson), ru.electron**2 / u.s**2, dtype=var_poisson.dtype), | ||
'var_rnoise': u.Quantity(np.squeeze(var_rnoise), ru.electron**2 / u.s**2, dtype=var_rnoise.dtype), | ||
'yint': u.Quantity(np.squeeze(yint), ru.electron, dtype=yint.dtype), | ||
'sigyint': u.Quantity(np.squeeze(sigyint), ru.electron, dtype=sigyint.dtype), | ||
'pedestal': u.Quantity(np.squeeze(pedestal), ru.electron, dtype=pedestal.dtype), | ||
'weights': np.squeeze(weights), | ||
'crmag': crmag | ||
'crmag': u.Quantity(crmag, ru.electron, dtype=pedestal.dtype), | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we added these units back at the opt_info stage instead of here, we wouldn't need to repeat adding these units in create_image_model? |
||
|
||
out_node = rds.RampFitOutput(inst) | ||
|
@@ -82,6 +82,11 @@ def create_image_model(input_model, image_info): | |
""" | ||
data, dq, var_poisson, var_rnoise, err = image_info | ||
|
||
data = u.Quantity(data, ru.electron / u.s, dtype=data.dtype) | ||
var_poisson = u.Quantity(var_poisson, ru.electron**2 / u.s**2, dtype=var_poisson.dtype) | ||
var_rnoise = u.Quantity(var_rnoise, ru.electron**2 / u.s**2, dtype=var_rnoise.dtype) | ||
err = u.Quantity(err, ru.electron / u.s, dtype=err.dtype) | ||
|
||
# Create output datamodel | ||
# ... and add all keys from input | ||
meta = {} | ||
|
@@ -144,7 +149,6 @@ def process(self, input): | |
readnoise_filename = self.get_reference_file(input_model, 'readnoise') | ||
gain_filename = self.get_reference_file(input_model, 'gain') | ||
input_model.data = input_model.data[np.newaxis, :] | ||
input_model.data.dtype=np.float32 | ||
input_model.groupdq = input_model.groupdq[np.newaxis, :] | ||
input_model.err = input_model.err[np.newaxis, :] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Staring at this; does it make more sense to add these units onto out_data in process(...) following the do_correction call? Harping on my usual imagination that our ideal model should be: units everywhere, except around the calls to stcal, where there's a step beforehand removing units and afterward adding them back?