Skip to content

feat: Add mainlobe-to-sidelobe pressure and intensity ratios#355

Merged
ebrahimebrahim merged 2 commits into
mainfrom
feat/add-sidelobe-ratios
Jul 10, 2025
Merged

feat: Add mainlobe-to-sidelobe pressure and intensity ratios#355
ebrahimebrahim merged 2 commits into
mainfrom
feat/add-sidelobe-ratios

Conversation

@peterhollender

Copy link
Copy Markdown
Contributor

Adds the calculation and reporting of mainlobe-to-sidelobe pressure and intensity ratios to the SolutionAnalysis.

  • New fields in SolutionAnalysis dataclass.
  • PARAM_FORMATS updated for table display.
  • Ratio calculation logic added to Solution.analyze(), handling division by zero.
  • Tests updated and new tests added for ratio calculations.

Closes #345

Adds the calculation and reporting of mainlobe-to-sidelobe pressure
and intensity ratios to the SolutionAnalysis.

- New fields in SolutionAnalysis dataclass.
- PARAM_FORMATS updated for table display.
- Ratio calculation logic added to Solution.analyze(), handling
  division by zero.
- Tests updated and new tests added for ratio calculations.
Updates the previously added mainlobe-to-sidelobe ratios to be
sidelobe-to-mainlobe ratios for pressure and intensity.

- Field names and descriptions in SolutionAnalysis updated.
- PARAM_FORMATS updated to match.
- Ratio calculation logic in Solution.analyze() updated.
- All relevant tests updated and verified.
@peterhollender

Copy link
Copy Markdown
Contributor Author

All the coding was done by Jules. I've verified that it works as expected.

@ebrahimebrahim ebrahimebrahim left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Tested in SlicerOpenLIFU, no issues there

Looked over the test cases a bit to sanity check

Left a question below, if that seems fine let me know.

mainlobe_isppa = solution_analysis.mainlobe_isppa_Wcm2[-1]

if mainlobe_pnp == 0:
pressure_ratio = np.inf if sidelobe_pnp != 0 else np.nan

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If we get nan's here, will ParameterConstraint checks fumble or will it know what to do?

From a cursory look, it looks like ParameterConstraint.compare doesn't check if something is nan
But any comparison against np.nan should be false, so maybe it's fine.

That's how we want it to behave right? If np.nan comes out for this ratio, parameter constraints will just fail and the solution cannot be approved.

@peterhollender

peterhollender commented Jul 10, 2025 via email

Copy link
Copy Markdown
Contributor Author

@ebrahimebrahim ebrahimebrahim merged commit 82edab1 into main Jul 10, 2025
9 checks passed
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.

Analysis of Ratios

2 participants