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

Universal read_header function #61

Open
telegraphic opened this issue Oct 11, 2018 · 6 comments
Open

Universal read_header function #61

telegraphic opened this issue Oct 11, 2018 · 6 comments
Assignees

Comments

@telegraphic
Copy link
Contributor

As discussed in #60, it may be useful to have a universal read_header() function that works on all file types. Starting this issue for discussion, this certainly relates to the roadmap discussion #38 but could be implemented pretty easily.

@dan-rds
Copy link
Contributor

dan-rds commented Jan 14, 2020

This looks interesting, I'll give it a shot. Few questions though:

  1. Do we want it to work like Waterfall(<file path>).info but a class with getters instead of printing?
  2. What are the fields that every header should have?
  3. What does "all file types" include? .h5 .fi .raw (guppi) anything else? I saw in Blimpy roadmap discussion #38 there was vague talk about other file types, what is worth the work?
  4. Where can I find a raw guppi file along with any other files from Python3 support #3 (I think my account at gbt has lapsed)

@dan-rds
Copy link
Contributor

dan-rds commented Jan 15, 2020

@telegraphic

@telegraphic
Copy link
Contributor Author

Hey @dan-rds -- basically this meant to recreate https://github.com/UCBerkeleySETI/blimpy/blob/master/blimpy/io/sigproc.py#L160 for hdf5 files also.

So add to HDF5 file reading a utility:

def read_header(filename, return_idxs=False):
    """ Read blimpy header and return a Python dictionary of key:value pairs
    Args:
        filename (str): name of file to open
    Optional args:
        return_idxs (bool): Default False. If true, returns the file offset indexes
                            for values
    returns: dictionary of key:value pairs
    """

We would want to be able to do from blimpy.io import read_header too, so could be added to the __init__.py in /io directory.

@telegraphic
Copy link
Contributor Author

Just had a look at the file_wrapper.py, there is a read_header function in the class defintion

def read_header(self):

So I would move this from the class into a new file hdf.py, then import that in file_wrapper. Or something like that

@dan-rds
Copy link
Contributor

dan-rds commented Jan 16, 2020

That's all?

@telegraphic
Copy link
Contributor Author

pretty much!

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

No branches or pull requests

3 participants