@@ -43,6 +43,7 @@ class FileWriterCallbackBase:
43
43
.. autosummary::
44
44
45
45
~clear
46
+ ~get_hklpy_configurations
46
47
~make_file_name
47
48
~writer
48
49
@@ -101,6 +102,7 @@ def clear(self):
101
102
"""
102
103
self .acquisitions = {}
103
104
self .detectors = []
105
+ self .diffractometers = {}
104
106
self .exit_status = None
105
107
self .externals = {}
106
108
self .doc_timestamp = None
@@ -131,6 +133,20 @@ def file_path(self):
131
133
def file_path (self , value ):
132
134
self ._file_path = pathlib .Path (value )
133
135
136
+ def get_hklpy_configurations (self , doc : dict ) -> dict :
137
+ """Diffractometer details (from hklpy) in RE descriptor documents."""
138
+ configurations = {} # zero, one, or more diffractometers are possible
139
+ for diffractometer_name in doc .get ("configuration" , {}):
140
+ record = doc ["configuration" ][diffractometer_name ].get ("data" , {})
141
+ attrs = record .get (f"{ diffractometer_name } _orientation_attrs" )
142
+ if attrs is not None :
143
+ configurations [diffractometer_name ] = {
144
+ # empty when no orientation_attrs
145
+ attr : record [f"{ diffractometer_name } _{ attr } " ]
146
+ for attr in attrs
147
+ }
148
+ return configurations
149
+
134
150
def make_file_name (self ):
135
151
"""
136
152
generate a file name to be used as default
@@ -271,6 +287,9 @@ def descriptor(self, doc):
271
287
dd ["time" ] = [] # entry time stamps here
272
288
dd ["external" ] = entry .get ("external" ) is not None
273
289
# logger.debug("dd %s: %s", k, data[k])
290
+
291
+ # Gather any available diffractometer configurations.
292
+ self .diffractometers .update (self .get_hklpy_configurations (doc ))
274
293
275
294
def event (self , doc ):
276
295
"""
0 commit comments