-
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
Hackday mteodoro sky variance readnoise #1556
base: main
Are you sure you want to change the base?
Hackday mteodoro sky variance readnoise #1556
Conversation
ee3f001
to
2d8b4fe
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1556 +/- ##
==========================================
+ Coverage 77.94% 77.98% +0.04%
==========================================
Files 115 115
Lines 7622 7641 +19
==========================================
+ Hits 5941 5959 +18
- Misses 1681 1682 +1 ☔ View full report in Codecov by Sentry. |
37cf8b1
to
2448932
Compare
60b0642
to
d8dddf9
Compare
I follow the addition of the new weight type but I'm not sure I see the connection between the ticket and resampling each computed If the goal is to save |
If `weight_type=ivsky`, the scaling value will be determined per-pixel | ||
using the inverse of the sky variance (VAR_SKY) array calculated in the | ||
resample step for each input image. If the VAR_SKY array does | ||
not exist, the weight is set to 1 for all pixels (equal weighting). |
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.
Would you add a description here of how var_sky
is computed?
@@ -112,7 +113,7 @@ def build_driz_weight( | |||
model : object | |||
The input model. | |||
weight_type : str, optional | |||
The type of weight to use. Allowed values are 'ivm' or 'exptime'. | |||
The type of weight to use. Allowed values are 'ivm', 'exptime', or 'ivsky'. |
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.
Would you update the step spec to support the new weight type?
weight_type = option('ivm', 'exptime', None, default='ivm') # change back to None when drizpar ref update |
warnings.warn( | ||
"var_rnoise and var_poisson arrays are not available. Setting drizzle weight map to 1" | ||
) | ||
result = inv_sky_variance * dqmask |
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 think this will crash if model
doesn't have var_sky
since inv_sky_variance
is defined in the if on line 174 but not within the else block. How about adding something like inv_sky_variance = np.ones_like(...)
to the else block.
Adding a unit test for that condition would check if the above suggestion works.
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.
Nice catch! Thanks!
I completely forgot to add the default inv_sky_variance
array.
input_models = ( | ||
input_models | ||
if isinstance(input_models, ModelLibrary) | ||
else ModelLibrary([input_models]) | ||
) |
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.
input_models = ( | |
input_models | |
if isinstance(input_models, ModelLibrary) | |
else ModelLibrary([input_models]) | |
) | |
input_models = ( | |
input_models | |
if isinstance(input_models, ModelLibrary) | |
else ModelLibrary([input_models]) | |
) |
If the function only accepts a ModelLibrary
(based on the type annotation) then is this necessary?
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.
No, it is not.
Initially, the method was supposed to handle both ModelLibrary
and single datamodels, but eventually I thought that it would be better to sticking with the former only.
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 think this looks conceptually right; thanks! Can you put a couple of example files on /grp/roman somewhere, together with an invocation (run strun roman::resample blah.asn --weight_type skyivm ??) so that I can easily poke at some example input and output files?
Yes, that's the idea. |
for more information, see https://pre-commit.ci
192c1cb
to
65f7acd
Compare
Resolves RCAL-968
This PR adds a sky variance array to the mosaic file created by resample (i.e.
model.var_sky
). It also enables building a drizzle image weighted by the inverse of the sky variance when running resample withweight_type="ivsky"
.Regression test
var_sky
added to the model.Tasks
24Q4_B15
(use the latest build if not sure)no-changelog-entry-needed
)changes/
:echo "changed something" > changes/<PR#>.<changetype>.rst
(see below for change types)docs/
pageokify_regtests
to update the truth filesnews fragment change types...
changes/<PR#>.general.rst
: infrastructure or miscellaneous changechanges/<PR#>.docs.rst
changes/<PR#>.stpipe.rst
changes/<PR#>.associations.rst
changes/<PR#>.scripts.rst
changes/<PR#>.mosaic_pipeline.rst
changes/<PR#>.patch_match.rst
steps
changes/<PR#>.dq_init.rst
changes/<PR#>.saturation.rst
changes/<PR#>.refpix.rst
changes/<PR#>.linearity.rst
changes/<PR#>.dark_current.rst
changes/<PR#>.jump_detection.rst
changes/<PR#>.ramp_fitting.rst
changes/<PR#>.assign_wcs.rst
changes/<PR#>.flatfield.rst
changes/<PR#>.photom.rst
changes/<PR#>.flux.rst
changes/<PR#>.source_detection.rst
changes/<PR#>.tweakreg.rst
changes/<PR#>.skymatch.rst
changes/<PR#>.outlier_detection.rst
changes/<PR#>.resample.rst
changes/<PR#>.source_catalog.rst