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.
- mxcubecore/BaseHardwareObjects.py +1 -1
- mxcubecore/Command/Epics.py +1 -1
- mxcubecore/Command/Exporter.py +1 -1
- mxcubecore/Command/Mockup.py +1 -1
- mxcubecore/Command/Pool.py +1 -1
- mxcubecore/Command/Sardana.py +1 -1
- mxcubecore/Command/Spec.py +1 -1
- mxcubecore/Command/Taco.py +1 -1
- mxcubecore/Command/Tango.py +1 -1
- mxcubecore/Command/Tine.py +1 -1
- mxcubecore/Command/exporter/ExporterClient.py +1 -1
- mxcubecore/Command/exporter/ExporterStates.py +1 -1
- mxcubecore/Command/exporter/StandardClient.py +1 -1
- mxcubecore/CommandContainer.py +1 -1
- mxcubecore/HardwareObjectFileParser.py +1 -1
- mxcubecore/HardwareObjects/ALBA/ALBACalibration.py +1 -1
- mxcubecore/HardwareObjects/ALBA/ALBACollect.py +1 -1
- mxcubecore/HardwareObjects/ALBA/ALBAMachineInfo.py +1 -1
- mxcubecore/HardwareObjects/ALBA/ALBAMiniDiff.py +1 -1
- mxcubecore/HardwareObjects/ALBA/ALBAPilatus.py +1 -1
- mxcubecore/HardwareObjects/ALBA/ALBAZoomMotor.py +1 -1
- mxcubecore/HardwareObjects/ALBA/ALBAZoomMotorAutoBrightness.py +1 -1
- mxcubecore/HardwareObjects/ALBA/XalocMachineInfo.py +1 -1
- mxcubecore/HardwareObjects/Attenuators.py +1 -1
- mxcubecore/HardwareObjects/Beamline.py +1 -1
- mxcubecore/HardwareObjects/BeamlineTools.py +1 -1
- mxcubecore/HardwareObjects/Bliss.py +1 -1
- mxcubecore/HardwareObjects/BlissEnergy.py +1 -1
- mxcubecore/HardwareObjects/BlissMotor.py +1 -1
- mxcubecore/HardwareObjects/BlissNState.py +1 -1
- mxcubecore/HardwareObjects/BlissShutter.py +1 -1
- mxcubecore/HardwareObjects/DESY/Centring.py +1 -1
- mxcubecore/HardwareObjects/DESY/DigitalZoomMotor.py +1 -1
- mxcubecore/HardwareObjects/DESY/MjpgStreamVideo.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11AlbulaView.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11BackLight.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11Beam.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11BeamStop.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11Collect.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11Collimator.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11DetectorCover.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11DetectorDistance.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11DoorInterlock.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11EDNACharacterisation.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11EigerDetector.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11Energy.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11FastShutter.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11Flux.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11ISPyBClient.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11MachineInfo.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11NanoDiff.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11Pinhole.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11SampleChanger.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11Session.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11Shutter.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11Transmission.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11YagDiode.py +1 -1
- mxcubecore/HardwareObjects/DESY/P11Zoom.py +1 -1
- mxcubecore/HardwareObjects/DESY/ValueStateChannel.py +1 -1
- mxcubecore/HardwareObjects/DataPublisher.py +1 -1
- mxcubecore/HardwareObjects/DozorOnlineProcessing.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLAperture.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLBSD.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLBeam.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLBeamCentering.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLBeamFocusing.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLBeamlineTest.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLBeamstop.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLCRL.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLCollect.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLDetector.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLDoorInterlock.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLEnergy.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLEnergyScan.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLExporterClient.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLFlux.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLImageTracking.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLMachineInfo.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLMiniDiff.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLMotorsGroup.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLOfflineProcessing.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLOnlineProcessing.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLPiezoMotor.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLQueueEntry.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLResolution.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLSSXChip.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLSafetyShutter.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLSession.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLSlitBox.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLTableMotor.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLTransfocator.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLTransmission.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLXRFSpectrum.py +1 -1
- mxcubecore/HardwareObjects/EMBL/EMBLXrayImaging.py +1 -1
- mxcubecore/HardwareObjects/EMBL/MDFastShutter.py +1 -1
- mxcubecore/HardwareObjects/EMBL/TINEMotor.py +1 -1
- mxcubecore/HardwareObjects/EMBLFlexHCD.py +1 -1
- mxcubecore/HardwareObjects/EMBLFlexHarvester.py +1 -1
- mxcubecore/HardwareObjects/ESRF/BlissHutchTrigger.py +1 -1
- mxcubecore/HardwareObjects/ESRF/ESRFBeam.py +1 -1
- mxcubecore/HardwareObjects/ESRF/ESRFBeamDefiner.py +1 -1
- mxcubecore/HardwareObjects/ESRF/ESRFBeamlineActions.py +1 -1
- mxcubecore/HardwareObjects/ESRF/ESRFPhotonFlux.py +1 -1
- mxcubecore/HardwareObjects/ESRF/ESRFXRFSpectrum.py +76 -55
- mxcubecore/HardwareObjects/ESRF/ID232BeamDefiner.py +1 -1
- mxcubecore/HardwareObjects/ESRF/ID30A3BeamDefiner.py +1 -1
- mxcubecore/HardwareObjects/ESRF/OxfordCryostream.py +1 -1
- mxcubecore/HardwareObjects/ESRF/Transmission.py +1 -1
- mxcubecore/HardwareObjects/ESRFLIMS.py +7 -5
- mxcubecore/HardwareObjects/ExporterMotor.py +1 -1
- mxcubecore/HardwareObjects/ExporterNState.py +1 -1
- mxcubecore/HardwareObjects/GenericDiffractometer.py +1 -1
- mxcubecore/HardwareObjects/Gphl/GphlQueueEntry.py +1 -1
- mxcubecore/HardwareObjects/Harvester.py +1 -1
- mxcubecore/HardwareObjects/HarvesterMaintenance.py +1 -1
- mxcubecore/HardwareObjects/ICATLIMS.py +104 -34
- mxcubecore/HardwareObjects/LNLS/LNLSAperture.py +1 -1
- mxcubecore/HardwareObjects/LNLS/LNLSBeam.py +1 -1
- mxcubecore/HardwareObjects/LNLS/LNLSDiffractometer.py +1 -1
- mxcubecore/HardwareObjects/LNLS/LNLSEnergy.py +1 -1
- mxcubecore/HardwareObjects/LNLS/LNLSSlits.py +1 -1
- mxcubecore/HardwareObjects/LNLS/LNLSTransmission.py +1 -1
- mxcubecore/HardwareObjects/MAXIV/MAXIVAutoProcessing.py +1 -1
- mxcubecore/HardwareObjects/MachCurrent.py +1 -1
- mxcubecore/HardwareObjects/Marvin.py +1 -1
- mxcubecore/HardwareObjects/MicrodiffAperture.py +1 -1
- mxcubecore/HardwareObjects/MicrodiffZoom.py +1 -1
- mxcubecore/HardwareObjects/MotorWPositions.py +1 -1
- mxcubecore/HardwareObjects/MotorsNPosition.py +1 -1
- mxcubecore/HardwareObjects/NState.py +1 -1
- mxcubecore/HardwareObjects/QtAxisCamera.py +1 -1
- mxcubecore/HardwareObjects/QtGraphicsLib.py +1 -1
- mxcubecore/HardwareObjects/QtGraphicsManager.py +1 -1
- mxcubecore/HardwareObjects/QtLimaVideo.py +1 -1
- mxcubecore/HardwareObjects/QtTangoLimaVideo.py +1 -1
- mxcubecore/HardwareObjects/QueueModel.py +1 -1
- mxcubecore/HardwareObjects/RedisClient.py +1 -1
- mxcubecore/HardwareObjects/Resolution.py +1 -1
- mxcubecore/HardwareObjects/SOLEIL/PX1/PX1Pilatus.py +1 -1
- mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Collect.py +1 -1
- mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Diffractometer.py +1 -1
- mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Qt4_LimaVideo.py +1 -1
- mxcubecore/HardwareObjects/SOLEIL/PX2/PX2Video.py +1 -1
- mxcubecore/HardwareObjects/SOLEIL/SOLEILMachineInfo.py +1 -1
- mxcubecore/HardwareObjects/SampleView.py +1 -1
- mxcubecore/HardwareObjects/StateMachine.py +1 -1
- mxcubecore/HardwareObjects/TangoLimaVideoDevice.py +1 -1
- mxcubecore/HardwareObjects/TangoMotor.py +1 -1
- mxcubecore/HardwareObjects/TangoShutter.py +1 -1
- mxcubecore/HardwareObjects/UnitTest.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractActuator.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractAperture.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractAuthenticator.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractBeam.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractCharacterisation.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractCollect.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractDetector.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractEnergy.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractFlux.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractLims.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractMachineInfo.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractMotor.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractNState.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractOnlineProcessing.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractProcedure.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractResolution.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractSampleChanger.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractSampleView.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractShutter.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractSlits.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractTransmission.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractVideoDevice.py +1 -1
- mxcubecore/HardwareObjects/abstract/AbstractXRFSpectrum.py +44 -36
- mxcubecore/HardwareObjects/mockup/ActuatorMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/ApertureMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/BeamDefinerMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/BeamMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/BeamlineTestMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/BeamstopMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/CollectMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/DiffractometerMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/DoorInterlockMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/EDNACharacterisationMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/EnergyMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/ExporterNStateMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/FluxMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/HarvesterMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/MotorMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/MotorMockupBis.py +1 -1
- mxcubecore/HardwareObjects/mockup/OfflineProcessingMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/OnlineProcessingMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/PlateManipulatorMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/QtVideoMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/ScanMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/ShutterMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/SlitsMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/TransmissionMockup.py +1 -1
- mxcubecore/HardwareObjects/mockup/XRFSpectrumMockup.py +1 -1
- mxcubecore/HardwareRepository.py +1 -1
- mxcubecore/model/queue_model_enumerables.py +1 -1
- mxcubecore/model/queue_model_objects.py +1 -1
- mxcubecore/queue_entry/__init__.py +1 -1
- mxcubecore/queue_entry/advanced_connector.py +1 -1
- mxcubecore/queue_entry/base_queue_entry.py +1 -1
- mxcubecore/queue_entry/characterisation.py +1 -1
- mxcubecore/queue_entry/data_collection.py +1 -1
- mxcubecore/queue_entry/energy_scan.py +1 -1
- mxcubecore/queue_entry/generic_workflow.py +1 -1
- mxcubecore/queue_entry/import_helper.py +1 -1
- mxcubecore/queue_entry/optical_centring.py +1 -1
- mxcubecore/queue_entry/sample_centring.py +1 -1
- mxcubecore/queue_entry/xray_centering.py +1 -1
- mxcubecore/queue_entry/xray_centering2.py +1 -1
- mxcubecore/queue_entry/xrf_spectrum.py +7 -7
- {mxcubecore-1.329.0.dist-info → mxcubecore-1.331.0.dist-info}/METADATA +1 -1
- {mxcubecore-1.329.0.dist-info → mxcubecore-1.331.0.dist-info}/RECORD +219 -219
- {mxcubecore-1.329.0.dist-info → mxcubecore-1.331.0.dist-info}/COPYING +0 -0
- {mxcubecore-1.329.0.dist-info → mxcubecore-1.331.0.dist-info}/COPYING.LESSER +0 -0
- {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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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.
|
|
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":
|
|
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(
|
|
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
|
|
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,
|
|
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(
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
513
|
+
def get_session_by_id(self, sid: str):
|
|
511
514
|
logger.debug(
|
|
512
515
|
"get_session_by_id investigationId=%s investigations=%s",
|
|
513
|
-
|
|
516
|
+
sid,
|
|
514
517
|
str(len(self.investigations)),
|
|
515
518
|
)
|
|
516
|
-
investigation_list = list(filter(lambda p: p["id"] ==
|
|
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
|
-
|
|
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
|
|
806
|
-
logger.exception(
|
|
808
|
+
except Exception:
|
|
809
|
+
logger.exception()
|
|
807
810
|
return position, sample_position
|
|
808
|
-
except Exception
|
|
809
|
-
logger.exception(
|
|
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,
|
|
821
|
-
|
|
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
|
|
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
|
|
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 =
|
|
894
|
-
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 =
|
|
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 =
|
|
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 =
|
|
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
|