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

Fitting Callback #34

Merged
merged 38 commits into from
Oct 16, 2024
Merged

Fitting Callback #34

merged 38 commits into from
Oct 16, 2024

Conversation

jackbdoughty
Copy link
Contributor

Introduces our own data fitting callback as a wrapper to Bluesky's LiveFit.

  • Adds extra functionality such as guessing heuristics, each extra piece of data will mean new guess generated before trying to fit. Plus new fitting models over what already was in scans library.
  • Unit tests for each type of fit and the callback itself.
  • Documentation.

Best way to test would be to go through all new docs. Then to spin up some fake noisy data and set/read values to blocks.

while True:
    val = g.get_pv("CS:SB:bob", is_local=True)
    g.set_pv("CS:SB:alice",  lorentzian(val, 1, 1, 0),is_local=True)

Then create a plan in a separate file and check that fits are working.

alice = block_r(float, "alice")
    bob = block_rw(float, "bob", write_config=BlockWriteConfig(settle_time_s=0.5))

    lf = LiveFit(Lorentzian.fit(), "alice", "bob", )

    fig, ax = plt.subplots()
    
    @subs_decorator(
        [
            LiveTable([bob.name, alice.name]),
            LiveFitPlot(lf, ax=ax, color="r", num_points=1000),
            LivePlot(y=alice.name, x=bob.name, ax=ax, marker="x", linestyle="none"),
        ]
    )
    def _inner() -> Generator[Msg, None, None]:
        yield from ensure_connected(bob, alice)
        yield from bp.scan([alice], bob, -5, 5, num=15)
    yield from _inner()
  • Also worth checking that unit tests are appropriate and cover what they need to.
  • And can check that fit results can be read from LiveFit.result

@jackbdoughty jackbdoughty mentioned this pull request Oct 3, 2024
15 tasks
Copy link
Contributor

@LowriJenkins LowriJenkins left a comment

Choose a reason for hiding this comment

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

Just some minor documentation changes

doc/fitting/fitting.md Outdated Show resolved Hide resolved
doc/fitting/fitting.md Show resolved Hide resolved
@LowriJenkins LowriJenkins merged commit a8bb972 into main Oct 16, 2024
11 checks passed
@LowriJenkins LowriJenkins deleted the 19_Callbacks_Fitting branch October 16, 2024 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants