Skip to content

Allow setting fit title to model result - #317

Open
danielmaclaren wants to merge 39 commits into
mainfrom
ticket70livefit
Open

danielmaclaren wants to merge 39 commits into
mainfrom
ticket70livefit

Conversation

@danielmaclaren

Copy link
Copy Markdown
Contributor

Description of work

Matlibplot will display both the Model used and the Centre value of the graph.

Ticket

Link to Ticket

Labels

Acceptance criteria

  • Pull request title is understandable for a user (e.g. scientist) reading the release notes. The PR title should be a short description of the change from a user perspective.
  • Pull request has appropriate labels for automatic release-notes generation
  • Paremeters of fit appear in the plot title.
  • Option to enable/disable this

@danielmaclaren danielmaclaren added the bluesky-Semver-Minor New functionality / back-compatible changes label Mar 10, 2026
@danielmaclaren danielmaclaren linked an issue Mar 10, 2026 that may be closed by this pull request
2 tasks
@pull-request-size pull-request-size Bot added size/M and removed size/L labels Mar 10, 2026
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Mar 19, 2026
@Tom-Willemsen

Copy link
Copy Markdown
Member

Pull request title is understandable for a user (e.g. scientist) reading the release notes. The PR title should be a short description of the change from a user perspective.

I will edit, but please be mindful of this: Ticket70livefit is not useful for a user reading the release notes.

@Tom-Willemsen Tom-Willemsen changed the title Ticket70livefit Allow setting fit title to model result Apr 7, 2026
Comment thread manual_system_tests/dae_scan.py Outdated
y=reducer.intensity.name,
yerr=reducer.intensity_stddev.name,
fit=Linear.fit(),
fit=Gaussian.fit(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why has this changed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I believe I was trying out different models

Comment thread manual_system_tests/dae_scan.py Outdated
from ibex_bluesky_core.utils import get_pv_prefix

NUM_POINTS: int = 3
NUM_POINTS: int = 10

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why has this changed?

@danielmaclaren danielmaclaren Aug 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same again, I was changing the values for testing reasons, I can switch them back if you like?

show_plot()


class LiveFitPlot(_DefaultLiveFitPlot):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Needs adding to __all__ here and in callbacks module please...

Please write API documentation and check it renders properly in sphinx.

super().stop(doc)
if self.set_title:
param_name = self.livefit.model.param_names
result_values = self.livefit.result.values

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What happens if the fit failed and livefit.result is None?

if self.set_title:
param_name = self.livefit.model.param_names
result_values = self.livefit.result.values
model_title = self.livefit.model.name.split(" [")[0] + ")"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems fragile. Can we define a name in a suitable format on each model instead?

@jackbdoughty
jackbdoughty self-requested a review September 14, 2026 10:30

@jackbdoughty jackbdoughty 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.

Maybe worth just a quick comment under doc\callbacks\fitting\fitting.md- I think otherwise all good 👍

jackbdoughty
jackbdoughty previously approved these changes Oct 1, 2026
Comment thread src/ibex_bluesky_core/fitting.py Outdated
@classmethod
def interesting_params(cls) -> list[str]:
"""Return parameters that are interesting for ie. the plot title."""
return ["c0"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be both c1 and c0 I think

Comment thread src/ibex_bluesky_core/fitting.py Outdated
@classmethod
def interesting_params(cls) -> list[str]:
"""Return parameters that are interesting for ie. the plot title."""
return ["c0"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should either be all of them, or none of them. Just one parameter of a polynomial is not very useful.

Comment thread src/ibex_bluesky_core/fitting.py Outdated
@classmethod
def interesting_params(cls) -> list[str]:
"""Return parameters that are interesting for ie. the plot title."""
return ["center"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

SlitScan doesn't have a center parameter.

@Tom-Willemsen

Copy link
Copy Markdown
Member

This is in review but not mergeable due to failing CI, @danielmaclaren can you have a look?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bluesky-Semver-Minor New functionality / back-compatible changes size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LiveFitPlot - set title to parameters of fit

4 participants