diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 28ba7f785c..a80f7b677f 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -10,20 +10,7 @@ repos:
rev: v5.0.0
hooks:
- id: trailing-whitespace
- # Exclude files from trailing-whitespace checks until we get around fixing them.
- # This way we can check that other files are trailing-whitespace clean in CI.
- exclude: |
- (?x)^(
- mxcubecore/configuration/.*|
- mxcubecore/HardwareObjects/(PlateManipulatorMaintenance|TangoMotor)\.py|
- mxcubecore/HardwareObjects/DESY/P11(BackLight|Collect|DetectorCover|Shutter)\.py|
- mxcubecore/HardwareObjects/LNLS/LNLS(Diffractometer|Energy|PilatusDet)\.py|
- mxcubecore/HardwareObjects/LNLS/EPICS(Actuator|Motor|NState)\.py|
- mxcubecore/HardwareObjects/LNLS/set_transmission_mnc.py|
- mxcubecore/HardwareObjects/EMBL/EMBL(Energy|OnlineProcessing)\.py|
- mxcubecore/HardwareObjects/mockup/MotorMockup\.py|
- mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Resolution\.py|
- )$
+ exclude: \.(hkli|nml|XDS)$
- id: end-of-file-fixer
exclude: \.(hkli|nml)$
- id: check-case-conflict
diff --git a/mxcubecore/HardwareObjects/DESY/P11BackLight.py b/mxcubecore/HardwareObjects/DESY/P11BackLight.py
index 4bc7f5c0ea..56eabd25fa 100644
--- a/mxcubecore/HardwareObjects/DESY/P11BackLight.py
+++ b/mxcubecore/HardwareObjects/DESY/P11BackLight.py
@@ -114,7 +114,7 @@ def _set_value(self, value):
self.cmd_started = time.time()
def update_light_state(self, value=None):
- """Updates light state
+ """Updates light state
:return: light state as str
"""
diff --git a/mxcubecore/HardwareObjects/DESY/P11Collect.py b/mxcubecore/HardwareObjects/DESY/P11Collect.py
index baecd5622c..30ef18e6f3 100644
--- a/mxcubecore/HardwareObjects/DESY/P11Collect.py
+++ b/mxcubecore/HardwareObjects/DESY/P11Collect.py
@@ -863,7 +863,7 @@ def get_filter_transmission(self):
def xdsapp_maxwell(self):
"""Starts XDSAPP auto-processing on the Maxwell cluster."""
-
+
if HWR.beamline.session.get_beamtime_metadata() != None:
self.log.debug("==== XDSAPP AUTOPROCESSING IS STARTED ==========")
@@ -933,7 +933,7 @@ def xdsapp_maxwell(self):
def autoproc_maxwell(self):
"""Starts AutoProc auto-processing on the Maxwell cluster."""
-
+
if HWR.beamline.session.get_beamtime_metadata() != None:
self.log.debug("==== AUTOPROC AUTOPROCESSING IS STARTED ==========")
diff --git a/mxcubecore/HardwareObjects/DESY/P11DetectorCover.py b/mxcubecore/HardwareObjects/DESY/P11DetectorCover.py
index 04a3e4900a..518126f13d 100644
--- a/mxcubecore/HardwareObjects/DESY/P11DetectorCover.py
+++ b/mxcubecore/HardwareObjects/DESY/P11DetectorCover.py
@@ -167,7 +167,7 @@ def state_closed_changed(self, value):
self.update_cover_state()
def update_cover_state(self):
- """Updates cover state
+ """Updates cover state
:return: cover state as str
"""
diff --git a/mxcubecore/HardwareObjects/DESY/P11Shutter.py b/mxcubecore/HardwareObjects/DESY/P11Shutter.py
index 40e88ac917..be76aefc22 100644
--- a/mxcubecore/HardwareObjects/DESY/P11Shutter.py
+++ b/mxcubecore/HardwareObjects/DESY/P11Shutter.py
@@ -159,7 +159,7 @@ def do_finish_exc(self, exc=None):
self.log.debug("### simulated finished with exception")
def update_shutter_state(self, state=None):
- """Updates shutter state
+ """Updates shutter state
:return: shutter state as str
"""
diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLEnergy.py b/mxcubecore/HardwareObjects/EMBL/EMBLEnergy.py
index e9190d10a7..062f794ba4 100644
--- a/mxcubecore/HardwareObjects/EMBL/EMBLEnergy.py
+++ b/mxcubecore/HardwareObjects/EMBL/EMBLEnergy.py
@@ -288,7 +288,7 @@ def energy_position_changed(self, pos):
pos = pos[0]
value = pos / 1000
- if self._nominal_value is None or abs(value - self._nominal_value) > 1e-3:
+ if self._nominal_value is None or abs(value - self._nominal_value) > 1e-3:
self.update_value(value)
def energy_limits_changed(self, limits):
diff --git a/mxcubecore/HardwareObjects/EMBL/EMBLOnlineProcessing.py b/mxcubecore/HardwareObjects/EMBL/EMBLOnlineProcessing.py
index 9906c0572f..429e25b91e 100644
--- a/mxcubecore/HardwareObjects/EMBL/EMBLOnlineProcessing.py
+++ b/mxcubecore/HardwareObjects/EMBL/EMBLOnlineProcessing.py
@@ -492,7 +492,7 @@ def finish_processing(self):
self.all_frames_dozor_is = False
self.all_frames_batch_processed = False
self.is_count = 0
- self.batch_count = 0
+ self.batch_count = 0
def dozor_average_i_changed(self, average_i_value):
if self.started:
@@ -730,7 +730,7 @@ def start_crystfel_autoproc_launchjob(self, proc_params, all_file_filename):
acq_params = self.data_collection.acquisitions[0].acquisition_parameters
sample_basename = self.params_dict["template"].split("/")[-1].split("_%d_%0")[0]
- # stream_filename = sample_basename + "_crystfel_xgandalf.stream"
+ # stream_filename = sample_basename + "_crystfel_xgandalf.stream"
stream_filename = sample_basename + cell_name_tag + "_crystfel.stream"
geom_filename = "crystfel_detector.geom"
cell_filename = "crystfel_cell" + cell_name_tag + ".cell"
diff --git a/mxcubecore/HardwareObjects/LNLS/EPICSActuator.py b/mxcubecore/HardwareObjects/LNLS/EPICSActuator.py
index 78528b90da..979f9a5f60 100644
--- a/mxcubecore/HardwareObjects/LNLS/EPICSActuator.py
+++ b/mxcubecore/HardwareObjects/LNLS/EPICSActuator.py
@@ -73,7 +73,7 @@ def abort(self):
if self.__wait_actuator_task is not None:
self.__wait_actuator_task.kill()
self.update_state(self.STATES.READY)
-
+
def _set_value(self, value):
""" Override AbstractActuator method."""
self.set_channel_value(self.ACTUATOR_VAL, value)
diff --git a/mxcubecore/HardwareObjects/LNLS/EPICSMotor.py b/mxcubecore/HardwareObjects/LNLS/EPICSMotor.py
index 1a70c6712b..3f531bb61c 100644
--- a/mxcubecore/HardwareObjects/LNLS/EPICSMotor.py
+++ b/mxcubecore/HardwareObjects/LNLS/EPICSMotor.py
@@ -50,7 +50,7 @@ def init(self):
self.get_velocity()
self.__watch_task = gevent.spawn(self._watch)
self.update_state(self.STATES.READY)
-
+
def _watch(self):
""" Watch motor current value and update it on the UI."""
while True:
@@ -85,7 +85,7 @@ def get_limits(self):
if self._nominal_limits in [(0, 0), (float('-inf'), float('inf'))]:
# Treat infinite limits
self._nominal_limits = (None, None)
-
+
logging.getLogger("HWR").info('Motor %s limits: %s' % (self.motor_name, self._nominal_limits))
return self._nominal_limits
@@ -97,7 +97,7 @@ def get_velocity(self):
def set_velocity(self, value):
"""Override AbstractMotor method."""
self.__velocity = self.set_channel_value(self.MOTOR_VELO, value)
-
+
def done_movement(self):
""" Return whether motor finished movement or not."""
dmov = self.get_channel_value(self.MOTOR_DMOV)
diff --git a/mxcubecore/HardwareObjects/LNLS/EPICSNState.py b/mxcubecore/HardwareObjects/LNLS/EPICSNState.py
index 4851b5eb4c..3d31839f81 100644
--- a/mxcubecore/HardwareObjects/LNLS/EPICSNState.py
+++ b/mxcubecore/HardwareObjects/LNLS/EPICSNState.py
@@ -69,7 +69,7 @@ def valueChanged(self, value):
self.set_value(enum_val)
self.actuatorState = self.states.get(value, "unknown")
self.emit("actuatorStateChanged", (self.actuatorState,))
-
+
def actuatorIn(self, wait=True, timeout=None):
try:
self.state_attr = self.moves["in"]
diff --git a/mxcubecore/HardwareObjects/LNLS/LNLSDiffractometer.py b/mxcubecore/HardwareObjects/LNLS/LNLSDiffractometer.py
index 184836301c..d7afead56a 100644
--- a/mxcubecore/HardwareObjects/LNLS/LNLSDiffractometer.py
+++ b/mxcubecore/HardwareObjects/LNLS/LNLSDiffractometer.py
@@ -358,7 +358,7 @@ def calculate_move_to_beam_pos(self, x, y):
if y <= (- x + 1152):
dir_goniox = 1
else:
- dir_goniox = -1
+ dir_goniox = -1
move_goniox = dir_goniox * drx_goniox
# mm to move
move_goniox = move_goniox / self.pixels_per_mm_x
diff --git a/mxcubecore/HardwareObjects/LNLS/LNLSEnergy.py b/mxcubecore/HardwareObjects/LNLS/LNLSEnergy.py
index 604e1490e4..279d96ef52 100644
--- a/mxcubecore/HardwareObjects/LNLS/LNLSEnergy.py
+++ b/mxcubecore/HardwareObjects/LNLS/LNLSEnergy.py
@@ -48,13 +48,13 @@ def get_value(self):
#if abs(self._nominal_value - value) < 0.001:
# logging.getLogger("HWR").info("Pilatus threshold is still okay.")
# return value
-
+
threshold_ok = self.check_threshold_energy(value)
if threshold_ok:
self._nominal_value = value
else:
value = None # Invalid energy because threshold is invalid
-
+
return value
def check_threshold_energy(self, energy):
diff --git a/mxcubecore/HardwareObjects/LNLS/LNLSPilatusDet.py b/mxcubecore/HardwareObjects/LNLS/LNLSPilatusDet.py
index 6b0f6ad14e..ee02396289 100644
--- a/mxcubecore/HardwareObjects/LNLS/LNLSPilatusDet.py
+++ b/mxcubecore/HardwareObjects/LNLS/LNLSPilatusDet.py
@@ -192,13 +192,13 @@ def set_wavelength(self, wavelength):
# "Pilatus wavelength still okay."
# )
# return True
-
+
# As the set of Pilatus wavelength, det dist and beam xy is fast,
# there is no need to compare the target value with the current one.
logging.getLogger("HWR").info("Setting Pilatus wavelength...")
self.set_channel_value(self.DET_WAVELENGTH, wavelength)
time.sleep(0.6)
-
+
print('WAVELENGHT WAS SET: ' + str(wavelength))
self.wavelength = self.get_wavelength()
print('WAVELENGHT GOT: ' + str(self.wavelength))
@@ -277,7 +277,7 @@ def set_beam_x(self, from_user=False, beam_x=None):
"""
Set detector beam_x and returns whether it was successful or not.
- Beam X value can come from different sources. The priority (from
+ Beam X value can come from different sources. The priority (from
high to low) is:
* from_user
* beam_x argument
@@ -339,7 +339,7 @@ def set_beam_y(self, from_user=False, beam_y=None):
"""
Set detector beam_y and returns whether it was successful or not.
- Beam Y value can come from different sources. The priority (from
+ Beam Y value can come from different sources. The priority (from
high to low) is:
* from_user
* beam_y argument
@@ -380,7 +380,7 @@ def set_beam_y(self, from_user=False, beam_y=None):
"Error while setting Pilatus beam Y. Please, check the detector."
)
return False
-
+
def get_transmission(self):
"""
Returns:
@@ -417,7 +417,7 @@ def set_transmission(self, transmission):
"Error while setting Pilatus transmission. Please, check the detector."
)
return False
-
+
def get_start_angle(self):
"""
Returns:
@@ -454,7 +454,7 @@ def set_start_angle(self, start_angle):
"Error while setting Pilatus start angle. Please, check the detector."
)
return False
-
+
def get_angle_incr(self):
"""
Returns:
diff --git a/mxcubecore/HardwareObjects/LNLS/set_transmission_mnc.py b/mxcubecore/HardwareObjects/LNLS/set_transmission_mnc.py
index 21eb4a0a87..0a53c6f91b 100755
--- a/mxcubecore/HardwareObjects/LNLS/set_transmission_mnc.py
+++ b/mxcubecore/HardwareObjects/LNLS/set_transmission_mnc.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
-
+
"""Transmission control for MANACA.
Attenuator: ABS-300-12-C-DN-DN40 Flanges.
Foils: #1, 8 um Al;
@@ -37,7 +37,7 @@ def read_input():
def get_transmission(energy, transmission):
transmission = transmission/100
- # Expressions (interpolation) for calculations of MU (linear attenuation coeficient [cm^-1]) for each material in function of the beam energy.
+ # Expressions (interpolation) for calculations of MU (linear attenuation coeficient [cm^-1]) for each material in function of the beam energy.
# The data used to obtain the expressions (curve fitting) are from "https://physics.nist.gov/PhysRefData/FFast/html/form.html"
# This attenuation coeficients can be verified and optimised after experimental validation at the beamline.
MU_Al = (78657.01011 * math.exp(-energy/0.65969)) + (6406.36151 * math.exp(-energy/1.63268)) + (492.29999 * math.exp(-energy/4.42554)) + (3.2588)
@@ -47,7 +47,7 @@ def get_transmission(energy, transmission):
MU_Zr = (11143.28458 * math.exp(-energy/5.87029)) + (102.27474)
MU_EMPTY = 0.0
# Foils in ABS-attenuator. The dictionary gives the foil position and material in the key (e.g. 'F1_Al', position 1 occuped by an aluminium foil),
- # and the thickness [um] in the value. The list gives the positions and materials, similar to the dictionary, and it is used in the combination.
+ # and the thickness [um] in the value. The list gives the positions and materials, similar to the dictionary, and it is used in the combination.
foils_dict = {'F0_EMPTY':0, 'F1_Al':8, 'F2_Al':10, 'F3_Al':20, 'F4_Al':80, 'F5_Al':160, 'F6_Al':320, 'F7_Al':800,
'F8_Al':1500, 'F9_Ti':8, 'F10_Cu':10, 'F11_Au':5, 'F12_Zr':25}
@@ -64,10 +64,10 @@ def get_transmission(energy, transmission):
attenuator_position = attenuator_position[0:12]
elif energy >= 18.5:
attenuator_position = attenuator_position[0:13]
-
+
foils_comb = []
atten_coef_sum = []
-
+
# calculate the all possible unique combinations
for i in range(1, len(attenuator_position)+1):
product = itertools.combinations(attenuator_position, i)
@@ -75,7 +75,7 @@ def get_transmission(energy, transmission):
foils_comb.append(list(item))
# calculate the product of MU (cm^-1) * thickness (cm) for each material (MU * d)
# and sum the products to obtain the total (final) attenuation for each possible combination.
- # and put the results (total attenuation) in a list.
+ # and put the results (total attenuation) in a list.
comb_sum = []
for item in foils_comb:
comb_tmp = []
@@ -114,11 +114,11 @@ def get_transmission(energy, transmission):
def set_foils(filter_combination):
-
+
# declare a list with available foils and a dictionary with epics PV class (FOIL ACT, FOIL IN, FOIL OUT) for each foil
attenuator_position = ['F1_Al', 'F2_Al', 'F3_Al', 'F4_Al', 'F5_Al', 'F6_Al', 'F7_Al', 'F8_Al',
'F9_Ti', 'F10_Cu', 'F11_Au', 'F12_Zr']
-
+
foils_pv = {'F1_Al':(PV('MNC:B:RIO01:9474C:bo0'), PV('MNC:B:RIO01:9425A:bi11'), PV('MNC:B:RIO01:9425A:bi12')),
'F2_Al':(PV('MNC:B:RIO01:9474C:bo1'), PV('MNC:B:RIO01:9425A:bi10'), PV('MNC:B:RIO01:9425A:bi13')),
'F3_Al':(PV('MNC:B:RIO01:9474C:bo2'), PV('MNC:B:RIO01:9425A:bi9'), PV('MNC:B:RIO01:9425A:bi14')),
@@ -133,9 +133,9 @@ def set_foils(filter_combination):
'F12_Zr':(PV('MNC:B:RIO01:9474D:bo3'), PV('MNC:B:RIO01:9425A:bi0'), PV('MNC:B:RIO01:9425A:bi23'))}
# setup the foils: check foil status, put the foils in the 'filter_combination' and remove the others
-
+
wt = 0.1
-
+
# the commented lines bellow works for the attenuator expected logic (0 for foil out and 1 for foil in).
# as the current logic is inverted (1 is foil out and 0 is foil in) use the uncommented lines.
@@ -166,7 +166,7 @@ def set_foils(filter_combination):
elif foils_pv[foil][1].get() == foils_pv[foil][2].get():
status = 1
break
-
+
return status
@@ -176,7 +176,7 @@ def main():
transmission_setup = get_transmission(energy, transmission)
# transmission required by the user
user_transmission = transmission_setup[0] * 100
- # real transmission got with calculated foil combination
+ # real transmission got with calculated foil combination
actual_transmission = round(transmission_setup[1] * 100, 2)
# calculated foil combination to get the required transmission
filter_combination = transmission_setup[2]
diff --git a/mxcubecore/HardwareObjects/PlateManipulatorMaintenance.py b/mxcubecore/HardwareObjects/PlateManipulatorMaintenance.py
index 9eb71080b0..bab3e05269 100644
--- a/mxcubecore/HardwareObjects/PlateManipulatorMaintenance.py
+++ b/mxcubecore/HardwareObjects/PlateManipulatorMaintenance.py
@@ -15,7 +15,7 @@ class PlateManipulatorMaintenance(HardwareObject):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
-
+
def init(self):
self._sc = self.get_object_by_role("sample_changer")
self._scan_limits = ''
@@ -28,7 +28,7 @@ def _do_abort(self):
:rtype: None
"""
return self._sc._do_abort()
-
+
def _move_to_crystal_position(self, args):
"""
command to move MD head to x, y crystal position
@@ -38,7 +38,7 @@ def _move_to_crystal_position(self, args):
:rtype: None
"""
return self._sc.move_to_crystal_position(args)
-
+
def _do_change_mode(self, args):
self._sc._do_change_mode(args)
@@ -66,7 +66,7 @@ def _get_scan_limits(self, args):
def _update_global_state(self):
state_dict, cmd_state, message = self.get_global_state()
self.emit("globalStateChanged", (state_dict, cmd_state, message))
-
+
def get_global_state(self):
"""
"""
@@ -90,7 +90,7 @@ def get_global_state(self):
return state_dict, cmd_state, message
-
+
def get_cmd_info(self):
""" return information about existing commands for this object
@@ -121,5 +121,5 @@ def send_command(self, cmdname, args=None):
if cmdname == "setPlateBarcode":
self.set_plate_barcode(args)
# if cmdname == "change_mode":
- # self._do_change_mode(args)
+ # self._do_change_mode(args)
return True
diff --git a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Resolution.py b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Resolution.py
index 252a17280c..973b38c882 100644
--- a/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Resolution.py
+++ b/mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Resolution.py
@@ -12,7 +12,7 @@ def __init__(self, name):
super(PX2Resolution, self).__init__(name)
self.resolution_motor = resolution()
self.beam_center = beam_center()
-
+
def connect_notify(self, signal):
if signal == "stateChanged":
self.update_state(self.get_state())
@@ -20,7 +20,7 @@ def connect_notify(self, signal):
def get_value(self):
self._nominal_value = self.resolution_motor.get_resolution()
return self._nominal_value
-
+
def _set_value(self, value):
self.resolution_motor.set_resolution(value)
diff --git a/mxcubecore/HardwareObjects/TangoMotor.py b/mxcubecore/HardwareObjects/TangoMotor.py
index 73ea920bfc..f68a2a1bfe 100644
--- a/mxcubecore/HardwareObjects/TangoMotor.py
+++ b/mxcubecore/HardwareObjects/TangoMotor.py
@@ -224,12 +224,12 @@ def _update_state(self):
motor_state = self.chan_state.get_value()
self.log.debug(" reading motor state for %s is %s" % (self.name(), str(motor_state)))
self.motor_state_changed(motor_state)
-
+
def update_value(self, value=None):
"""Updates motor position"""
if value is None:
value = self.get_value()
- self.latest_value = value
+ self.latest_value = value
super(TangoMotor, self).update_value(value)
def get_motor_mnemonic(self):
diff --git a/mxcubecore/HardwareObjects/mockup/MotorMockup.py b/mxcubecore/HardwareObjects/mockup/MotorMockup.py
index c75cf6bd1c..e80f21c338 100644
--- a/mxcubecore/HardwareObjects/mockup/MotorMockup.py
+++ b/mxcubecore/HardwareObjects/mockup/MotorMockup.py
@@ -121,6 +121,6 @@ def _move(self, value):
self.update_specific_state(None)
return value
-
+
def is_moving(self):
return ( (self.get_state() == self.STATES.BUSY ) or (self.get_state() == self.SPECIFIC_STATES.MOVING))
diff --git a/mxcubecore/configuration/alba_xaloc13/auto-processing.xml b/mxcubecore/configuration/alba_xaloc13/auto-processing.xml
index 507cfb602b..518f20067d 100755
--- a/mxcubecore/configuration/alba_xaloc13/auto-processing.xml
+++ b/mxcubecore/configuration/alba_xaloc13/auto-processing.xml
@@ -2,5 +2,5 @@
/beamlines/bl13/commissioning/templates
bl13/ct/variables
-
+
diff --git a/mxcubecore/configuration/alba_xaloc13/beam-info.xml b/mxcubecore/configuration/alba_xaloc13/beam-info.xml
index b0705604e1..dc8b859142 100755
--- a/mxcubecore/configuration/alba_xaloc13/beam-info.xml
+++ b/mxcubecore/configuration/alba_xaloc13/beam-info.xml
@@ -1,11 +1,11 @@
diff --git a/mxcubecore/configuration/alba_xaloc13/beamline-setup.xml b/mxcubecore/configuration/alba_xaloc13/beamline-setup.xml
index 4ea03efd3c..3ca3f14849 100755
--- a/mxcubecore/configuration/alba_xaloc13/beamline-setup.xml
+++ b/mxcubecore/configuration/alba_xaloc13/beamline-setup.xml
@@ -9,7 +9,7 @@
-
+
@@ -19,7 +19,7 @@
-
+
diff --git a/mxcubecore/configuration/alba_xaloc13/cats.xml b/mxcubecore/configuration/alba_xaloc13/cats.xml
index c9d54f5c5a..d4899ba256 100755
--- a/mxcubecore/configuration/alba_xaloc13/cats.xml
+++ b/mxcubecore/configuration/alba_xaloc13/cats.xml
@@ -1,7 +1,7 @@