Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/source/interfaces/direct/PyChop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ If the *Instrument scientist mode* option is selected, a similar option is
enabled for MERLIN if the G chopper is used. In this case, the phase (time
delay) of the thick disk chopper can be adjusted. The time delay is the time-of-
flight at which the chopper slit first opens (sweeps across the beam profile).
In the event that this mode is then deselected, the time delay entered previously
will be utilised for subsequent calculations instead of the default value.

The Matplotlib axes showing the calculated data have the standard toolbars.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix for random phase values on Merlin when using PyChop not in instrument scientist mode.
29 changes: 16 additions & 13 deletions qt/python/mantidqtinterfaces/mantidqtinterfaces/PyChop/PyChopGui.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,20 @@ def setFreq(self, freqtext=None, **kwargs):
# Checks for independent phases
phases = []
for key, widget in self.widgets.items():
if key.endswith("Phase") and not widget["Label"].isHidden():
idx = int(key[7])
phase = widget["Edit"].text()
if isinstance(self.engine.chopper_system.defaultPhase[idx], str):
phase = str(phase)
else:
try:
phase = float(phase) % (1e6 / self.engine.moderator.source_rep)
except ValueError:
raise ValueError(f'Incorrect phase value "{phase}" for {widget["Label"].text()}')
phases.append(phase)
if key.endswith("Phase"):
# Special case for MERLIN
# sets the default phase for Chopper0Phase if not in "Instrument Scientist Mode"
if not widget["Label"].isHidden() or "MERLIN" in str(self.engine.instname) and key[7] == 0:
idx = int(key[7])
phase = widget["Edit"].text()
if isinstance(self.engine.chopper_system.defaultPhase[idx], str):
phase = str(phase)
else:
try:
phase = float(phase) % (1e6 / self.engine.moderator.source_rep)
except ValueError:
raise ValueError(f'Incorrect phase value "{phase}" for {widget["Label"].text()}')
phases.append(phase)
if phases:
self.engine.setFrequency(freq_in, phase=phases)
else:
Expand Down Expand Up @@ -642,9 +645,9 @@ def _gen_text_ei(self, ei, obj_in):
txt += "# Ei = %8.2f meV\n" % (ei)
txt += "# Flux = %8.2f n/cm2/s\n" % (flux)
txt += "# Elastic resolution = %6.2f meV\n" % (res[0])
txt += "# Time width at sample = %6.2f us, of which:\n" % (1e6 * np.sqrt(tsqvan))
txt += "# Time width at sample = %6.2f us, of which:\n" % (1e6 * np.sqrt(tsqvan[0]))
for ky, val in list(tsqdic.items()):
txt += "# %20s : %6.2f us\n" % (ky, 1e6 * np.sqrt(val))
txt += "# %20s : %6.2f us\n" % (ky, 1e6 * np.sqrt(val[0]))
txt += "# %s distances:\n" % (obj.instname)
txt += "# x0 = %6.2f m (%s to Fermi)\n" % (x0, first_component)
txt += "# x1 = %6.2f m (Fermi to sample)\n" % (x1)
Expand Down
2 changes: 1 addition & 1 deletion scripts/pychop/merlin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ chopper_system:
radius: 300 # Disk radius
isDouble: False # Is this a double disk system?
isPhaseIndependent: True # Is this disk to be phased independently?
defaultPhase: 12800 # What is the default phase for this disk (either a time in microseconds
defaultPhase: 12400 # What is the default phase for this disk (either a time in microseconds
# or a slot index [as a string] for the desired rep to go through)
phaseOffset: 11300 # Offset introduced after disk chopper controller update
phaseName: 'Disk chopper phase delay time'
Expand Down
Loading