Skip to content
Snippets Groups Projects

Set parameters new

Merged Matias Guijarro requested to merge SetParameters_new into master
1 unresolved thread
@@ -352,8 +352,6 @@ class MetadataManager (tango.LatestDeviceImpl):
reader = ICATParameterReader(self.get_name(), self.authenticationPlugin, self.username, self.password, self.server, self.port)
return str(reader.compare(self.parameters, self.labels))
# returns the sample parameters set by the SetSampleParameters command as key value pairs
# the list is dynamically created on each call
# returns "None" if list is empty
@@ -512,8 +510,6 @@ class MetadataManager (tango.LatestDeviceImpl):
tomo = tomodbFile(self.attr_proposal_read, self.beamlineID.lower(), argin)
self.client.sendObject(tomo)
#----- PROTECTED REGION END -----# // MetadataManager.IngestTomodbXML
def is_IngestTomodbXML_allowed(self):
self.debug("In is_IngestTomodbXML_allowed()")
@@ -680,7 +676,6 @@ class MetadataManager (tango.LatestDeviceImpl):
sys.excepthook(*sys.exc_info())
pass
def notifyInfo(self, message):
self.sendNotification("notification", "info", message)
@@ -837,10 +832,11 @@ class MetadataManager (tango.LatestDeviceImpl):
def SetParameters(self, json_string):
"""This will overwrite ICAT key-value pairs defined
by the "parameters" and "labels" device properties.
by the "parameters" and "labels" device properties,
but not the sample parameters.
"""
self.custom_labels_map = json.loads(json_string)
original = set(self.parameters) | set(self.labels)
original = set(self.parameters) | set(self.labels) | set(self.sampleParamMap)
new = set(self.custom_labels_map.keys())
overwritten = len(original & new)
original = len(original) - overwritten
@@ -882,9 +878,12 @@ class MetadataManager (tango.LatestDeviceImpl):
#return dts
return parameters
def CreateDataset(self, complete=True):
@property
def full_labels_map(self):
# The custom labels overwrite the ones from the "label" device property
labels = {**self.labels_map, **self.custom_labels_map}
return {**self.labels_map, **self.custom_labels_map}
def CreateDataset(self, complete=True):
return self.metadataWorker.createDataset(
complete,
self.attr_proposal_read,
@@ -893,7 +892,7 @@ class MetadataManager (tango.LatestDeviceImpl):
self.attr_dataFolder_read,
self.startDate,
self.endDate,
labels,
self.full_labels_map,
self.datasetParamMap,
self.attr_sampleName_read,
self.sampleParamMap,
Loading