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

Decide how to do writing, also of intermediate steps #56

Open
mhvk opened this issue Dec 28, 2018 · 1 comment
Open

Decide how to do writing, also of intermediate steps #56

mhvk opened this issue Dec 28, 2018 · 1 comment

Comments

@mhvk
Copy link
Owner

mhvk commented Dec 28, 2018

As raised by @luojing1211 per e-mail: Once one has set up a pipeline, how to actually get it to write out its results? And perhaps also write intermediate steps?

One possibility, at least for the final step, is to create a memory-mapped output and then use that for the out argument in read. E.g., currently, the following works:

from numpy.lib.format import open_memmap
...
stack = Stack(square, nbin, phase)
mm = open_memmap('stack.npy', 'w+', dtype='f4', shape=stack.shape)
stack.read(out=mm)

FITS files similarly can be opened with memmap=True, so this should work reasonably transparently. All we would need is then to have some functions that create the right output files, filling the headers.

See also a complete pipeline at https://gist.github.com/mhvk/65944fcc8477c7a40ef10a896bb90a56

@mhvk
Copy link
Owner Author

mhvk commented Jun 17, 2019

Simple idea: Would write as numpy handle, but needs to keep the handle attributes (start_time, etc.). Maybe something simpler than FITS? Can we use np.savez?? (save several arrays in a single file).

Though want to use a memmap for the main data array, which is tricky. Would need instead to mmap the whole .npz output (np.savez(<some-mmap-handle>, data=??, start_time=...) and then np.load(<another-mmap-handle>) - not sure, though, that one can avoid writing some empty initial data to disk...

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

1 participant