mxcubecore 1.383.0__py3-none-any.whl → 1.385.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.
@@ -326,9 +326,9 @@ class ICATLIMS(AbstractLims):
326
326
  )
327
327
  if sample_information is not None:
328
328
  if len(HWR.beamline.session.get_full_path("", "")) > 0:
329
- destination_folder = HWR.beamline.session.get_full_path("", "")[
330
- 0
331
- ]
329
+ destination_folder = (
330
+ HWR.beamline.session.get_base_process_directory()
331
+ )
332
332
  msg = "Download restource: "
333
333
  msg += f"sample_sheet_id={sample_sheet_id} "
334
334
  msg += f"destination_folder={destination_folder}"
@@ -820,21 +820,20 @@ class ICATLIMS(AbstractLims):
820
820
  msg = f"Sample {sample_id} not found"
821
821
  logging.getLogger("HWR").debug(msg)
822
822
 
823
- start_time = datacollection_dict.get("startTime", "")
824
- end_time = datacollection_dict.get("endTime", "")
823
+ start_time = datacollection_dict.get("collection_start_time", "")
824
+ end_time = datetime.now(ZoneInfo("Europe/Paris")).isoformat()
825
825
 
826
- try:
827
- dt_aware = datetime.strptime(start_time, "%Y-%m-%d %H:%M:%S").replace(
828
- tzinfo=ZoneInfo("Europe/Paris")
829
- )
830
- dt_aware_end = datetime.strptime(end_time, "%Y-%m-%d %H:%M:%S").replace(
831
- tzinfo=ZoneInfo("Europe/Paris")
832
- )
826
+ if start_time:
827
+ try:
828
+ dt_aware = datetime.strptime(start_time, "%Y-%m-%d %H:%M:%S").replace(
829
+ tzinfo=ZoneInfo("Europe/Paris")
830
+ )
831
+ start_time = dt_aware.isoformat(timespec="microseconds")
832
+ except (ValueError, TypeError):
833
+ logging.getLogger("HWR").exception("Cannot parse start time")
834
+ else:
835
+ start_time = datetime.now(ZoneInfo("Europe/Paris")).isoformat()
833
836
 
834
- start_time = dt_aware.isoformat(timespec="microseconds")
835
- end_time = dt_aware_end.isoformat(timespec="microseconds")
836
- except TypeError:
837
- logging.getLogger("HWR").exception("Cannot parse start and end time")
838
837
  bsx, bsy, shape, _ = HWR.beamline.beam.get_value()
839
838
  flux_end = datacollection_dict.get("flux_end") or HWR.beamline.flux.get_value()
840
839
 
@@ -887,6 +886,29 @@ class ICATLIMS(AbstractLims):
887
886
 
888
887
  directory = Path(energyscan_dict["scanFileFullPath"]).parent
889
888
 
