Startup
This commit is contained in:
10
.gitignore
vendored
10
.gitignore
vendored
@@ -1,9 +1,11 @@
|
||||
/data
|
||||
/sessions
|
||||
/context
|
||||
/log
|
||||
/data
|
||||
/extensions
|
||||
/log
|
||||
/sessions
|
||||
/www
|
||||
script/cachedir
|
||||
script/Lib
|
||||
script/*.class
|
||||
/script/
|
||||
script/*.pyc
|
||||
plugins/*.class
|
||||
|
||||
15
script/HoloScan.py
Normal file
15
script/HoloScan.py
Normal file
@@ -0,0 +1,15 @@
|
||||
"""
|
||||
Arguments:
|
||||
|
||||
SENSORS (list)
|
||||
PHI_RANGE (tuple (min, max))
|
||||
THETA_RANGE (tuple (min, max))
|
||||
STEPS (tuple (phi, theta))
|
||||
LATENCY (double)
|
||||
RELATIVE (BOOLEAN)
|
||||
"""
|
||||
|
||||
|
||||
#set_preference(Preference.ENABLED_PLOTS, [phi, theta, scienta.dataMatrix, integration])
|
||||
set_preference(Preference.PLOT_TYPES, {integration:1})
|
||||
ascan((phi, theta), SENSORS, (PHI_RANGE[0], THETA_RANGE[0]), (PHI_RANGE[1], THETA_RANGE[1]), STEPS, LATENCY, RELATIVE, before_read=trig_scienta)
|
||||
14
script/ManipulatorScan.py
Normal file
14
script/ManipulatorScan.py
Normal file
@@ -0,0 +1,14 @@
|
||||
"""
|
||||
Arguments:
|
||||
|
||||
MOTOR (device)
|
||||
SENSORS (list)
|
||||
RANGE (tuple (min, max))
|
||||
STEPS (int or tuple)
|
||||
LATENCY (double)
|
||||
RELATIVE (BOOLEAN)
|
||||
"""
|
||||
|
||||
|
||||
set_preference(Preference.PLOT_TYPES,{'integration':1});
|
||||
lscan(MOTOR, SENSORS, RANGE[0], RANGE[1], STEPS, LATENCY, RELATIVE, before_read=trig_scienta)
|
||||
32
script/XPSSpectrum.py
Normal file
32
script/XPSSpectrum.py
Normal file
@@ -0,0 +1,32 @@
|
||||
#Parameters (global variables):
|
||||
# ranges: list of RangeSelection
|
||||
|
||||
if scienta.acquisitionMode == scienta.AcquisitionMode.Fixed:
|
||||
scienta.acquisitionMode = scienta.AcquisitionMode.Swept
|
||||
ret=[]
|
||||
|
||||
names=[]
|
||||
for i in range(len(ranges)):
|
||||
names.append(str(ranges[i]))
|
||||
plots = plot(None, names)
|
||||
try:
|
||||
for i in range(len(ranges)):
|
||||
scienta.lowEnergy.put(ranges[i].min)
|
||||
scienta.highEnergy.put(ranges[i].max)
|
||||
|
||||
vars = ranges[i].vars
|
||||
if vars is not None and len(vars)==3:
|
||||
scienta.stepTime.write(vars[0])
|
||||
scienta.stepSize.write(vars[1])
|
||||
scienta.setIterations(vars[2])
|
||||
|
||||
trig_scienta()
|
||||
ydata = scienta.spectrum.read()
|
||||
xdata = scienta.spectrumX
|
||||
plots[i].getSeries(0).setData(xdata, ydata)
|
||||
ret.append((xdata, ydata))
|
||||
#time.sleep(3.0)
|
||||
finally:
|
||||
if not scienta.isReady():
|
||||
scienta.stop()
|
||||
set_return(to_array(ret,'o'))
|
||||
57
script/local.py
Normal file
57
script/local.py
Normal file
@@ -0,0 +1,57 @@
|
||||
import random
|
||||
import ch.psi.pshell.dev.Readable.ReadableArray as ReadableArray
|
||||
|
||||
class SimulatedOutput(Writable):
|
||||
def getName(self):
|
||||
return "SimulatedOutput"
|
||||
|
||||
def write(self, value):
|
||||
pass
|
||||
|
||||
|
||||
class SimulatedInput(Readable):
|
||||
def __init__(self):
|
||||
self.x = 0.0
|
||||
|
||||
def getName(self):
|
||||
return "SimulatedInput"
|
||||
|
||||
def read(self):
|
||||
self.x = self.x + 0.2
|
||||
noise = (random.random() - 0.5) / 20.0
|
||||
return math.sin(self.x) + noise
|
||||
|
||||
|
||||
sout = SimulatedOutput()
|
||||
sinp = SimulatedInput()
|
||||
|
||||
def integrate_image():
|
||||
data = scienta.data.read()
|
||||
#Integrate and plot
|
||||
(width,height) = scienta.getImageSize().tolist()
|
||||
integration = []
|
||||
for i in range(width):
|
||||
p=0.0
|
||||
for j in range(height):
|
||||
p=p+data[j*width+i]
|
||||
integration.append(p)
|
||||
return integration
|
||||
|
||||
|
||||
class ImageIntegrator(ReadableArray):
|
||||
def getName(self):
|
||||
return "integration"
|
||||
|
||||
def getSize(self):
|
||||
(width,height) = scienta.getImageSize().tolist()
|
||||
return width
|
||||
|
||||
def read(self):
|
||||
return to_array(integrate_image(),'d')
|
||||
|
||||
integration = ImageIntegrator()
|
||||
|
||||
|
||||
def trig_scienta():
|
||||
scienta.start()
|
||||
scienta.waitReady(-1)
|
||||
Reference in New Issue
Block a user