mxcubecore 1.329.0__py3-none-any.whl → 1.331.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. mxcubecore/BaseHardwareObjects.py +1 -1
  2. mxcubecore/Command/Epics.py +1 -1
  3. mxcubecore/Command/Exporter.py +1 -1
  4. mxcubecore/Command/Mockup.py +1 -1
  5. mxcubecore/Command/Pool.py +1 -1
  6. mxcubecore/Command/Sardana.py +1 -1
  7. mxcubecore/Command/Spec.py +1 -1
  8. mxcubecore/Command/Taco.py +1 -1
  9. mxcubecore/Command/Tango.py +1 -1
  10. mxcubecore/Command/Tine.py +1 -1
  11. mxcubecore/Command/exporter/ExporterClient.py +1 -1
  12. mxcubecore/Command/exporter/ExporterStates.py +1 -1
  13. mxcubecore/Command/exporter/StandardClient.py +1 -1
  14. mxcubecore/CommandContainer.py +1 -1
  15. mxcubecore/HardwareObjectFileParser.py +1 -1
  16. mxcubecore/HardwareObjects/ALBA/ALBACalibration.py +1 -1
  17. mxcubecore/HardwareObjects/ALBA/ALBACollect.py +1 -1
  18. mxcubecore/HardwareObjects/ALBA/ALBAMachineInfo.py +1 -1
  19. mxcubecore/HardwareObjects/ALBA/ALBAMiniDiff.py +1 -1
  20. mxcubecore/HardwareObjects/ALBA/ALBAPilatus.py +1 -1
  21. mxcubecore/HardwareObjects/ALBA/ALBAZoomMotor.py +1 -1
  22. mxcubecore/HardwareObjects/ALBA/ALBAZoomMotorAutoBrightness.py +1 -1
  23. mxcubecore/HardwareObjects/ALBA/XalocMachineInfo.py +1 -1
  24. mxcubecore/HardwareObjects/Attenuators.py +1 -1
  25. mxcubecore/HardwareObjects/Beamline.py +1 -1
  26. mxcubecore/HardwareObjects/BeamlineTools.py +1 -1
  27. mxcubecore/HardwareObjects/Bliss.py +1 -1
  28. mxcubecore/HardwareObjects/BlissEnergy.py +1 -1
  29. mxcubecore/HardwareObjects/BlissMotor.py +1 -1
  30. mxcubecore/HardwareObjects/BlissNState.py +1 -1
  31. mxcubecore/HardwareObjects/BlissShutter.py +1 -1
  32. mxcubecore/HardwareObjects/DESY/Centring.py +1 -1
  33. mxcubecore/HardwareObjects/DESY/DigitalZoomMotor.py +1 -1
  34. mxcubecore/HardwareObjects/DESY/MjpgStreamVideo.py +1 -1
  35. mxcubecore/HardwareObjects/DESY/P11AlbulaView.py +1 -1
  36. mxcubecore/HardwareObjects/DESY/P11BackLight.py +1 -1
  37. mxcubecore/HardwareObjects/DESY/P11Beam.py +1 -1
  38. mxcubecore/HardwareObjects/DESY/P11BeamStop.py +1 -1
  39. mxcubecore/HardwareObjects/DESY/P11Collect.py +1 -1
  40. mxcubecore/HardwareObjects/DESY/P11Collimator.py +1 -1
  41. mxcubecore/HardwareObjects/DESY/P11DetectorCover.py +1 -1
  42. mxcubecore/HardwareObjects/DESY/P11DetectorDistance.py +1 -1
  43. mxcubecore/HardwareObjects/DESY/P11DoorInterlock.py +1 -1
  44. mxcubecore/HardwareObjects/DESY/P11EDNACharacterisation.py +1 -1
  45. mxcubecore/HardwareObjects/DESY/P11EigerDetector.py +1 -1
  46. mxcubecore/HardwareObjects/DESY/P11Energy.py +1 -1
  47. mxcubecore/HardwareObjects/DESY/P11FastShutter.py +1 -1
  48. mxcubecore/HardwareObjects/DESY/P11Flux.py +1 -1
  49. mxcubecore/HardwareObjects/DESY/P11ISPyBClient.py +1 -1
  50. mxcubecore/HardwareObjects/DESY/P11MachineInfo.py +1 -1
  51. mxcubecore/HardwareObjects/DESY/P11NanoDiff.py +1 -1
  52. mxcubecore/HardwareObjects/DESY/P11Pinhole.py +1 -1
  53. mxcubecore/HardwareObjects/DESY/P11SampleChanger.py +1 -1
  54. mxcubecore/HardwareObjects/DESY/P11Session.py +1 -1
  55. mxcubecore/HardwareObjects/DESY/P11Shutter.py +1 -1
  56. mxcubecore/HardwareObjects/DESY/P11Transmission.py +1 -1
  57. mxcubecore/HardwareObjects/DESY/P11YagDiode.py +1 -1
  58. mxcubecore/HardwareObjects/DESY/P11Zoom.py +1 -1
  59. mxcubecore/HardwareObjects/DESY/ValueStateChannel.py +1 -1
  60. mxcubecore/HardwareObjects/DataPublisher.py +1 -1
  61. mxcubecore/HardwareObjects/DozorOnlineProcessing.py +1 -1
  62. mxcubecore/HardwareObjects/EMBL/EMBLAperture.py +1 -1
  63. mxcubecore/HardwareObjects/EMBL/EMBLBSD.py +1 -1
  64. mxcubecore/HardwareObjects/EMBL/EMBLBeam.py +1 -1
  65. mxcubecore/HardwareObjects/EMBL/EMBLBeamCentering.py +1 -1
  66. mxcubecore/HardwareObjects/EMBL/EMBLBeamFocusing.py +1 -1
  67. mxcubecore/HardwareObjects/EMBL/EMBLBeamlineTest.py +1 -1
  68. mxcubecore/HardwareObjects/EMBL/EMBLBeamstop.py +1 -1
  69. mxcubecore/HardwareObjects/EMBL/EMBLCRL.py +1 -1
  70. mxcubecore/HardwareObjects/EMBL/EMBLCollect.py +1 -1
  71. mxcubecore/HardwareObjects/EMBL/EMBLDetector.py +1 -1
  72. mxcubecore/HardwareObjects/EMBL/EMBLDoorInterlock.py +1 -1
  73. mxcubecore/HardwareObjects/EMBL/EMBLEnergy.py +1 -1
  74. mxcubecore/HardwareObjects/EMBL/EMBLEnergyScan.py +1 -1
  75. mxcubecore/HardwareObjects/EMBL/EMBLExporterClient.py +1 -1
  76. mxcubecore/HardwareObjects/EMBL/EMBLFlux.py +1 -1
  77. mxcubecore/HardwareObjects/EMBL/EMBLImageTracking.py +1 -1
  78. mxcubecore/HardwareObjects/EMBL/EMBLMachineInfo.py +1 -1
  79. mxcubecore/HardwareObjects/EMBL/EMBLMiniDiff.py +1 -1
  80. mxcubecore/HardwareObjects/EMBL/EMBLMotorsGroup.py +1 -1
  81. mxcubecore/HardwareObjects/EMBL/EMBLOfflineProcessing.py +1 -1
  82. mxcubecore/HardwareObjects/EMBL/EMBLOnlineProcessing.py +1 -1
  83. mxcubecore/HardwareObjects/EMBL/EMBLPiezoMotor.py +1 -1
  84. mxcubecore/HardwareObjects/EMBL/EMBLQueueEntry.py +1 -1
  85. mxcubecore/HardwareObjects/EMBL/EMBLResolution.py +1 -1
  86. mxcubecore/HardwareObjects/EMBL/EMBLSSXChip.py +1 -1
  87. mxcubecore/HardwareObjects/EMBL/EMBLSafetyShutter.py +1 -1
  88. mxcubecore/HardwareObjects/EMBL/EMBLSession.py +1 -1
  89. mxcubecore/HardwareObjects/EMBL/EMBLSlitBox.py +1 -1
  90. mxcubecore/HardwareObjects/EMBL/EMBLTableMotor.py +1 -1
  91. mxcubecore/HardwareObjects/EMBL/EMBLTransfocator.py +1 -1
  92. mxcubecore/HardwareObjects/EMBL/EMBLTransmission.py +1 -1
  93. mxcubecore/HardwareObjects/EMBL/EMBLXRFSpectrum.py +1 -1
  94. mxcubecore/HardwareObjects/EMBL/EMBLXrayImaging.py +1 -1
  95. mxcubecore/HardwareObjects/EMBL/MDFastShutter.py +1 -1
  96. mxcubecore/HardwareObjects/EMBL/TINEMotor.py +1 -1
  97. mxcubecore/HardwareObjects/EMBLFlexHCD.py +1 -1
  98. mxcubecore/HardwareObjects/EMBLFlexHarvester.py +1 -1
  99. mxcubecore/HardwareObjects/ESRF/BlissHutchTrigger.py +1 -1
  100. mxcubecore/HardwareObjects/ESRF/ESRFBeam.py +1 -1
  101. mxcubecore/HardwareObjects/ESRF/ESRFBeamDefiner.py +1 -1
  102. mxcubecore/HardwareObjects/ESRF/ESRFBeamlineActions.py +1 -1
  103. mxcubecore/HardwareObjects/ESRF/ESRFPhotonFlux.py +1 -1
  104. mxcubecore/HardwareObjects/ESRF/ESRFXRFSpectrum.py +76 -55
  105. mxcubecore/HardwareObjects/ESRF/ID232BeamDefiner.py +1 -1
  106. mxcubecore/HardwareObjects/ESRF/ID30A3BeamDefiner.py +1 -1
  107. mxcubecore/HardwareObjects/ESRF/OxfordCryostream.py +1 -1
  108. mxcubecore/HardwareObjects/ESRF/Transmission.py +1 -1
  109. mxcubecore/HardwareObjects/ESRFLIMS.py +7 -5
  110. mxcubecore/HardwareObjects/ExporterMotor.py +1 -1
  111. mxcubecore/HardwareObjects/ExporterNState.py +1 -1
  112. mxcubecore/HardwareObjects/GenericDiffractometer.py +1 -1
  113. mxcubecore/HardwareObjects/Gphl/GphlQueueEntry.py +1 -1
  114. mxcubecore/HardwareObjects/Harvester.py +1 -1
  115. mxcubecore/HardwareObjects/HarvesterMaintenance.py +1 -1
  116. mxcubecore/HardwareObjects/ICATLIMS.py +104 -34
  117. mxcubecore/HardwareObjects/LNLS/LNLSAperture.py +1 -1
  118. mxcubecore/HardwareObjects/LNLS/LNLSBeam.py +1 -1
  119. mxcubecore/HardwareObjects/LNLS/LNLSDiffractometer.py +1 -1
  120. mxcubecore/HardwareObjects/LNLS/LNLSEnergy.py +1 -1
  121. mxcubecore/HardwareObjects/LNLS/LNLSSlits.py +1 -1
  122. mxcubecore/HardwareObjects/LNLS/LNLSTransmission.py +1 -1
  123. mxcubecore/HardwareObjects/MAXIV/MAXIVAutoProcessing.py +1 -1
  124. mxcubecore/HardwareObjects/MachCurrent.py +1 -1
  125. mxcubecore/HardwareObjects/Marvin.py +1 -1
  126. mxcubecore/HardwareObjects/MicrodiffAperture.py +1 -1
  127. mxcubecore/HardwareObjects/MicrodiffZoom.py +1 -1
  128. mxcubecore/HardwareObjects/MotorWPositions.py +1 -1
  129. mxcubecore/HardwareObjects/MotorsNPosition.py +1 -1
  130. mxcubecore/HardwareObjects/NState.py +1 -1
  131. mxcubecore/HardwareObjects/QtAxisCamera.py +1 -1
  132. mxcubecore/HardwareObjects/QtGraphicsLib.py +1 -1
  133. mxcubecore/HardwareObjects/QtGraphicsManager.py +1 -1
  134. mxcubecore/HardwareObjects/QtLimaVideo.py +1 -1
  135. mxcubecore/HardwareObjects/QtTangoLimaVideo.py +1 -1
  136. mxcubecore/HardwareObjects/QueueModel.py +1 -1
  137. mxcubecore/HardwareObjects/RedisClient.py +1 -1
  138. mxcubecore/HardwareObjects/Resolution.py +1 -1
  139. mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Pilatus.py +1 -1
  140. mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Collect.py +1 -1
  141. mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Diffractometer.py +1 -1
  142. mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Qt4_LimaVideo.py +1 -1
  143. mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Video.py +1 -1
  144. mxcubecore/HardwareObjects/SOLEIL/SOLEILMachineInfo.py +1 -1
  145. mxcubecore/HardwareObjects/SampleView.py +1 -1
  146. mxcubecore/HardwareObjects/StateMachine.py +1 -1
  147. mxcubecore/HardwareObjects/TangoLimaVideoDevice.py +1 -1
  148. mxcubecore/HardwareObjects/TangoMotor.py +1 -1
  149. mxcubecore/HardwareObjects/TangoShutter.py +1 -1
  150. mxcubecore/HardwareObjects/UnitTest.py +1 -1
  151. mxcubecore/HardwareObjects/abstract/AbstractActuator.py +1 -1
  152. mxcubecore/HardwareObjects/abstract/AbstractAperture.py +1 -1
  153. mxcubecore/HardwareObjects/abstract/AbstractAuthenticator.py +1 -1
  154. mxcubecore/HardwareObjects/abstract/AbstractBeam.py +1 -1
  155. mxcubecore/HardwareObjects/abstract/AbstractCharacterisation.py +1 -1
  156. mxcubecore/HardwareObjects/abstract/AbstractCollect.py +1 -1
  157. mxcubecore/HardwareObjects/abstract/AbstractDetector.py +1 -1
  158. mxcubecore/HardwareObjects/abstract/AbstractEnergy.py +1 -1
  159. mxcubecore/HardwareObjects/abstract/AbstractFlux.py +1 -1
  160. mxcubecore/HardwareObjects/abstract/AbstractLims.py +1 -1
  161. mxcubecore/HardwareObjects/abstract/AbstractMachineInfo.py +1 -1
  162. mxcubecore/HardwareObjects/abstract/AbstractMotor.py +1 -1
  163. mxcubecore/HardwareObjects/abstract/AbstractNState.py +1 -1
  164. mxcubecore/HardwareObjects/abstract/AbstractOnlineProcessing.py +1 -1
  165. mxcubecore/HardwareObjects/abstract/AbstractProcedure.py +1 -1
  166. mxcubecore/HardwareObjects/abstract/AbstractResolution.py +1 -1
  167. mxcubecore/HardwareObjects/abstract/AbstractSampleChanger.py +1 -1
  168. mxcubecore/HardwareObjects/abstract/AbstractSampleView.py +1 -1
  169. mxcubecore/HardwareObjects/abstract/AbstractShutter.py +1 -1
  170. mxcubecore/HardwareObjects/abstract/AbstractSlits.py +1 -1
  171. mxcubecore/HardwareObjects/abstract/AbstractTransmission.py +1 -1
  172. mxcubecore/HardwareObjects/abstract/AbstractVideoDevice.py +1 -1
  173. mxcubecore/HardwareObjects/abstract/AbstractXRFSpectrum.py +44 -36
  174. mxcubecore/HardwareObjects/mockup/ActuatorMockup.py +1 -1
  175. mxcubecore/HardwareObjects/mockup/ApertureMockup.py +1 -1
  176. mxcubecore/HardwareObjects/mockup/BeamDefinerMockup.py +1 -1
  177. mxcubecore/HardwareObjects/mockup/BeamMockup.py +1 -1
  178. mxcubecore/HardwareObjects/mockup/BeamlineTestMockup.py +1 -1
  179. mxcubecore/HardwareObjects/mockup/BeamstopMockup.py +1 -1
  180. mxcubecore/HardwareObjects/mockup/CollectMockup.py +1 -1
  181. mxcubecore/HardwareObjects/mockup/DiffractometerMockup.py +1 -1
  182. mxcubecore/HardwareObjects/mockup/DoorInterlockMockup.py +1 -1
  183. mxcubecore/HardwareObjects/mockup/EDNACharacterisationMockup.py +1 -1
  184. mxcubecore/HardwareObjects/mockup/EnergyMockup.py +1 -1
  185. mxcubecore/HardwareObjects/mockup/ExporterNStateMockup.py +1 -1
  186. mxcubecore/HardwareObjects/mockup/FluxMockup.py +1 -1
  187. mxcubecore/HardwareObjects/mockup/HarvesterMockup.py +1 -1
  188. mxcubecore/HardwareObjects/mockup/MotorMockup.py +1 -1
  189. mxcubecore/HardwareObjects/mockup/MotorMockupBis.py +1 -1
  190. mxcubecore/HardwareObjects/mockup/OfflineProcessingMockup.py +1 -1
  191. mxcubecore/HardwareObjects/mockup/OnlineProcessingMockup.py +1 -1
  192. mxcubecore/HardwareObjects/mockup/PlateManipulatorMockup.py +1 -1
  193. mxcubecore/HardwareObjects/mockup/QtVideoMockup.py +1 -1
  194. mxcubecore/HardwareObjects/mockup/ScanMockup.py +1 -1
  195. mxcubecore/HardwareObjects/mockup/ShutterMockup.py +1 -1
  196. mxcubecore/HardwareObjects/mockup/SlitsMockup.py +1 -1
  197. mxcubecore/HardwareObjects/mockup/TransmissionMockup.py +1 -1
  198. mxcubecore/HardwareObjects/mockup/XRFSpectrumMockup.py +1 -1
  199. mxcubecore/HardwareRepository.py +1 -1
  200. mxcubecore/model/queue_model_enumerables.py +1 -1
  201. mxcubecore/model/queue_model_objects.py +1 -1
  202. mxcubecore/queue_entry/__init__.py +1 -1
  203. mxcubecore/queue_entry/advanced_connector.py +1 -1
  204. mxcubecore/queue_entry/base_queue_entry.py +1 -1
  205. mxcubecore/queue_entry/characterisation.py +1 -1
  206. mxcubecore/queue_entry/data_collection.py +1 -1
  207. mxcubecore/queue_entry/energy_scan.py +1 -1
  208. mxcubecore/queue_entry/generic_workflow.py +1 -1
  209. mxcubecore/queue_entry/import_helper.py +1 -1
  210. mxcubecore/queue_entry/optical_centring.py +1 -1
  211. mxcubecore/queue_entry/sample_centring.py +1 -1
  212. mxcubecore/queue_entry/xray_centering.py +1 -1
  213. mxcubecore/queue_entry/xray_centering2.py +1 -1
  214. mxcubecore/queue_entry/xrf_spectrum.py +7 -7
  215. {mxcubecore-1.329.0.dist-info → mxcubecore-1.331.0.dist-info}/METADATA +1 -1
  216. {mxcubecore-1.329.0.dist-info → mxcubecore-1.331.0.dist-info}/RECORD +219 -219
  217. {mxcubecore-1.329.0.dist-info → mxcubecore-1.331.0.dist-info}/COPYING +0 -0
  218. {mxcubecore-1.329.0.dist-info → mxcubecore-1.331.0.dist-info}/COPYING.LESSER +0 -0
  219. {mxcubecore-1.329.0.dist-info → mxcubecore-1.331.0.dist-info}/WHEEL +0 -0
