Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callbacks: fitting #19

Closed
15 tasks done
Tom-Willemsen opened this issue Aug 19, 2024 · 3 comments
Closed
15 tasks done

Callbacks: fitting #19

Tom-Willemsen opened this issue Aug 19, 2024 · 3 comments
Assignees
Labels

Comments

@Tom-Willemsen
Copy link
Contributor

Tom-Willemsen commented Aug 19, 2024

As a user, I would like to be able to apply fits to scans.

This depends on #8 , which should be merged before this is started.

This is relatively standard bluesky functionality that needs documenting/exposing in a nice way.

This should also include plotting the fit onto the same axes that are used by LivePlot, i.e. you should be able to get a result that looks something like this (obviously this is already possible using standard bluesky functionality - this is mostly a documentation exercise):

image


Acceptance criteria

  • How to do fitting is documented
  • "standard" fit functions are exposed in a user-friendly way
    • Note: we may need to get scientists to agree on descriptions and parameter names for some of these models. E.g. width of a gaussian can be either described by standard deviation or variance, and may or may not include a "background" (y-offset) parameter. Even for trivial fits like "linear" - some people describe as ax + b, others as mx + c or (c1)x + c0. In order to avoid having overlapping models on different beamlines it would be best to get the science groups to all agree with a single set of definitions. Maybe we can re-use any existing conventions from mantid?
    • Linear
    • Polynomial
    • Gaussian
    • Lorentzian
    • Damped oscillator
    • Slit scan fit
    • Erf (error function)
    • Erfc (complementary error function)
    • Top hat
    • Trapezoid
    • Centre of mass
      • Note: CoM is "special", it doesn't really fit a curve to the data directly
      • bluesky already has support for this via the PeakStats callback
  • Fitting is not subscribed to the RunEngine by default
    • Instead, each plan will define a sensible fit for that type of scan.
  • The final parameters of the fit, including statistical fit parameters like r^2 or covariance matrices, are accessible to the user (via plan_result or similar mechanisms) after the scan has completed

Discussed in planning 05/09/24

37:15

@Tom-Willemsen
Copy link
Contributor Author

Tom-Willemsen commented Sep 4, 2024

We might need ability to dynamically guess initial fit parameters based on data collected so far. See existing scans library for how it's done there.

Although this isn't done by default in bluesky, it should generally be a reasonably simple addition in a thin subclass/wrapper of LiveFit.

@GRyall GRyall added the 8 label Sep 5, 2024
@KathrynBaker KathrynBaker moved this to Backlog in PI_2024_08 Sep 5, 2024
@jackbdoughty jackbdoughty self-assigned this Sep 5, 2024
@jackbdoughty
Copy link
Contributor

@LowriJenkins LowriJenkins added under review Issue is under review and removed under review Issue is under review labels Oct 10, 2024
@Tom-Willemsen
Copy link
Contributor Author

For info, asked the scientists about point raised in code review (whether initial guess should be shown or not), and all present [RD/CK/JL] agreed it should be shown on the plot

@github-project-automation github-project-automation bot moved this from Review to Done in PI_2024_08 Oct 16, 2024
@KathrynBaker KathrynBaker removed the under review Issue is under review label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

5 participants