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

Fixing tuning code #9

Open
jilavsky opened this issue Nov 2, 2024 · 1 comment
Open

Fixing tuning code #9

jilavsky opened this issue Nov 2, 2024 · 1 comment
Assignees

Comments

@jilavsky
Copy link
Collaborator

jilavsky commented Nov 2, 2024

We recasted the tuning a lot and now I am running in issues. I am testing without beam for now.
RE(tune_mr()) results in error:

... run engine error discarded:
  File "/home/beams/USAXS/bluesky/instrument/plans/axis_tuning.py", line 96, in tune_mr
    yield from _tune_base_(m_stage.r, md=md)
  File "/home/beams/USAXS/bluesky/instrument/plans/axis_tuning.py", line 72, in _tune_base_
    uuids = yield from axis.tune(md=md)     #note: the tune method comes from usaxs_motor_devices, TunableEpicsMotor, which uses lineup2
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/beams/USAXS/bluesky/instrument/devices/usaxs_motor_devices.py", line 109, in tune
    return (yield from _inner())
            ^^^^^^^^^^^^^^^^^^^
  File "/home/beams/USAXS/bluesky/instrument/devices/usaxs_motor_devices.py", line 107, in _inner
    yield from self.post_tune_hook()
TypeError: 'NoneType' object is not iterable

lines 106 and 107 are:

            if self.post_tune_hook is not None:
                yield from self.post_tune_hook()

which object is NoneType here?

Same "if" passes in lines 74/75 in pre_tune_hook, which si defined equivalent way in stages.py :

            if self.pre_tune_hook is not None:
                yield from self.pre_tune_hook()

While the post_tune_hook code for mr (in stages.py) is:

   def mr_posttune_hook():
    msg = "Tuning axis {}, final position is {}"
    logger.info(msg.format(m_stage.r.name, m_stage.r.position))
    # need to plot data in plans 
    scaler0.select_channels(None)

this code in mr_pretune_hook() works fine:

    stage = m_stage.r
    logger.info(f"Tuning axis {stage.name}, current position is {stage.position}")

so m_stage.r.name and m_stage.r.position should exist.

@jilavsky
Copy link
Collaborator Author

jilavsky commented Nov 4, 2024

I commented out some of the lines and got other errors, I think this code has not been finished when we were converting to use lineup2. usaxs_motor_devices.py has TODO in TunableEpicsMotor2 code which we did not finish that we need to engineer return back of various results from lineup2. We need value which previously was called .tuner.PeakDetected and pass back position, FWHM, etc. Unluckily, this is slightly beyond my league for now.

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

No branches or pull requests

2 participants