ISISComputingGroup / IBEX

Top level repository for IBEX stories
4 stars 2 forks source link

REFL: Polref tracking issue #8233

Closed rerpha closed 2 weeks ago

rerpha commented 4 months ago

as a POLREF user I would like my reflectometry config to work with the latest version of the reflectometry server.

Currently POLREF are rolled back to the 13.0.1 release of the refl server as the latest presents an error message (see below)

Acceptance criteria

More info

issue is isolated to https://github.com/ISISComputingGroup/EPICS-refl/pull/47 and more specifically https://github.com/ISISComputingGroup/EPICS-refl/commit/69d5072aaf245e4412f096bc2490b54e138b2748 - e32f7bd is not affected

stack trace:

[2024-02-21 14:52:37.998860] MAJOR: ValueError: No interception between beam and movement
Traceback (most recent call last):
  File "C:\Instrument\Apps\EPICS\support\refl\master\ReflectometryServer\beamline_configuration.py", line 79, in create_beamline_from_configuration
    beamline = config.get_beamline(macros)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Instrument\Settings\config\NDLT1542\configurations\refl\config.py", line 379, in get_beamline
    return get_configured_beamline()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Instrument\Apps\EPICS\support\refl\master\ReflectometryServer\config_helper.py", line 69, in get_configured_beamline
    return Beamline(
           ^^^^^^^^^
  File "C:\Instrument\Apps\EPICS\support\refl\master\ReflectometryServer\beamline.py", line 198, in __init__
    self.update_next_beam_component(BeamPathUpdate(None), self._beam_path_calcs_rbv)
  File "C:\Instrument\Apps\EPICS\support\refl\master\ReflectometryServer\beamline.py", line 365, in update_next_beam_component
    calc_path_list[comp_index + 1].set_incoming_beam(outgoing)
  File "C:\Instrument\Apps\EPICS\support\refl\master\ReflectometryServer\beam_path_calc.py", line 344, in set_incoming_beam
    self._update_beam_path_axes()
  File "C:\Instrument\Apps\EPICS\support\refl\master\ReflectometryServer\beam_path_calc.py", line 356, in _update_beam_path_axes
    self.axis[ChangeAxis.DISPLACEMENT_POSITION].set_relative_to_beam(self._get_displacement_at_intersect())
                                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Instrument\Apps\EPICS\support\refl\master\ReflectometryServer\beam_path_calc.py", line 483, in _get_displacement_at_intersect
    return self._get_displacement_for(0)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Instrument\Apps\EPICS\support\refl\master\ReflectometryServer\beam_path_calc.py", line 479, in _get_displacement_for
    return self._movement_strategy.get_displacement_relative_to_beam_for(self._incoming_beam,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Instrument\Apps\EPICS\support\refl\master\ReflectometryServer\movement_strategy.py", line 185, in get_displacement_relative_to_beam_for
    return position + self._dist_along_axis_from_zero_to_beam_intercept(beam)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Instrument\Apps\EPICS\support\refl\master\ReflectometryServer\movement_strategy.py", line 106, in _dist_along_axis_from_zero_to_beam_intercept
    beam_intercept = self.calculate_interception(beam)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Instrument\Apps\EPICS\support\refl\master\ReflectometryServer\movement_strategy.py", line 50, in calculate_interception
    raise ValueError("No interception between beam and movement")
ValueError: No interception between beam and movement
Mode mode name not found in configuration. Setting default.
New Status Message:
Errors:
- Error reading configuration: Can not read configuration. (source: Configuration)
rerpha commented 3 months ago

I think it's their gimbal which is causing this.

    # Laser Gimbal
    gimbal_comp = add_component(Component("gimbal", PositionAndAngle(0, 0, 0)))
    add_parameter(AxisParameter("GHEIGHT", gimbal_comp, ChangeAxis.HEIGHT))
    add_parameter(AxisParameter("GTHETA", gimbal_comp, ChangeAxis.PHI))
    add_parameter(AxisParameter("GCHI", gimbal_comp, ChangeAxis.CHI))

    add_driver(IocDriver(gimbal_comp, ChangeAxis.HEIGHT, MotorPVWrapper("MOT:MTR0105"), synchronised=False))
    add_driver(IocDriver(gimbal_comp, ChangeAxis.CHI, MotorPVWrapper("MOT:MTR0106"), synchronised=False,
                         engineering_correction=as_mode_correction(G_CHI_POL_CORRECTION, polarised_modes)))
    add_driver(IocDriver(gimbal_comp, ChangeAxis.PHI, MotorPVWrapper("MOT:MTR0107"), synchronised=False,
                         engineering_correction=as_mode_correction(G_THETA_POL_CORRECTION, polarised_modes)))

This probably explains why offspec, inter etc. are fine. I think this is because it's conflicting with the beam start and has an angle of 0.

instead of using PositionAndAngle(0,0,0) if i use PositionAndAngle(0,0,PERP_TO_FLOOR_ANGLE) like inter have in their config for their gimbal, it then works.

rerpha commented 3 months ago

impeded waiting on IS response

rerpha commented 3 months ago

Spoke to scientist. They said that as the gimbal/laser tracks the beam but should not affect the beam path, this issue should not really have come up. Components are not supposed to affect the beam path at all, but i don't know how you're supposed to pass the beam path between them if that's the case

ThomasLohnert commented 1 month ago

Spoke to scientist. They said that as the gimbal/laser tracks the beam but should not affect the beam path, this issue should not really have come up.

Not sure what made it suddenly break but I'd say the original setup with (0, 0, 0) looks wrong either way because that basically says the tracking axis moves parallel to the beam = no intersection. I remember we purposely had some default error conditions around edge cases like that so your fix sounds sensible

Components are not supposed to affect the beam path at all, but i don't know how you're supposed to pass the beam path between them if that's the case

Non reflecting components just pass the previous incoming beam along to the next component