889
+ start_time = energyscan_dict.get("startTime", "")
890
+ end_time = energyscan_dict.get("endTime", "")
891
+
892
+ if start_time:
893
+ try:
894
+ dt_aware = datetime.strptime(
895
+ start_time, "%Y-%m-%d %H:%M:%S"
896
+ ).replace(tzinfo=ZoneInfo("Europe/Paris"))
897
+ start_time = dt_aware.isoformat(timespec="microseconds")
898
+ metadata.update({"startDate": start_time})
899
+ except (ValueError, TypeError):
900
+ logging.getLogger("HWR").exception("Cannot parse start time")
901
+
902
+ if end_time:
903
+ try:
904
+ dt_aware = datetime.strptime(end_time, "%Y-%m-%d %H:%M:%S").replace(
905
+ tzinfo=ZoneInfo("Europe/Paris")
906
+ )
907
+ end_time = dt_aware.isoformat(timespec="microseconds")
908
+ metadata.update({"endDate": end_time})
909
+ except (ValueError, TypeError):
910
+ logging.getLogger("HWR").exception("Cannot parse start time")
911
+
890
912
  metadata.update(
891
913
  {
892
914
  "scanType": "energy_scan",
@@ -940,6 +962,29 @@ class ICATLIMS(AbstractLims):
940
962
 
941
963
  directory = Path(xfespectrum_dict["filename"]).parent
942
964
 
965
+ start_time = xfespectrum_dict.get("startTime", "")
966
+ end_time = xfespectrum_dict.get("endTime", "")
967
+
968
+ if start_time:
969
+ try:
970
+ dt_aware = datetime.strptime(
971
+ start_time, "%Y-%m-%d %H:%M:%S"
972
+ ).replace(tzinfo=ZoneInfo("Europe/Paris"))
973
+ start_time = dt_aware.isoformat(timespec="microseconds")
974
+ metadata.update({"startDate": start_time})
975
+ except (ValueError, TypeError):
976
+ logging.getLogger("HWR").exception("Cannot parse start time")
977
+
978
+ if end_time:
979
+ try:
980
+ dt_aware = datetime.strptime(end_time, "%Y-%m-%d %H:%M:%S").replace(
981
+ tzinfo=ZoneInfo("Europe/Paris")
982
+ )
983
+ end_time = dt_aware.isoformat(timespec="microseconds")
984
+ metadata.update({"endDate": end_time})
985
+ except (ValueError, TypeError):
986
+ logging.getLogger("HWR").exception("Cannot parse end time")
987
+
943
988
  metadata.update(
944
989
  {
945
990
  "scanType": "xrf",
@@ -1045,7 +1090,7 @@ class ICATLIMS(AbstractLims):
1045
1090
  try:
1046
1091
  token = self.icat_session["sessionId"]
1047
1092
  url = f"{self.url}/catalogue/{token}/files/download?sampleId={sample_id}&resourceId={resource.id}"
1048
- response = requests.get(url, stream=True, timeout=3)
1093
+ response = requests.get(url, stream=True, timeout=30)
1049
1094
  response.raise_for_status()
1050
1095
 
1051
1096
  file_path = resource_folder / resource.filename
@@ -1110,15 +1155,6 @@ class ICATLIMS(AbstractLims):
1110
1155
  proposal = f"{HWR.beamline.session.proposal_code}"
1111
1156
  proposal += f"{HWR.beamline.session.proposal_number}"
1112
1157
 
1113
- try:
1114
- dt_aware = datetime.strptime(
1115
- datacollection_dict.get("collection_start_time"),
1116
- "%Y-%m-%d %H:%M:%S",
1117
- ).replace(tzinfo=ZoneInfo("Europe/Paris"))
1118
- start_time = dt_aware.isoformat(timespec="microseconds")
1119
- except RuntimeError:
1120
- logger.warning("Failed to parse start and end time")
1121
-
1122
1158
  metadata.update(
1123
1159
  {
1124
1160
  "MX_dataCollectionId": datacollection_dict.get("collection_id"),
@@ -1149,7 +1185,6 @@ class ICATLIMS(AbstractLims):
1149
1185
  ),
1150
1186
  "MX_position_id": workflow_params.get("workflow_position_id"),
1151
1187
  "group_by": workflow_params.get("workflow_group_by"),
1152
- "startDate": start_time,
1153
1188
  }
1154
1189
  )
1155
1190
 
@@ -1171,7 +1206,7 @@ class ICATLIMS(AbstractLims):
1171
1206
  )
1172
1207
 
1173
1208
  try:
1174
- metadata["lims"] = HWR.beamline.lims.get_active_lims()
1209
+ metadata["lims"] = HWR.beamline.lims.get_active_lims().name
1175
1210
  except Exception:
1176
1211
  logger.exception("Failed to read get_active_lims.")
1177
1212
 
@@ -1010,10 +1010,11 @@ class MiniDiff(HardwareObject):
1010
1010
  time.sleep(0.1)
1011
1011
 
1012
1012
  def take_snapshot(self, image_path_list: list) -> None:
1013
- if self.get_current_phase() != "Centring":
1014
- use_custom_snapshot_routine = self.get_property(
1015
- "custom_snapshot_script_dir", False
1016
- )
1013
+ if len(image_path_list) > 0:
1014
+ if self.get_current_phase() != "Centring":
1015
+ use_custom_snapshot_routine = self.get_property(
1016
+ "custom_snapshot_script_dir", False
1017
+ )
1017
1018
 
1018
1019
  if not use_custom_snapshot_routine:
1019
1020
  self.set_phase("Centring", wait=True, timeout=200)
@@ -1024,7 +1025,9 @@ class MiniDiff(HardwareObject):
1024
1025
  f"Taking {snapshot_index + 1} sample snapshot(s)"
1025
1026
  )
1026
1027
  HWR.beamline.sample_view.save_snapshot(path=image_path)
1027
- self.phiMotor.set_value_relative(90, timeout=5)
1028
+ # do not move 90 degrees if not needed
1029
+ if not self.in_plate_mode() and snapshot_index < len(image_path_list) - 1:
1030
+ self.phiMotor.set_value_relative(90, timeout=5)
1028
1031
 
1029
1032
  def snapshotsDone(self, snapshotsProcedure):
1030
1033
  HWR.beamline.sample_view.camera.forceUpdate = False
@@ -315,6 +315,10 @@ class AbstractMultiCollect(object):
315
315
  pass
316
316
 
317
317
  def take_snapshots(self, dc_params):
318
+ # do nothing if no snapshots asked
319
+ if not self.number_of_snapshots:
320
+ return
321
+
318
322
  snapshot_directory = dc_params["fileinfo"]["archive_directory"]
319
323
 
320
324
  if HWR.beamline.diffractometer.in_plate_mode():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mxcubecore
3
- Version: 1.383.0
3
+ Version: 1.385.0
4
4
  Summary: Core libraries for the MXCuBE application
5
5
  License: LGPL-3.0-or-later
6
6
  Keywords: mxcube,mxcube3,mxcubecore
@@ -196,7 +196,7 @@ mxcubecore/HardwareObjects/GrobMotor.py,sha256=l5A9Us_ceLXlhEF6RNwyXQsI56fJiobWh
196
196
  mxcubecore/HardwareObjects/GrobSampleChanger.py,sha256=LMetcL45fWrwP4C8rtENrEDNydelLpJ77SD1JC5C3go,8113
197
197
  mxcubecore/HardwareObjects/Harvester.py,sha256=0TYUXmz-Pmfd7Dhz7ToUGHzJRuJmnga8-4BK4B0KGQA,26524
198
198
  mxcubecore/HardwareObjects/HarvesterMaintenance.py,sha256=8s4yHDEFG-C1WYyW_RlwrFPSpc8o5hGi14aQuFQFrHs,9405
199
- mxcubecore/HardwareObjects/ICATLIMS.py,sha256=irvsn5xLy0CZpheFG_UGUzFO1nIKn5Mz3GVGZt9c2ic,53129
199
+ mxcubecore/HardwareObjects/ICATLIMS.py,sha256=YMlha9sg6U1EWSiKZ1Uy8fbud9XdfYNH9-oHESwPD34,54814
200
200
  mxcubecore/HardwareObjects/ISARAMaint.py,sha256=I8LHXK6wCfzixsxWmmcqWlrdaL3AOX91XmVeAwT7GPk,8959
201
201
  mxcubecore/HardwareObjects/LNLS/EPICSActuator.py,sha256=3dDj6aXyTz03m8osdA6udq_a4bch-KNcUMrXSNvbG5Q,2587
202
202
  mxcubecore/HardwareObjects/LNLS/EPICSMotor.py,sha256=lRTc1t32rJKNTIcnKCECrqo2m9BhlYvLq9NWg4Y0w0Q,3576
@@ -245,7 +245,7 @@ mxcubecore/HardwareObjects/MicrodiffLightBeamstop.py,sha256=yg70YumCOhdlGhT7Jzgm
245
245
  mxcubecore/HardwareObjects/MicrodiffMotor.py,sha256=RTY3D2b2hkRuVzfkrzUq-v1fMBuVKwBIjWSIN2znwHM,9409
246
246
  mxcubecore/HardwareObjects/MicrodiffSamplePseudo.py,sha256=pWwpNRjnrqLyE0-2JQrJRHc7MqLSbvZuK9f14deTzKo,3675
247
247
  mxcubecore/HardwareObjects/MicrodiffZoom.py,sha256=_TaJy-w1zKZg2rlTyVOnMwWcDbYfymovqRwJSewA5Ss,3826
248
- mxcubecore/HardwareObjects/MiniDiff.py,sha256=3T-9CeixU0FEmIAykW-21G1k23NWVAAtuaS7qHjaMAo,38577
248
+ mxcubecore/HardwareObjects/MiniDiff.py,sha256=xndF_HdSJ5M-tfDWmkso19ff2ekOsf0XDW3o1kxgDh4,38772
249
249
  mxcubecore/HardwareObjects/MiniKappaCorrection.py,sha256=qo2bI76hRySjvdOEwidwE09DD748oiqxX7tfsRRecm0,3426
250
250
  mxcubecore/HardwareObjects/MinidiffAperture.py,sha256=wIgXXzbMCncF2y3pe0Ygy3K4el5XrsdHCdvE1Dh2yuA,1422
251
251
  mxcubecore/HardwareObjects/MotorWPositions.py,sha256=QDX8yF8KTTh75e4H-k0f1AaavGiXF-qce86IgVFLeiU,5633
@@ -354,7 +354,7 @@ mxcubecore/HardwareObjects/abstract/AbstractLims.py,sha256=8EwvJ8xOlmsKgYiSZXuc0
354
354
  mxcubecore/HardwareObjects/abstract/AbstractMCA.py,sha256=vqu3RqZ1YYtjYZCyV7iD3Sc5f_Vjbc18qfcNTdoQ3dQ,4443
355
355
  mxcubecore/HardwareObjects/abstract/AbstractMachineInfo.py,sha256=vZ1qKSNFrrBP-7xnzu92zThMH-U_Fz5Av-3ml1NWhM8,3959
356
356
  mxcubecore/HardwareObjects/abstract/AbstractMotor.py,sha256=EuQwFocgcE2cNjHkwgEQqzz5jSh5vVaJvf3_m7QhArU,3411
357
- mxcubecore/HardwareObjects/abstract/AbstractMultiCollect.py,sha256=-Tgb7l_Ovv4IQIFqEis-HnUAZh3-gze16IbdVdKkHBc,51580
357
+ mxcubecore/HardwareObjects/abstract/AbstractMultiCollect.py,sha256=gn3cZ-lBrS77IQWO5ueF8n-cHgQrFNeJ60Eceij4Jqo,51684
358
358
  mxcubecore/HardwareObjects/abstract/AbstractNState.py,sha256=JZvD_ZpQu5U8ycaWFiijSfkfo8HfBN84hSDfpq0hyOE,4016
359
359
  mxcubecore/HardwareObjects/abstract/AbstractOnlineProcessing.py,sha256=vs_fJsDDLwivu1kYHA7RKJXj1aTH5V6G2tEy7MYGw4c,34104
360
360
  mxcubecore/HardwareObjects/abstract/AbstractProcedure.py,sha256=kW2SzN5kYYCeOS2IzpzQ9VAjYAoRU7ZtyDxqrOb8Pbg,7849
@@ -467,8 +467,8 @@ mxcubecore/utils/conversion.py,sha256=G1bk2Mi2ZwGbZa5pEeiFaKWxhSVXVGqu1L9_SioyUO
467
467
  mxcubecore/utils/qt_import.py,sha256=0lPmqok_oYQZ059kJCq7RWdg490T8YKyRvoZGyWDy4M,14486
468
468
  mxcubecore/utils/tango.py,sha256=vwEVrIrWKEFaeaJUz3xbaC7XWHY8ZeJ-pfcSrTfZPIE,2114
469
469
  mxcubecore/utils/units.py,sha256=Gh7ovTUN00XBMUoyDG5W7akCx1pROL-M6pK2z1ouemg,1361
470
- mxcubecore-1.383.0.dist-info/COPYING,sha256=u-Mc8zCecwyo4YoP8UulmzCiZZ_MmCLROd_NBtOcRj0,35148
471
- mxcubecore-1.383.0.dist-info/COPYING.LESSER,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
472
- mxcubecore-1.383.0.dist-info/METADATA,sha256=nrnsJBWuJJo-Js9kkMNx0i9UBzuIPDzKXmLe15D0LiY,4259
473
- mxcubecore-1.383.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
474
- mxcubecore-1.383.0.dist-info/RECORD,,
470
+ mxcubecore-1.385.0.dist-info/COPYING,sha256=u-Mc8zCecwyo4YoP8UulmzCiZZ_MmCLROd_NBtOcRj0,35148
471
+ mxcubecore-1.385.0.dist-info/COPYING.LESSER,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
472
+ mxcubecore-1.385.0.dist-info/METADATA,sha256=d6DL9ewkJo3Af0JVnsNJYSP8M-IgUZCAlne5d-1Pjsw,4259
473
+ mxcubecore-1.385.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
474
+ mxcubecore-1.385.0.dist-info/RECORD,,