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,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.
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
|
|
23
23
|
import abc
|
|
24
24
|
import logging
|
|
25
|
-
import os
|
|
26
25
|
import time
|
|
26
|
+
from pathlib import Path
|
|
27
27
|
|
|
28
28
|
import gevent
|
|
29
29
|
|
|
@@ -73,29 +73,31 @@ class AbstractXRFSpectrum(HardwareObject):
|
|
|
73
73
|
|
|
74
74
|
def start_spectrum(
|
|
75
75
|
self,
|
|
76
|
-
integration_time=None,
|
|
77
|
-
data_dir=None,
|
|
78
|
-
prefix=None,
|
|
79
|
-
archive_dir=None,
|
|
80
|
-
session_id=None,
|
|
81
|
-
blsample_id=None,
|
|
82
|
-
cpos=None,
|
|
76
|
+
integration_time: float | None = None,
|
|
77
|
+
data_dir: str | None = None,
|
|
78
|
+
prefix: str | None = None,
|
|
79
|
+
archive_dir: str | None = None,
|
|
80
|
+
session_id: int | None = None,
|
|
81
|
+
blsample_id: int | None = None,
|
|
82
|
+
cpos: dict | None = None,
|
|
83
83
|
):
|
|
84
84
|
"""Start the procedure. Called by the queue_model.
|
|
85
85
|
|
|
86
86
|
Args:
|
|
87
|
-
integration_time
|
|
88
|
-
data_dir
|
|
89
|
-
archive_dir
|
|
90
|
-
prefix
|
|
91
|
-
session_id
|
|
92
|
-
blsample_id
|
|
87
|
+
integration_time: Inregration time [s].
|
|
88
|
+
data_dir: Directory to save the data (full path).
|
|
89
|
+
archive_dir: Directory to save the archive data (full path).
|
|
90
|
+
prefix: File prefix
|
|
91
|
+
session_id: Session ID number (from ISpyB)
|
|
92
|
+
blsample_id: Sample ID number (from ISpyB)
|
|
93
|
+
cpos: The centred position motors and their values.
|
|
93
94
|
"""
|
|
94
95
|
self.cpos = cpos
|
|
95
96
|
self.spectrum_info_dict = {"sessionId": session_id, "blSampleId": blsample_id}
|
|
96
97
|
integration_time = integration_time or self.default_integration_time
|
|
97
98
|
self.spectrum_info_dict["exposureTime"] = integration_time
|
|
98
99
|
self.spectrum_info_dict["filename"] = ""
|
|
100
|
+
|
|
99
101
|
# Create the data and the archive directory (if needed) and files
|
|
100
102
|
if data_dir:
|
|
101
103
|
if not self.create_directory(data_dir):
|
|
@@ -125,12 +127,16 @@ class AbstractXRFSpectrum(HardwareObject):
|
|
|
125
127
|
)
|
|
126
128
|
return True
|
|
127
129
|
|
|
128
|
-
def execute_spectrum(
|
|
130
|
+
def execute_spectrum(
|
|
131
|
+
self,
|
|
132
|
+
integration_time: float | None = None,
|
|
133
|
+
filename: str | None = None,
|
|
134
|
+
):
|
|
129
135
|
"""Do the acquisition.
|
|
130
136
|
|
|
131
137
|
Args:
|
|
132
|
-
integration_time
|
|
133
|
-
filename
|
|
138
|
+
integration_time: MCA integration time [s].
|
|
139
|
+
filename: Data file (full path).
|
|
134
140
|
Raises:
|
|
135
141
|
RuntimeError: Cannot acquire data.
|
|
136
142
|
"""
|
|
@@ -149,23 +155,27 @@ class AbstractXRFSpectrum(HardwareObject):
|
|
|
149
155
|
self.update_state(self.STATES.FAULT)
|
|
150
156
|
|
|
151
157
|
@abc.abstractmethod
|
|
152
|
-
def _execute_spectrum(
|
|
158
|
+
def _execute_spectrum(
|
|
159
|
+
self,
|
|
160
|
+
integration_time: float | None = None,
|
|
161
|
+
filename: str | None = None,
|
|
162
|
+
) -> bool:
|
|
153
163
|
"""Specific XRF acquisition procedure"""
|
|
154
164
|
return True
|
|
155
165
|
|
|
156
|
-
def create_directory(self, directory):
|
|
166
|
+
def create_directory(self, directory: str) -> bool:
|
|
157
167
|
"""Create a directory, if needed.
|
|
158
168
|
Args:
|
|
159
|
-
directory
|
|
169
|
+
directory: Directory to save the data (full path).
|
|
160
170
|
Returns:
|
|
161
|
-
|
|
171
|
+
``True`` if directory created or already exists, ``False`` if error.
|
|
162
172
|
"""
|
|
163
|
-
if not
|
|
173
|
+
if not Path(directory).is_dir():
|
|
164
174
|
msg = f"XRFSpectrum: directory creating {directory}"
|
|
165
175
|
try:
|
|
166
|
-
if not
|
|
176
|
+
if not Path(directory).exists():
|
|
167
177
|
logging.getLogger("user_level_log").debug(msg)
|
|
168
|
-
|
|
178
|
+
Path(directory).mkdir(parents=True)
|
|
169
179
|
return True
|
|
170
180
|
except OSError as err:
|
|
171
181
|
msg += f": {err}"
|
|
@@ -175,7 +185,7 @@ class AbstractXRFSpectrum(HardwareObject):
|
|
|
175
185
|
return False
|
|
176
186
|
return True
|
|
177
187
|
|
|
178
|
-
def get_filename(self, directory, prefix):
|
|
188
|
+
def get_filename(self, directory: str, prefix: str) -> str:
|
|
179
189
|
"""Create file template.
|
|
180
190
|
Args:
|
|
181
191
|
directory(str): directory name (full path)
|
|
@@ -183,19 +193,16 @@ class AbstractXRFSpectrum(HardwareObject):
|
|
|
183
193
|
(str): File template
|
|
184
194
|
"""
|
|
185
195
|
_pattern = f"{prefix}_{time.strftime('%d_%b_%Y')}_%02d_xrf"
|
|
186
|
-
|
|
187
|
-
filename = filename_pattern % 1
|
|
188
|
-
# fileprefix = _pattern % 1
|
|
196
|
+
filename = Path(directory) / (_pattern % 1)
|
|
189
197
|
|
|
190
198
|
i = 2
|
|
191
|
-
while
|
|
192
|
-
filename =
|
|
193
|
-
|
|
194
|
-
i = i + 1
|
|
199
|
+
while Path(filename).is_file():
|
|
200
|
+
filename = Path(directory) / (_pattern % i)
|
|
201
|
+
i += 1
|
|
195
202
|
|
|
196
|
-
return filename
|
|
203
|
+
return str(filename)
|
|
197
204
|
|
|
198
|
-
def spectrum_status_change(self, status_msg):
|
|
205
|
+
def spectrum_status_change(self, status_msg: str):
|
|
199
206
|
"""Emit the signal xrfSpectrumStatusChanged with appropriate message.
|
|
200
207
|
Args:
|
|
201
208
|
status_msg(str): Message to send.
|
|
@@ -224,7 +231,8 @@ class AbstractXRFSpectrum(HardwareObject):
|
|
|
224
231
|
|
|
225
232
|
def spectrum_analyse(self):
|
|
226
233
|
"""Get the spectrum data. Do analysis and save fitted data.
|
|
227
|
-
The method has to be implemented as specific for each site
|
|
234
|
+
The method has to be implemented as specific for each site, but
|
|
235
|
+
is only optional.
|
|
228
236
|
"""
|
|
229
237
|
|
|
230
238
|
def spectrum_command_aborted(self):
|
mxcubecore/HardwareRepository.py
CHANGED
|
@@ -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.
|
|
@@ -43,12 +43,12 @@ class XrfSpectrumQueueEntry(BaseQueueEntry):
|
|
|
43
43
|
super().__init__(view, data_model)
|
|
44
44
|
self._failed = False
|
|
45
45
|
|
|
46
|
-
def __getstate__(self):
|
|
46
|
+
def __getstate__(self) -> dict:
|
|
47
47
|
d = dict(self.__dict__)
|
|
48
48
|
d["xrf_spectrum_task"] = None
|
|
49
49
|
return d
|
|
50
50
|
|
|
51
|
-
def __setstate__(self, d):
|
|
51
|
+
def __setstate__(self, d: dict):
|
|
52
52
|
self.__dict__.update(d)
|
|
53
53
|
|
|
54
54
|
def execute(self):
|
|
@@ -67,7 +67,7 @@ class XrfSpectrumQueueEntry(BaseQueueEntry):
|
|
|
67
67
|
archive_dir=xrf_spectrum.path_template.get_archive_directory(),
|
|
68
68
|
prefix=f"{path_template.get_prefix()}_{path_template.run_number}",
|
|
69
69
|
session_id=HWR.beamline.session.session_id,
|
|
70
|
-
blsample_id=xrf_spectrum.
|
|
70
|
+
blsample_id=xrf_spectrum.sample.lims_id,
|
|
71
71
|
cpos=xrf_spectrum.centred_position,
|
|
72
72
|
)
|
|
73
73
|
HWR.beamline.xrf_spectrum._ready_event.wait()
|
|
@@ -108,10 +108,10 @@ class XrfSpectrumQueueEntry(BaseQueueEntry):
|
|
|
108
108
|
self.get_view().set_checkable(False)
|
|
109
109
|
super().post_execute()
|
|
110
110
|
|
|
111
|
-
def xrf_spectrum_status_changed(self, msg):
|
|
111
|
+
def xrf_spectrum_status_changed(self, msg: str):
|
|
112
112
|
"""xrfSpectrumStatusChanged handler.
|
|
113
113
|
Args:
|
|
114
|
-
msg
|
|
114
|
+
msg: Message when ``xrfSpectrumStatusChanged`` emitted.
|
|
115
115
|
"""
|
|
116
116
|
logging.getLogger("user_level_log").info(msg)
|
|
117
117
|
|
|
@@ -136,5 +136,5 @@ class XrfSpectrumQueueEntry(BaseQueueEntry):
|
|
|
136
136
|
logging.getLogger("user_level_log").error("XRF spectrum failed.")
|
|
137
137
|
raise QueueExecutionException("XRF spectrum failed", self)
|
|
138
138
|
|
|
139
|
-
def get_type_str(self):
|
|
139
|
+
def get_type_str(self) -> str:
|
|
140
140
|
return "XRF spectrum"
|