Skip to content
Snippets Groups Projects

Resolve "Add the proposal session name"

Merged Wout De Nolf requested to merge 52-add-the-proposal-session-name into master
Files
3
@@ -73,11 +73,19 @@ class MetaExperiment (tango.LatestDeviceImpl):
self.debug_stream("In init_device()")
self.get_device_properties(self.get_device_class())
self.attr_proposal_read = ''
<<<<<<< HEAD
self.attr_proposalSession_read = ''
self.attr_sample_read = ''
self.attr_dataRoot_read = ''
self.attr_proposal_read = 'please enter'
self.attr_proposalSession_read = 'please enter'
=======
self.attr_session_read = ''
self.attr_sample_read = ''
self.attr_dataRoot_read = ''
self.attr_proposal_read = 'please enter'
self.attr_session_read = 'please enter'
>>>>>>> proposalName back to proposal
self.attr_sample_read = 'please enter'
self.attr_dataRoot_read = '/data/visitor/'
self.set_change_event("ProposalName", True, False)
@@ -109,22 +117,37 @@ class MetaExperiment (tango.LatestDeviceImpl):
self.proxy = tango.DeviceProxy(self.get_name())
# mimic write_hardware without side effects
db = tango.Util.instance().get_database()
<<<<<<< HEAD
attr_map = db.get_device_attribute_property(self.get_name(),['proposal','proposalSession','sample','dataRoot'])
self.attr_proposal_read = attr_map['proposal'].get('__value',[''])[0]
self.attr_proposalSession_read = attr_map['proposalSession'].get('__value',[''])[0]
=======
attr_map = db.get_device_attribute_property(self.get_name(),['proposal','session','sample','dataRoot'])
self.attr_proposal_read = attr_map['proposal'].get('__value',[''])[0]
self.attr_session_read = attr_map['session'].get('__value',[''])[0]
>>>>>>> proposalName back to proposal
self.attr_sample_read = attr_map['sample'].get('__value',[''])[0]
self.attr_dataRoot_read = attr_map['dataRoot'].get('__value',[''])[0]
if self.attr_proposal_read:
self.info_stream("Recovered proposal name %s" %self.attr_proposal_read)
<<<<<<< HEAD
if self.attr_proposalSession_read:
self.info_stream("Recovered proposal session %s" %self.attr_proposalSession_read)
=======
if self.attr_session_read:
self.info_stream("Recovered proposal session %s" %self.attr_session_read)
>>>>>>> proposalName back to proposal
if self.attr_sample_read:
self.info_stream("Recovered sample name %s" %self.attr_sample_read)
if self.attr_dataRoot_read:
self.info_stream("Recovered data root %s" %self.attr_dataRoot_read)
# we need to push them in this order
self.push_change_event("ProposalName", self.attr_proposal_read)
<<<<<<< HEAD
self.push_change_event("ProposalSession", self.attr_proposalSession_read)
=======
self.push_change_event("ProposalSession", self.attr_session_read)
>>>>>>> proposalName back to proposal
self.push_change_event("Sample", self.attr_sample_read)
self.push_change_event("DataRoot", self.attr_dataRoot_read)
self.UpdateState()
@@ -162,6 +185,7 @@ class MetaExperiment (tango.LatestDeviceImpl):
self.UpdateState()
#----- PROTECTED REGION END -----# // MetaExperiment.proposal_write
<<<<<<< HEAD
def read_proposalSession(self, attr):
self.debug_stream("In read_proposalSession()")
#----- PROTECTED REGION ID(MetaExperiment.read_proposalSession) ENABLED START -----#
@@ -171,10 +195,21 @@ class MetaExperiment (tango.LatestDeviceImpl):
def write_proposalSession(self, attr):
self.debug_stream("In write_proposalSession()")
=======
def read_session(self, attr):
self.debug_stream("In read_session()")
#----- PROTECTED REGION ID(MetaExperiment.read_session) ENABLED START -----#
attr.set_value(self.attr_session_read)
#----- PROTECTED REGION END -----# // MetaExperiment.session_read
def write_session(self, attr):
self.debug_stream("In write_session()")
>>>>>>> proposalName back to proposal
data = attr.get_write_value()
#----- PROTECTED REGION ID(MetaExperiment.session_write) ENABLED START -----#
self.attr_proposalSession_read = data
self.push_change_event("ProposalSession", self.attr_proposalSession_read)
self.attr_session_read = data
self.push_change_event("ProposalSession", self.attr_session_read)
self.proxy.write_attribute("sample", "please enter")
self.proxy.write_attribute("dataRoot", "/data/visitor/")
self.UpdateState()
@@ -273,12 +308,12 @@ class MetaExperiment (tango.LatestDeviceImpl):
def UpdateState(self):
if not self.attr_proposal_read or (self.attr_proposal_read == "please enter"):
self.set_status("No experiment started")
elif not self.attr_proposalSession_read or (self.attr_proposalSession_read == "please enter"):
elif not self.attr_session_read or (self.attr_session_read == "please enter"):
self.set_status("No experiment started")
elif self.attr_sample_read and (self.attr_sample_read != "please enter"):
self.set_status("Ready to start dataset for experiment %r and session %r" % (self.attr_proposal_read, self.attr_proposalSession_read))
self.set_status("Ready to start dataset for experiment %r and session %r" % (self.attr_proposal_read, self.attr_session_read))
else:
self.set_status("Experiment %r session %r started" % (self.attr_proposal_read, self.attr_proposalSession_read))
self.set_status("Experiment %r session %r started" % (self.attr_proposal_read, self.attr_session_read))
try:
self.append_status(self.client.getStatus(),True)
except Exception:
@@ -341,7 +376,7 @@ class MetaExperimentClass(tango.DeviceClass):
{
'Memorized':"true_without_hard_applied"
} ],
'proposalSession':
'session':
[[tango.DevString,
tango.SCALAR,
tango.READ_WRITE],
Loading