-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
Big FITS file tutorial #594
base: main
Are you sure you want to change the base?
Conversation
…/actions/setup-python-4.6.0 Bump actions/setup-python from 4.5.0 to 4.6.0
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
I'm not sure how to deal with the timing out issue. The point of this tutorial is to create an extra-large FITS file, so several of the operations to indeed take a bit of time, and can't really be modified not to. |
@embray Would you be willing to review this PR? I believe you were the author of the build-big-fits-file gallery example I built it off of and reference in the description (which I realized has now moved location, so I will update that). |
I'll try to take a look |
@embray thanks so much! No rush. |
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 great and we should get this in! One thing I would suggest is instead of your custom unit formatting function, just use astropy.units
! Instead of print_file_size()
, you could to:
import astropy.units as u
(os.path.getsize(path) * u.byte).to(u.kilobyte)
for example.
Oh my goodness, when you wrote "no rush" I didn't mean to leave this lingering for 6 months either. I think I got swept up in summer travel and forgot. |
If I recall correctly, and I may not, I thought that when you instantiate an It's not so obvious but I think in the constructor it eventually sets Might be worth checking this and making a note of in the tutorial if I'm correct. |
Could maybe also use |
The idea of suggesting madvise is a nice one. It's a shame these extra steps need to be taken though. For now it's fine because there's no obvious "better" way but this might be a nice option to be able to set directly through the HDU object to use when writing to a file from mmap. |
Piggie-backing in my previous comment about the NAXIS headers you can also set EXTNAME directly on the HDU like
It doesn't really matter how you do it because it's effectively the same. For people who know FITS they'll know what they're doing here. I always just tried to hide FITS implementation details as much as possible. Up to you how you want to approach it. |
Anyways those are my only comments, this is great. I think there was some version of this in the main documentation too but I don't know how up to date it is. This is fun to read and easy to understand. @adrn makes a good point too about using Astropy units for printing file sizes. |
I didn't know you could do this! I definitely will update it to do it this way.! |
Thanks so much for reviewing this! Very helpful! |
This is an advanced tutorial that shows how to create a FITS file from scratch that is too large to fit in memory.