@@ -1,9 +1,9 @@
1
1
  import json
2
2
  import logging
3
- import pathlib
4
3
  import shutil
5
4
  from collections import defaultdict
6
5
  from datetime import datetime, timedelta
6
+ from pathlib import Path
7
7
  from typing import List, Optional
8
8
  from zoneinfo import ZoneInfo
9
9
 
@@ -82,7 +82,8 @@ class ICATLIMS(AbstractLims):
82
82
  sessions = self.to_sessions(self.__get_all_investigations())
83
83
 
84
84
  if len(sessions) == 0:
85
- raise Exception("No sessions available for user %s" % (user_name))
85
+ msg = f"No sessions available for user {user_name}"
86
+ raise RuntimeError(msg)
86
87
 
87
88
  logger.debug("Successfully retrieved %s sessions" % (len(sessions)))
88
89
 
@@ -101,7 +102,7 @@ class ICATLIMS(AbstractLims):
101
102
  break
102
103
 
103
104
  if not session_found:
104
- raise Exception(
105
+ raise RuntimeError(
105
106
  "Current session in-use (with id %s) not avaialble to user %s"
106
107
  % (self.session_manager.active_session.session_id, user_name)
107
108
  )
@@ -291,13 +292,13 @@ class ICATLIMS(AbstractLims):
291
292
  # id to the sample sheet declared in the user portal
292
293
  sample_sheet_id = tracking_sample.get("sampleId")
293
294
  # identifier that points to the sample tracking
294
- trackingSampleId = tracking_sample.get("_id")
295
+ tracking_sample_id = tracking_sample.get("_id")
295
296
 
296
297
  logger.debug(
297
- "[ICATClient] Sample ids sample_id=%s sample_sheet_id=%s trackingSampleId=%s",
298
+ "[ICATClient] Sample ids sample_id=%s sample_sheet_id=%s tracking_sample_id=%s",
298
299
  sample_id,
299
300
  sample_sheet_id,
300
- trackingSampleId,
301
+ tracking_sample_id,
301
302
  )
302
303
 
303
304
  sample_location = tracking_sample.get("sampleContainerPosition")
@@ -352,7 +353,7 @@ class ICATLIMS(AbstractLims):
352
353
  processing_plan, downloads
353
354
  )
