Skip to content

Add analysis component#44

Open
Tedsmith100 wants to merge 42 commits intonu-ZOO:mainfrom
Tedsmith100:add-waveform-averager
Open

Add analysis component#44
Tedsmith100 wants to merge 42 commits intonu-ZOO:mainfrom
Tedsmith100:add-waveform-averager

Conversation

@Tedsmith100
Copy link

Includes waveform averaging code in the form of ana.py, moves some functions around for cleanliness.

Copy link
Member

@jwaiton jwaiton left a comment

Choose a reason for hiding this comment

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

Nice PR! It's a good function. I've added mostly some documentation requests and some changes to the IO. After those have been resolved, I'll move onto requesting tests (we can discuss these in person at some point 😸 )

@Tedsmith100 Tedsmith100 requested a review from a team February 3, 2026 17:23
Copy link
Member

@jwaiton jwaiton left a comment

Choose a reason for hiding this comment

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

Small comments mostly, related to typos and other things.

The tests need a bit more thought, but we can figure that out together at some point.

two functions which check that window args dont overlap or exceed
waveform length. Also comment changes made for clarity.
@Tedsmith100 Tedsmith100 force-pushed the add-waveform-averager branch from dec6950 to d8b0034 Compare February 9, 2026 15:29
Copy link
Member

@jwaiton jwaiton left a comment

Choose a reason for hiding this comment

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

Almost done! Just need to sit down and sort out the testing with hypothesis and then some not-so-fun rebasing and we'll be done :)

packs/ana/ana.py Outdated
Comment on lines +20 to +33

base_path = conf_args['save_path'] # Find the save path from config
path = base_path
base, ext = os.path.splitext(base_path)

counter = 1 # Stop overwrites by adding number to save path
while os.path.exists(path):
path = f"{base}_{counter}{ext}"
counter += 1

with h5py.File(path, 'w') as f: # Save as a h5
f.create_dataset('Average_waveform', data=avgwf)

print(f"Saved to: {path}")
Copy link
Member

Choose a reason for hiding this comment

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

We can leave this for technical debt, but a simple test would be to run the code and ensure that the h5 file outputs what you expect based on the input.

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