Skip to content
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

How to get list of all header keywords? #168

Closed
art-den opened this issue Jul 6, 2022 · 5 comments
Closed

How to get list of all header keywords? #168

art-den opened this issue Jul 6, 2022 · 5 comments

Comments

@art-den
Copy link

art-den commented Jul 6, 2022

I don't find this option in rust-fitsio API

@cjordan
Copy link
Collaborator

cjordan commented Jul 6, 2022

That's because there is no API for this in cfitsio. I have a hacky way of doing this: https://gist.github.com/cjordan/d8ca8a0c1e73be5123e90b4000abf772

@art-den
Copy link
Author

art-den commented Jul 6, 2022

Example how to list keywords goes with cfitsio: https://heasarc.gsfc.nasa.gov/docs/software/fitsio/cexamples/listhead.c

@cjordan
Copy link
Collaborator

cjordan commented Jul 6, 2022

Right, well that is an example, not part of the API. You could write this yourself in Rust using fitsio-sys; it would look somewhat like my code above.

@simonrw
Copy link
Owner

simonrw commented Jul 6, 2022

Currently rust-fitsio allows the user to choose the type of the header key. I have considered the other alternative - that the crate returns the type for you, which would probably be more useful for this situation. We could probably add a method for iterating over all of the keys (which you could then e.g. collect() into a HashMap for later use), but without types, that API is a bit annoying. As @cjordan said in the other issue without that you would end up reading the key in as a string and parsing yourself.

Until we solve #167 I'm reluctant to start tackling this. Not to say it won't come, but for now @art-den can I suggest you follow @cjordan 's example?

@art-den
Copy link
Author

art-den commented Jul 7, 2022

List of all header keywords is not very important now. So I will wait ))

@simonrw simonrw closed this as completed Apr 5, 2024
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

No branches or pull requests

3 participants