-
Notifications
You must be signed in to change notification settings - Fork 0
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
corrections to the pr to the pr to the pr #10
Conversation
@@ -169,7 +173,8 @@ def _parse_image(app, file_obj, data_label, ext=None): | |||
# for outside_*_bounding_box should also be updated. | |||
data.coords._orig_bounding_box = data.coords.bounding_box | |||
data.coords.bounding_box = None | |||
data_label = app.return_data_label(data_label, alt_name="image_data") | |||
if not data.meta.get(wcs_only_key, False): | |||
data_label = app.return_data_label(data_label, alt_name="image_data") |
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.
Without this correction, the data label still gets appended with "DATA".
arr = ndd.data | ||
data = Data(label=data_label) | ||
data.meta.update(standardize_metadata(ndd.meta)) | ||
data.coords = ndd.wcs | ||
component = Component.autotyped(arr, units="") | ||
data.add_component(component=component, label="DATA") | ||
return data | ||
yield (data, data_label) |
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.
This needs to be a generator.
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 didn't think it would be inside the parser, but now that it is, yes, it has to be a generator.
Also maybe rename to _wcsonly_to_glue_data
to be consistent with other generator functions.
if file_obj.meta.get(wcs_only_key, False): | ||
data_iter = _wcsonly2data(file_obj, data_label) | ||
else: | ||
data_iter = _nddata_to_glue_data(file_obj, data_label) |
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.
Your PR never actually used _wcsonly2data
, so I invoke it here.
@@ -26,6 +26,7 @@ | |||
|
|||
INFO_MSG = ("The file contains more viewable extensions. Add the '[*]' suffix" | |||
" to the file name to load all of them.") | |||
wcs_only_key = "_WCS_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.
Can we use the app attribute instead of re-defining it here?
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.
Done.
@@ -169,7 +173,8 @@ def _parse_image(app, file_obj, data_label, ext=None): | |||
# for outside_*_bounding_box should also be updated. | |||
data.coords._orig_bounding_box = data.coords.bounding_box | |||
data.coords.bounding_box = None | |||
data_label = app.return_data_label(data_label, alt_name="image_data") | |||
if not data.meta.get(wcs_only_key, False): |
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.
Should we use the layer_is_wcs_only
check here?
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 could but it's the same check?
@@ -407,11 +412,11 @@ def _ndarray_to_glue_data(arr, data_label): | |||
# ---- Functions that handle WCS-only data ----- | |||
|
|||
def _wcsonly2data(ndd, data_label): | |||
"""Return Data given NDData containly WCS-only data.""" | |||
"""Return Data given NDData containing WCS-only data.""" |
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.
Haha! What was I thinking?
@@ -383,7 +383,7 @@ def _prepare_rotated_nddata(real_image_shape, wcs, rotation_angle, refdata_shape | |||
# create a fake NDData (we use arange so data boundaries show up in Imviz | |||
# if it ever is accidentally exposed) with the rotated GWCS: | |||
ndd = NDData( | |||
data=np.arange(sum(refdata_shape), dtype=np.int8).reshape(refdata_shape), | |||
data=np.arange(np.prod(refdata_shape), dtype=np.int8).reshape(refdata_shape), |
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.
Hmm does plain sum
not work for you? The shape should be a plain tuple if ints.
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 shape is (10, 10), sum is 20. We want the product (100).
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.
Oh, right... I didn't catch that with (2, 2)
. Doh!
@@ -383,7 +383,7 @@ def _prepare_rotated_nddata(real_image_shape, wcs, rotation_angle, refdata_shape | |||
# create a fake NDData (we use arange so data boundaries show up in Imviz | |||
# if it ever is accidentally exposed) with the rotated GWCS: | |||
ndd = NDData( | |||
data=np.arange(sum(refdata_shape), dtype=np.int8).reshape(refdata_shape), | |||
data=np.arange(np.prod(refdata_shape), dtype=np.int8).reshape(refdata_shape), |
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.
Oh, right... I didn't catch that with (2, 2)
. Doh!
Co-authored-by: P. L. Lim <[email protected]>
Co-authored-by: P. L. Lim <[email protected]>
Thanks! I'll merge this and then clean up my PR to your PR. Hang in there! |
#4) * Lim edits * Improve verbiage in docstring Co-authored-by: Brett M. Morris <[email protected]> * Address review comments from bmorris3 * Add multi WCS-only test back * Update concept notebook * corrections to the pr to the pr to the pr (#10) * corrections to the pr to the pr to the pr * using app-level attr * Update jdaviz/configs/imviz/plugins/parsers.py Co-authored-by: P. L. Lim <[email protected]> * Update jdaviz/configs/imviz/plugins/parsers.py Co-authored-by: P. L. Lim <[email protected]> --------- Co-authored-by: P. L. Lim <[email protected]> * Follow up to PR to my PR to your PR * WCS-only must be loaded into viewer but not visible. Fix concept notebook --------- Co-authored-by: Brett M. Morris <[email protected]>
#4) * Lim edits * Improve verbiage in docstring Co-authored-by: Brett M. Morris <[email protected]> * Address review comments from bmorris3 * Add multi WCS-only test back * Update concept notebook * corrections to the pr to the pr to the pr (#10) * corrections to the pr to the pr to the pr * using app-level attr * Update jdaviz/configs/imviz/plugins/parsers.py Co-authored-by: P. L. Lim <[email protected]> * Update jdaviz/configs/imviz/plugins/parsers.py Co-authored-by: P. L. Lim <[email protected]> --------- Co-authored-by: P. L. Lim <[email protected]> * Follow up to PR to my PR to your PR * WCS-only must be loaded into viewer but not visible. Fix concept notebook --------- Co-authored-by: Brett M. Morris <[email protected]>
#4) * Lim edits * Improve verbiage in docstring Co-authored-by: Brett M. Morris <[email protected]> * Address review comments from bmorris3 * Add multi WCS-only test back * Update concept notebook * corrections to the pr to the pr to the pr (#10) * corrections to the pr to the pr to the pr * using app-level attr * Update jdaviz/configs/imviz/plugins/parsers.py Co-authored-by: P. L. Lim <[email protected]> * Update jdaviz/configs/imviz/plugins/parsers.py Co-authored-by: P. L. Lim <[email protected]> --------- Co-authored-by: P. L. Lim <[email protected]> * Follow up to PR to my PR to your PR * WCS-only must be loaded into viewer but not visible. Fix concept notebook --------- Co-authored-by: Brett M. Morris <[email protected]>
#4) * Lim edits * Improve verbiage in docstring Co-authored-by: Brett M. Morris <[email protected]> * Address review comments from bmorris3 * Add multi WCS-only test back * Update concept notebook * corrections to the pr to the pr to the pr (#10) * corrections to the pr to the pr to the pr * using app-level attr * Update jdaviz/configs/imviz/plugins/parsers.py Co-authored-by: P. L. Lim <[email protected]> * Update jdaviz/configs/imviz/plugins/parsers.py Co-authored-by: P. L. Lim <[email protected]> --------- Co-authored-by: P. L. Lim <[email protected]> * Follow up to PR to my PR to your PR * WCS-only must be loaded into viewer but not visible. Fix concept notebook --------- Co-authored-by: Brett M. Morris <[email protected]>
#4) * Lim edits * Improve verbiage in docstring Co-authored-by: Brett M. Morris <[email protected]> * Address review comments from bmorris3 * Add multi WCS-only test back * Update concept notebook * corrections to the pr to the pr to the pr (#10) * corrections to the pr to the pr to the pr * using app-level attr * Update jdaviz/configs/imviz/plugins/parsers.py Co-authored-by: P. L. Lim <[email protected]> * Update jdaviz/configs/imviz/plugins/parsers.py Co-authored-by: P. L. Lim <[email protected]> --------- Co-authored-by: P. L. Lim <[email protected]> * Follow up to PR to my PR to your PR * WCS-only must be loaded into viewer but not visible. Fix concept notebook --------- Co-authored-by: Brett M. Morris <[email protected]>
PR inception continues. Corrections for bmorris3#4 (for spacetelescope#2179).