Skip to content

Use rustfits or astropy remote file access when possible. - #178

Open
erykoff wants to merge 24 commits into
mainfrom
astropy_remote
Open

Use rustfits or astropy remote file access when possible.#178
erykoff wants to merge 24 commits into
mainfrom
astropy_remote

Conversation

@erykoff

@erykoff erykoff commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@erykoff
erykoff marked this pull request as draft July 24, 2026 23:49
@erykoff erykoff changed the title Use astropy remote file access when possible. Use rustfits or astropy remote file access when possible. Jul 29, 2026
@erykoff
erykoff marked this pull request as ready for review July 29, 2026 21:31
@erykoff
erykoff requested a review from esheldon July 29, 2026 21:32
Comment thread healsparse/fits_shim.py

self.fits_object = rustfits.FITS(filename, mode=rustfits_mode)
if mode == "r" and protocol != "file":
self.fits_object = rustfits.FITS(filename, mode=rustfits_mode, remote="ranged")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this defaulting to always using ranged? I think often this is not the best choice, much faster to use the default "download all and work with it in memory"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Part of the problem is that only rustfits supports this. The other thing is that I was thinking that if somebody is handing a remote URI then they are asking to read it remotely (for good or ill). I also worry about trying to get too many parameters in at the top and passing them all down ... but if you think it's necessary I could.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is only supported by rustfits?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now I support various fits backends, but I am thinking that I should remove that ... or at least remove fitsio because I do require rustfits. So I'll do that cleanup on this PR.

But I also support astropy fits reading which is currently required for remote access via S3 or google cloud or webdav (I don't think rustfits supports these or it would be a great surprise). And only rustfits will "download the file to a temp cache and then read it". I personally find that behavior surprising. I would instead expect that if I give a remote protocol I want to read it remotely.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting this to work took some real code and decisions, where as the download version didn't take any.

Also the download is what cfitsio does.

From that point of view, ranged access not being default isn't a surprise, the ranged read existing at all is the nice addition (thanks for prompting it). It is nice astropy does it too.

Why does S3, google cloud, webdave require anything other than authentication? rustfits does support that through the keyword

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread setup.cfg Outdated
fitsio>=1.4.0
rustfits =
rustfits>=0.1.5
rustfits>=0.1.7

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ranged landed in 0.1.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants