Skip to content

Allow setting fit title to model result#317

Open
danielmaclaren wants to merge 16 commits into
mainfrom
ticket70livefit
Open

Allow setting fit title to model result#317
danielmaclaren wants to merge 16 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
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?

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?

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.

logger = logging.getLogger(__name__)

__all__ = ["LivePColorMesh", "LivePlot", "PlotPNGSaver", "show_plot"]
_selected_params = ["cen", "center", "x0", "inflections_diff", "centre"]
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.

I think these should be attributes on each fit model.

e.g. Conceptually

class Gaussian:
    def model(...): ...

    def guess(...): ...

    def default_interesting_params() -> list[str]:
        return ["x0"]

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?

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

2 participants