-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
[EXP] Example notebook to load large 4D cube #110
Conversation
What happens when you try to load a slice from a command line python session. i.e. Just navigate to the slice and then use numpy style slicing on the slice. Something like data_2d = (extract 2D slice)
ht, wd = data_2d.shape
res = data_2d[0:ht:10, 0:wd:10] Does this also take a lot of time? |
This comment has been minimized.
This comment has been minimized.
@ejeschke , I tracked this down to the transpose operation, which is out of scope for Ginga. I have a detailed write-up at ejeschke/ginga#805 (comment) . Sorry for the noise! |
"source": [ | ||
"# Loading a fake WCS into widget sometimes gives error.\n", | ||
"# Try reloading before giving up.\n", | ||
"w.load_nddata(im)" |
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 first time I call this, I get this error. But when I rerun the cell subsequently, it goes way. @ejeschke , do you know why?
2020-02-07 13:05:18,025 | E | Callback.py:172 (_do_callbacks) |
Error making callback 'cursor-changed': DEC (2048.500000) > 90.0
2020-02-07 13:05:18,026 | E | Callback.py:173 (_do_callbacks) | Traceback:
File ".../ginga/misc/Callback.py", line 156, in _do_callbacks
res = method(*cb_args, **cb_kwargs)
File ".../astrowidgets/core.py", line 214, in _mouse_move_cb
raDegToString(ra), decDegToString(dec))
File ".../ginga/util/wcs.py", line 137, in decDegToString
sign, dec_degree, dec_min, dec_sec = degToDms(dec_deg)
File ".../ginga/util/wcs.py", line 81, in degToDms
assert dec <= 90, WCSError("DEC (%f) > 90.0" % (dec))
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's a WCS check that we probably should look at. It's just trying to format the coordinates to string values and finding an invalid DEC. Even though this is a load operation, the formatting happens because of a callback in the viewer when the image changes. Not sure why it wouldn't occur again if you re-execute the cell, but it might depend on where it thinks the cursor is WRT the window.
"outputs": [], | ||
"source": [ | ||
"# If plot shows, rerun cell to hide it.\n", | ||
"ax = plt.gca();\n", |
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.
@mwcraig , do you know any notebook tricks to not show the Matplotlib window in this cell? It ways show on first run, but then disappears in subsequent runs in the same session.
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.
Hi, I think this works:
plt.ioff()
I've been using a version of this code in a notebook I've made for displaying HETDEX data cubes. I had to switch the axis around.
https://github.com/HETDEX/hetdex_api/blob/master/hetdex_api/cube_widget.py
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 plot doesn't seem to show at the wrong place for me anymore either; perhaps something was fixed upstream. Thanks for letting us know!
Switching axis is probably normal since images taken with different instruments/telescopes have different formats.
This comment has been minimized.
This comment has been minimized.
If you add a logging debug message at the beginning of that handler, does it show it being executed? |
@ejeschke , thanks for the tip! I inserted some debugging logs, and turns out it was choking at |
I think this could be a general problem in Ginga noted here, which could use some attention at a hack session sometime. WCS is tricky that way: when it's broken, you want to know it's broken, but then again you don't want to be nagged that its broken. 😺 |
DO NOT MERGE YET
This example notebook illustrate how one can load a data cube into a widget and:
It also attempts to load a large TESS or JWST/NIRCam cube (the experimental part) using Dask support in ejeschke/ginga#805 and without.
p.s. I ended up using notebook partly due to ejeschke/ginga#824 but mainly due to JWST's investment in notebook analysis.
p.p.s. I also concluded that Dask is not necessary if you stick to FITS
memmap
.Example screenshots
JWST/NIRCam:
TESS:
TODO
master
.cc @hcferguson and @larrybradley