354
355
  except RuntimeError:
355
- logger.error(
356
+ logger.exception(
356
357
  "Failed __add_download_path_to_processing_plan"
357
358
  )
358
359
 
@@ -369,7 +370,7 @@ class ICATLIMS(AbstractLims):
369
370
  "sampleName": sample_name,
370
371
  "sampleId": sample_id,
371
372
  "sample_sheet_id": sample_sheet_id,
372
- "trackingSampleId": trackingSampleId,
373
+ "trackingSampleId": tracking_sample_id,
373
374
  "proteinAcronym": protein_acronym,
374
375
  "sampleLocation": sample_location,
375
376
  "containerCode": puck_name,
@@ -410,11 +411,13 @@ class ICATLIMS(AbstractLims):
410
411
  pass
411
412
 
412
413
  @property
413
- def only_staff_session_selection(self):
414
- return bool(self.get_property("only_staff_session_selection", default=False))
414
+ def only_staff_session_selection(self) -> bool:
415
+ return bool(
416
+ self.get_property("only_staff_session_selection", default_value=False)
417
+ )
415
418
 
416
419
  def store_robot_action(self, proposal_id: str):
417
- raise Exception("Not implemented")
420
+ raise NotImplementedError
418
421
 
419
422
  @property
420
423
  def filter(self):
@@ -452,11 +455,11 @@ class ICATLIMS(AbstractLims):
452
455
  def after_offset_days(self):
453
456
  return self.get_property("after_offset_days", "1")
454
457
 
455
- def _string_to_format_date(self, date: str, format: str) -> str:
458
+ def _string_to_format_date(self, date: str, fmt: str) -> str:
456
459
  if date is not None:
457
460
  date_time = self._tz_aware_fromisoformat(date)
458
461
  if date_time is not None:
459
- return date_time.strftime(format)
462
+ return date_time.strftime(fmt)
460
463
  return ""
461
464
 
462
465
  def _string_to_date(self, date: str) -> str:
@@ -468,7 +471,7 @@ class ICATLIMS(AbstractLims):
468
471
  def _tz_aware_fromisoformat(self, date: str) -> datetime:
469
472
  try:
470
473
  return datetime.fromisoformat(date).astimezone()
471
- except Exception:
474
+ except (TypeError, ValueError):
472
475
  return None
473
476
 
474
477
  def set_active_session_by_id(self, session_id: str) -> Session:
@@ -483,7 +486,7 @@ class ICATLIMS(AbstractLims):
483
486
 
484
487
  if len(sessions) == 0:
485
488
  logger.warning("Session list is empty. No session candidates")
486
- raise Exception("No sessions available")
489
+ raise RuntimeError("No sessions available")
487
490
 
488
491
  if len(sessions) == 1:
489
492
  self.session_manager.active_session = sessions[0]
@@ -495,7 +498,7 @@ class ICATLIMS(AbstractLims):
495
498
 
496
499
  session_list = [obj for obj in sessions if obj.session_id == session_id]
497
500
  if len(session_list) != 1:
498
- raise Exception(
501
+ raise RuntimeError(
499
502
  "Session not found in the local list of sessions. session_id="
500
503
  + session_id
501
504
  )
@@ -507,19 +510,19 @@ class ICATLIMS(AbstractLims):
507
510
  logger.debug("allow_session investigationId=%s", session.session_id)
508
511
  self.icatClient.reschedule_investigation(session.session_id)
509
512
 
510
- def get_session_by_id(self, id: str):
513
+ def get_session_by_id(self, sid: str):
511
514
  logger.debug(
512
515
  "get_session_by_id investigationId=%s investigations=%s",
513
- id,
516
+ sid,
514
517
  str(len(self.investigations)),
515
518
  )
516
- investigation_list = list(filter(lambda p: p["id"] == id, self.investigations))
519
+ investigation_list = list(filter(lambda p: p["id"] == sid, self.investigations))
517
520
  if len(investigation_list) == 1:
518
521
  self.investigation = investigation_list[0]
519
522
  return self.__to_session(investigation_list[0])
520
523
  logger.warn(
521
524
  "No investigation found. get_session_by_id investigationId=%s investigations=%s",
522
- id,
525
+ sid,
523
526
  str(len(self.investigations)),
524
527
  )
525
528
  return None
@@ -802,11 +805,11 @@ class ICATLIMS(AbstractLims):
802
805
  try:
803
806
  if cell is not None and puck is not None:
804
807
  position = int(cell * 3) + int(puck)
805
- except Exception as e:
806
- logger.exception(e)
808
+ except Exception:
809
+ logger.exception()
807
810
  return position, sample_position
808
- except Exception as e:
809
- logger.exception(e)
811
+ except Exception:
812
+ logger.exception()
810
813
 
811
814
  def store_beamline_setup(self, session_id: str, bl_config_dict: dict):
812
815
  pass
@@ -817,8 +820,76 @@ class ICATLIMS(AbstractLims):
817
820
  def store_energy_scan(self, energyscan_dict: dict):
818
821
  pass
819
822
 
820
- def store_xfe_spectrum(self, xfespectrum_dict: dict):
821
- pass
823
+ def store_xfe_spectrum(self, collection_parameters: dict):
824
+ status = {"xfeFluorescenceSpectrumId": -1}
825
+ try:
826
+ try:
827
+ beamline = self._get_scheduled_beamline()
828
+ msg = f"Dataset Beamline={beamline} "
829
+ msg += f"Current Beamline={HWR.beamline.session.beamline_name}"
830
+ logging.getLogger("HWR").info(msg)
831
+ except Exception:
832
+ logging.getLogger("HWR").exception(
833
+ "Failed to get _get_scheduled_beamline",
834
+ )
835
+ _session = HWR.beamline.session
836
+ proposal = f"{_session.proposal_code}{_session.proposal_number}"
837
+
838
+ try:
839
+ dt_aware = datetime.strptime(
840
+ collection_parameters.get("startTime"),
841
+ "%Y-%m-%d %H:%M:%S",
842
+ ).replace(tzinfo=ZoneInfo("Europe/Paris"))
843
+ dt_aware_end = datetime.strptime(
844
+ collection_parameters.get("endTime"),
845
+ "%Y-%m-%d %H:%M:%S",
846
+ ).replace(tzinfo=ZoneInfo("Europe/Paris"))
847
+
848
+ start_time = dt_aware.isoformat(timespec="microseconds")
849
+ end_time = dt_aware_end.isoformat(timespec="microseconds")
850
+ except TypeError:
851
+ logging.getLogger("HWR").exception("Failed to parse start and end time")
852
+
853
+ directory = Path(collection_parameters["filename"]).parent
854
+
855
+ msg = f"SampleId is: {collection_parameters.get('blSampleId')}"
856
+ logging.getLogger("HWR").debug(msg)
857
+ try:
858
+ sample = HWR.beamline.lims.find_sample_by_sample_id(
859
+ collection_parameters.get("blSampleId")
860
+ )
861
+ sample_name = sample["sampleName"]
862
+ except (AttributeError, TypeError):
863
+ sample_name = "unknown"
864
+ msg = f"Sample not found {collection_parameters.get('blSampleId')}"
865
+ logging.getLogger("HWR").debug(msg)
866
+
867
+ metadata = {
868
+ "sampleId": collection_parameters.get("blSampleId"),
869
+ "MX_beamSizeAtSampleX": collection_parameters.get("beamSizeHorizontal"),
870
+ "MX_beamSizeAtSampleY": collection_parameters.get("beamSizeVertical"),
871
+ "MX_directory": str(directory),
872
+ "MX_exposureTime": collection_parameters.get("exposureTime"),
873
+ "MX_flux": collection_parameters.get("flux"),
874
+ "scanType": "xrf",
875
+ "MX_transmission": collection_parameters.get("beamTransmission"),
876
+ "Sample_name": sample_name,
877
+ "InstrumentMonochromator_energy": collection_parameters.get("energy"),
878
+ "startDate": start_time,
879
+ "endDate": end_time,
880
+ }
881
+
882
+ self.icatClient.store_dataset(
883
+ beamline=beamline,
884
+ proposal=proposal,
885
+ dataset=str(directory.name),
886
+ path=str(directory),
887
+ metadata=metadata,
888
+ )
889
+ except Exception:
890
+ logging.getLogger("ispyb_client").exception()
891
+
892
+ return status
822
893
 
823
894
  def store_workflow(self, workflow_dict: dict):
824
895
  pass
@@ -871,7 +942,7 @@ class ICATLIMS(AbstractLims):
871
942
  else:
872
943
  logger.exception("HTTP error for sample %s", sample_id)
873
944
 
874
- except requests.exceptions.RequestException as e:
945
+ except requests.exceptions.RequestException:
875
946
  logger.exception("Request error for sample %s", sample_id)
876
947
  return None
877
948
 
@@ -883,15 +954,15 @@ class ICATLIMS(AbstractLims):
883
954
 
884
955
  Parameters:
885
956
  sample (str): Sample identifier.
886
- output_folder (str): Directory where files will be saved.
957
+ output_folder (str): Directory where storefiles will be saved.
887
958
 
888
959
  Returns:
889
960
  dict: A dictionary containing the paths of the downloaded files.
890
961
  """
891
962
  downloaded_files: List[Download] = []
892
963
  for resource in resources:
893
- resource_folder = pathlib.Path(output_folder) / sample_name
894
- resource_folder = pathlib.Path(resource_folder) / (
964
+ resource_folder = Path(output_folder) / sample_name
965
+ resource_folder = Path(resource_folder) / (
895
966
  resource.groupName if resource.groupName else ""
896
967
  )
897
968
  resource_folder.mkdir(
@@ -931,7 +1002,7 @@ class ICATLIMS(AbstractLims):
931
1002
 
932
1003
  try:
933
1004
  fileinfo = collection_parameters["fileinfo"]
934
- directory = pathlib.Path(fileinfo["directory"])
1005
+ directory = Path(fileinfo["directory"])
935
1006
  dataset_name = directory.name
936
1007
  # Determine the scan type
937
1008
  if dataset_name.endswith("mesh"):
@@ -1086,7 +1157,7 @@ class ICATLIMS(AbstractLims):
1086
1157
  except RuntimeError:
1087
1158
  logger.warning("Failed to get MX_axis_end")
1088
1159
 
1089
- icat_metadata_path = pathlib.Path(directory) / "metadata.json"
1160
+ icat_metadata_path = Path(directory) / "metadata.json"
1090
1161
  with open(icat_metadata_path, "w") as f:
1091
1162
  # We add the processing and experiment plan only in the metadata.json
1092
1163
  # it will not work thought pyicat-plus
@@ -1107,7 +1178,7 @@ class ICATLIMS(AbstractLims):
1107
1178
  for snapshot_index in range(1, 5):
1108
1179
  key = f"xtalSnapshotFullPath{snapshot_index}"
1109
1180
  if key in collection_parameters:
1110
- snapshot_path = pathlib.Path(collection_parameters[key])
1181
+ snapshot_path = Path(collection_parameters[key])
1111
1182
  if snapshot_path.exists():
1112
1183
  logger.debug(
1113
1184
  f"Copying snapshot index {snapshot_index} to gallery"
@@ -1167,4 +1238,3 @@ class ICATLIMS(AbstractLims):
1167
1238
  :param sample_dict: A dictionary with the properties for the entry.
1168
1239
  :type sample_dict: dict
1169
1240
  """
1170
- pass
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube.
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  #
3
- # Project: MXCuBE
3
+ # Project name: MXCuBE
4
4
  # https://github.com/mxcube
5
5
  #
6
6
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube.
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube.
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube.
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  #
3
- # Project: MXCuBE
3
+ # Project name: MXCuBE
4
4
  # https://github.com/mxcube.
5
5
  #
6
6
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  #
3
- # Project: MXCuBE
3
+ # Project name: MXCuBE
4
4
  # https://github.com/mxcube
5
5
  #
6
6
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  #
3
- # Project: MXCuBE
3
+ # Project name: MXCuBE
4
4
  # https://github.com/mxcube
5
5
  #
6
6
  # This file is part of MXCuBE software.
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  #
3
- # Project: MXCuBE
3
+ # Project name: MXCuBE
4
4
  # https://github.com/mxcube
5
5
  #
6
6
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  #
3
- # Project: MXCuBE
3
+ # Project name: MXCuBE
4
4
  # https://github.com/mxcube
5
5
  #
6
6
  # This file is part of MXCuBE software.
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  #
3
- # Project: MXCuBE
3
+ # Project name: MXCuBE
4
4
  # https://github.com/mxcube
5
5
  #
6
6
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,4 +1,4 @@
1
- # Project: MXCuBE
1
+ # Project name: MXCuBE
2
2
  # https://github.com/mxcube
3
3
  #
4
4
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Project: MXCuBE
3
+ # Project name: MXCuBE
4
4
  # https://github.com/mxcube
5
5
  #
6
6
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,4 +1,4 @@
1
- # Project: MXCuBE
1
+ # Project name: MXCuBE
2
2
  # https://github.com/mxcube
3
3
  #
4
4
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  #
3
- # Project: MXCuBE
3
+ # Project name: MXCuBE
4
4
  # https://github.com/mxcube
5
5
  #
6
6
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  #
3
- # Project: MXCuBE
3
+ # Project name: MXCuBE
4
4
  # https://github.com/mxcube
5
5
  #
6
6
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  #
3
- # Project: MXCuBE
3
+ # Project name: MXCuBE
4
4
  # https://github.com/mxcube
5
5
  #
6
6
  # This file is part of MXCuBE software.
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  #
3
- # Project: MXCuBE
3
+ # Project name: MXCuBE
4
4
  # https://github.com/mxcube
5
5
  #
6
6
  # This file is part of MXCuBE software.
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  #
3
- # Project: MXCuBE
3
+ # Project name: MXCuBE
4
4
  # https://github.com/mxcube
5
5
  #
6
6
  # This file is part of MXCuBE software.
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  #
3
- # Project: MXCuBE
3
+ # Project name: MXCuBE
4
4
  # https://github.com/mxcube
5
5
  #
6
6
  # This file is part of MXCuBE software.
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  #
3
- # Project: MXCuBE
3
+ # Project name: MXCuBE
4
4
  # https://github.com/mxcube
5
5
  #
6
6
  # This file is part of MXCuBE software.
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Project: MXCuBE
3
+ # Project name: MXCuBE
4
4
  # https://github.com/mxcube
5
5
  #
6
6
  # This file is part of MXCuBE software.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Project: MXCuBE
2
+ # Project name: MXCuBE
3
3
  # https://github.com/mxcube
4
4
  #
5
5
  # This file is part of MXCuBE software.