Skip to content

additional ad-hoc waveforms (gaussian, wnb, strings) #195

Open
eric-moreno wants to merge 8 commits into
ML4GW:mainfrom
eric-moreno:eric-dev
Open

additional ad-hoc waveforms (gaussian, wnb, strings) #195
eric-moreno wants to merge 8 commits into
ML4GW:mainfrom
eric-moreno:eric-dev

Conversation

@eric-moreno

Copy link
Copy Markdown

No description provided.

@deepchatterjeeligo

Copy link
Copy Markdown
Contributor

@eric-moreno is this still under consideration. It looks like these waveforms exist in lalsimulation, could you add unittests against those?

@deepchatterjeeligo deepchatterjeeligo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@eric-moreno please add unittest for the new waveforms.

@github-actions

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  ml4gw/waveforms/adhoc
  __init__.py
  cosmic_string.py 20, 23-24
  gaussian.py
  sine_gaussian.py 136-143, 154-159, 163-239
  white_noise_burst.py 21, 23-24, 132, 139
Project Total  

This report was generated by python-coverage-comment-action

Comment thread ml4gw/waveforms/adhoc/cosmic_string.py Outdated
# But to create an actual Python shape, we do .cpu().item() at the end.
temp = (9.0 / f_low) / dt / 2.0 # float in Python
# If you want GPU math, push it to a GPU tensor first:
temp_t = torch.tensor(temp, device=device, dtype=torch.float32)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this seems to be a constant. Why not make it a register_buffer

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since we’re only calculating the required time-window size, using a torch.Tensor operation is overkill. I will change it to math.floor.

Comment thread ml4gw/waveforms/adhoc/cosmic_string.py Outdated
# If you want GPU math, push it to a GPU tensor first:
temp_t = torch.tensor(temp, device=device, dtype=torch.float32)
half_len = torch.floor(temp_t) # GPU-based floor
half_len_int = int(half_len.cpu().item()) # bring back to Python int

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should not have .cpu() in the waveform generator

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.92424% with 53 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ml4gw/waveforms/adhoc/sine_gaussian.py 10.00% 45 Missing ⚠️
ml4gw/waveforms/adhoc/white_noise_burst.py 94.89% 5 Missing ⚠️
ml4gw/waveforms/adhoc/cosmic_string.py 95.89% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

3 participants