Skip to content

Add visibility forward fitting#83

Open
samaloney wants to merge 6 commits intoTCDSolar:mainfrom
samaloney:feat-vis-fwdit
Open

Add visibility forward fitting#83
samaloney wants to merge 6 commits intoTCDSolar:mainfrom
samaloney:feat-vis-fwdit

Conversation

@samaloney
Copy link
Member

@samaloney samaloney commented May 14, 2025

Implement vis forward fit with scipy minimise, defaulting to Nelder-Mead for now would be interesting to compare and contrast other method on simulate dataset/real dataset

Closes #84

@codecov
Copy link

codecov bot commented May 14, 2025

Codecov Report

❌ Patch coverage is 78.33333% with 52 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@0ad20f2). Learn more about missing BASE report.

Files with missing lines Patch % Lines
xrayvision/visualisation.py 23.80% 32 Missing ⚠️
xrayvision/vis_forward_fit/forward_fit.py 84.21% 12 Missing ⚠️
xrayvision/vis_forward_fit/sources.py 93.96% 7 Missing ⚠️
xrayvision/visibility.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #83   +/-   ##
=======================================
  Coverage        ?   87.12%           
=======================================
  Files           ?       12           
  Lines           ?     1188           
  Branches        ?        0           
=======================================
  Hits            ?     1035           
  Misses          ?      153           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samaloney samaloney marked this pull request as draft June 6, 2025 14:52
@samaloney samaloney marked this pull request as ready for review August 29, 2025 10:48
@samaloney samaloney requested review from annavolp and Copilot August 29, 2025 10:48
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds visibility forward fitting functionality with support for both Nelder-Mead and particle swarm optimization (PSO) methods. It introduces parametric source models (circular and elliptical Gaussians) for fitting solar features to visibility data.

  • Add new vis_forward_fit module with source definitions and fitting algorithms
  • Implement both scipy minimization and PSO fitting methods for optimization
  • Create visualization utilities for plotting visibilities

Reviewed Changes

Copilot reviewed 23 out of 25 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
xrayvision/vis_forward_fit/sources.py Defines parametric source models (circular/elliptical Gaussians) and factory classes
xrayvision/vis_forward_fit/forward_fit.py Implements forward fitting algorithms using scipy minimize and PSO
xrayvision/visualisation.py Adds visibility plotting functions for amplitude/phase visualization
xrayvision/vis_forward_fit/tests/ Test files for source models and fitting functionality
examples/stix.py Updates example to demonstrate new forward fitting capabilities

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 235 to 236
[self.amp / 4, self.x0 - 5 * np.abs(self.sigma), self.x0 - 5 * np.abs(self.sigma), self.sigma / 4],
[self.amp * 4, self.x0 + 5 * np.abs(self.sigma), self.x0 + 5 * np.abs(self.sigma), self.sigma * 4],
Copy link

Copilot AI Aug 29, 2025

Choose a reason for hiding this comment

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

Copy-paste error in bounds definition. The second element should use self.y0 not self.x0 for the y-coordinate bound.

Suggested change
[self.amp / 4, self.x0 - 5 * np.abs(self.sigma), self.x0 - 5 * np.abs(self.sigma), self.sigma / 4],
[self.amp * 4, self.x0 + 5 * np.abs(self.sigma), self.x0 + 5 * np.abs(self.sigma), self.sigma * 4],
[self.amp / 4, self.x0 - 5 * np.abs(self.sigma), self.y0 - 5 * np.abs(self.sigma), self.sigma / 4],
[self.amp * 4, self.x0 + 5 * np.abs(self.sigma), self.y0 + 5 * np.abs(self.sigma), self.sigma * 4],

Copilot uses AI. Check for mistakes.
axes[1].set_ylabel("Phase [deg]")
axes[1].set_xlabel(f"Resolution [{size.unit}]")

return fig, axes
Copy link

Copilot AI Aug 29, 2025

Choose a reason for hiding this comment

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

Return type inconsistent with docstring. The function docstring indicates it returns Figure but the code returns tuple[Figure, list].

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

Add vis_forward_fit

1 participant