Files
x07ma/script/local.py
2015-08-24 12:25:42 +02:00

54 lines
1.6 KiB
Python

###################################################################################################
# Deployment specific global definitions - executed after startup.py
###################################################################################################
MODE = None
#Uncomment this line to create the simulated devices needed to the tutorial scripts.
#run("tutorial/devices")
#This procedude is used to emulate file names generated by FDA
import ch.psi.pshell.data.ScanPersistenceStrategyTable
class Strategy(ch.psi.pshell.data.ScanPersistenceStrategyTable):
def getLogFileName(self):
return time.strftime('%Y%m%d%H%M%S') + '_' + controller.getExecutingContext() + '_logs'
def getDatasetName(self, scan):
print scan
mode = None
if MODE is not None:
mode = "plus" if (MODE == "CIRC +") else "minus"
return time.strftime('%Y%m%d%H%M%S') + '_' + controller.getExecutingContext() +'_' + str(mode) + '_' + str(controller.dataManager.getScanIndex()).zfill(4)
controller.dataManager.setScanStrategy(Strategy())
energy = None
class SimulatedEnergy(Writable):
def write(self, value):
self.put(value)
def put(self, value, timeout = None):
global energy
energy = value
def close(self):
pass
class SimulatedEnergyReadback(Readable):
def read(self):
global energy
return energy;
def get(self):
return self.read()
def close(self):
pass
sim_energy = SimulatedEnergy()
sim_energy_readback = SimulatedEnergyReadback()