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

Optimize event extension with return_array=True flag #63

Open
janreising opened this issue Jun 17, 2023 · 0 comments
Open

Optimize event extension with return_array=True flag #63

janreising opened this issue Jun 17, 2023 · 0 comments
Labels
complicated enhancement New feature or request wontfix This will not be worked on

Comments

@janreising
Copy link
Owner

In Events.get_extended_events(return_array=True) astroCAST creates an array of size num_events * num_frames. This is only efficient if the events are extended over the full num_frames, but creates an array with mostly np.nan values if a fixed extension window is chosen.

if memmap_path:
                # todo only size that we need?
                memmap_path = Path(memmap_path).with_suffix(f".dtype_{np.dtype(dtype).name}_shape_{n_events}x{n_frames}.mmap")
                arr_ext = np.memmap(memmap_path.as_posix(), dtype=dtype, mode='w+', shape=(n_events, n_frames))
            else:
                arr_ext = np.zeros((n_events, n_frames), dtype=dtype)

A more efficient solution would be to get the maximum event length after extension and create an array of this size instead.

@janreising janreising added enhancement New feature or request small_issue issue that is easily fixed labels Jun 17, 2023
@janreising janreising added complicated wontfix This will not be worked on and removed small_issue issue that is easily fixed labels Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complicated enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant