This commit is contained in:
gac-x11ma
2020-01-09 13:33:02 +01:00
parent f8ad14212b
commit 87dd9eb0e8
12 changed files with 2888 additions and 83 deletions

View File

@@ -1,4 +1,4 @@
#Mon Nov 04 17:04:36 CET 2019
#Thu Jan 09 10:48:13 CET 2020
imageSourcesFile={config}/imaging.properties
autoSaveScanData=true
simulation=false
@@ -7,6 +7,7 @@ logDaysToLive=30
userAuthenticator=
logLevelConsole=Off
scanStreamerPort=-1
parallelInitialization=false
scanStreamingPort=-1
devicePoolFile={config}/devices.properties
versionTrackingManual=true
@@ -31,7 +32,7 @@ terminalEnabled=false
notificationLevel=null
terminalPort=3579
tasksFile={config}/tasks.properties
createSessionFiles=false
createSessionFiles=true
versionTrackingLogin={context}/svcusr-hlapp_robot
versionTrackingRemote=git@git.psi.ch\:pshell_config/x11ma.git
dataProvider=ch.psi.fda.ProviderFDA

View File

@@ -7,11 +7,11 @@ pol_done=ch.psi.pshell.epics.ChannelString|X11MA-ID2:DONE|Read||true
energy=ch.psi.pshell.epics.ChannelDouble|X11PHS-E:GO.A|||
id_error=ch.psi.pshell.epics.ChannelInteger|X11MA-ID2-PLC:ERROR|||true
beam_status=ch.psi.pshell.epics.DiscretePositioner|ACOAU-ACCU:OP-MODE|Read||true
#edata=ch.psi.pshell.epics.ChannelDoubleArray|EDATA 3|Read||
#count=ch.psi.pshell.epics.ChannelInteger|COUNT|Read||true
#data=ch.psi.pshell.epics.ChannelDoubleArray|DATA 3|Read||
#fdata=ch.psi.pshell.epics.ChannelDoubleArray|FDATA 3|Read||
#idata=ch.psi.pshell.epics.ChannelDoubleArray|IDATA 3|Read||
edata=ch.psi.pshell.epics.ChannelDoubleArray|EDATA 3|Read||
count=ch.psi.pshell.epics.ChannelInteger|COUNT|Read||true
data=ch.psi.pshell.epics.ChannelDoubleArray|DATA 3|Read||
fdata=ch.psi.pshell.epics.ChannelDoubleArray|FDATA 3|Read||
idata=ch.psi.pshell.epics.ChannelDoubleArray|IDATA 3|Read||
Keithley_3_raw=ch.psi.pshell.epics.ChannelDouble|X11MA-KEI12:READOUT|Read||true
Keithley_2_raw=ch.psi.pshell.epics.ChannelDouble|X11MA-KEI11:READOUT|Read||true
Keithley_1_raw=ch.psi.pshell.epics.ChannelDouble|X11MA-KEI10:READOUT|Read||true
@@ -43,6 +43,6 @@ energy_done=ch.psi.pshell.epics.ChannelDouble|X11MA-PHS:ALL-DONE|Read||true
keithley_1a=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC1|Read||true
keithley_2a=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC2|Read||true
keithley_3a=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC3|Read||true
#otf_start=ch.psi.pshell.epics.ChannelInteger|X11MA-OTF:GO|||true
$eiger=ch.psi.pshell.epics.AreaDetector|X11MA-ES3-SD1|||true
otf_start=ch.psi.pshell.epics.ChannelInteger|X11MA-OTF:GO|||true
eiger=ch.psi.pshell.epics.AreaDetector|X11MA-ES1-SD1|||true
image=ch.psi.pshell.imaging.CameraSource|eiger|||true

View File

@@ -1,2 +1,2 @@
#Thu Oct 31 11:14:59 CET 2019
FileSequentialNumber=10
#Thu Jan 09 10:48:32 CET 2020
FileSequentialNumber=33

View File

@@ -0,0 +1,20 @@
#Thu Jan 09 10:55:58 CET 2020
spatialCalOffsetY=NaN
invert=false
spatialCalOffsetX=NaN
rotation=0.0
rotationCrop=false
scale=1.0
rescaleFactor=1.0
grayscale=false
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
spatialCalScaleX=NaN
spatialCalScaleY=NaN
flipHorizontally=false
roiY=0
roiX=0
rescaleOffset=0.0
transpose=false
roiWidth=-1

View File

@@ -0,0 +1,20 @@
#Thu Jan 09 11:09:31 CET 2020
spatialCalOffsetY=NaN
invert=false
spatialCalOffsetX=NaN
rotation=0.0
rotationCrop=false
scale=1.0
rescaleFactor=1.0
grayscale=false
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
spatialCalScaleX=NaN
spatialCalScaleY=NaN
flipHorizontally=false
roiY=0
roiX=0
rescaleOffset=0.0
transpose=false
roiWidth=-1

18
devices/m.properties Normal file
View File

@@ -0,0 +1,18 @@
#Thu Jan 09 09:43:03 CET 2020
precision=2
scale=1.0
estbilizationDelay=0
resolution=NaN
minValue=-10.0
defaultSpeed=1.0
sign_bit=0
monitorByPosition=false
minSpeed=0.001
offset=0.0
maxValue=10.0
rotation=false
maxSpeed=10.0
homingType=None
startRetries=1
unit=null
hasEnable=false

1284
plugins/Eiger.form Normal file

File diff suppressed because it is too large Load Diff

1382
plugins/Eiger.java Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,76 +1,95 @@
from ijutils import *
from ch.psi.pshell.imaging.Overlays import *
from ch.psi.pshell.imaging.Utils import *
import ch.psi.pshell.imaging.Pen as Pen
import java.awt.Rectangle as Rectangle
import ch.psi.pshell.imaging.Data as Data
from ijutils import *
from ch.psi.pshell.imaging.Overlays import *
from ch.psi.pshell.imaging.Utils import *
import ch.psi.pshell.imaging.Pen as Pen
import java.awt.Rectangle as Rectangle
import ch.psi.pshell.imaging.Data as Data
###############################################################################
# ROI Integration
###############################################################################
def integrate_roi(source, x,y, w, h):
if source.data is None:
source.update()
roi = source.data.getRoi(Rectangle(x,y, w, h))
return roi.integrate(False)
class RoiIntensity(ReadonlyRegisterBase):
def __init__(self, name, source, x,y, w, h):
ReadonlyRegisterBase.__init__(self, name)
self.source=source
self.roi = x,y, w, h
def doRead(self):
x,y, w, h = self.roi
return integrate_roi(self.source, x,y, w, h)
def create_roi_devices(roi_list, add = True):
rois = []
for r in roi_list:
roi = RoiIntensity(r, image, roi_list[r][0], roi_list[r][1], roi_list[r][2], roi_list[r][3])
if add:
add_device(roi, True)
rois.append(roi)
return rois
###############################################################################
# Frame integration
###############################################################################
def get_image(source, roi=None, wait_next=False):
if wait_next:
source.waitNext(-1)
ret = load_image(Utils.grayscale(source.output, Rectangle(roi[0], roi[1], roi[2], roi[3]) if (roi is not None) else None))
return ret
def grab_frames(source, samples, roi=None, wait_next=False, sleep=0):
frames = []
for i in range(samples):
if sleep>0:
time.sleep(sleep)
aux = get_image(source, roi, wait_next)
frames.append(aux)
return frames
def average_frames(source, samples=1, roi=None, wait_next=False, sleep=0, as_float=True):
return average_ips(grab_frames(source, samples, roi, wait_next, sleep), as_float)
def integrate_frames(source, samples=1, roi=None, wait_next=False, sleep=0, as_float=True):
return integrate_ips(grab_frames(sotscanurce, samples, roi, wait_next, sleep), as_float)
if False:
integrate_roi(image, 10, 5, 20, 10)
add_device(RoiIntensity("Region1", image, 10, 5, 20, 10), True)
add_device(RoiIntensity("Region2", image, 10, 5, 40, 20), True)
import ch.psi.pshell.data.ProviderCSV as ProviderCSV
ProviderCSV.setDefaultItemSeparator(" ")
tscan((Region1, Region2), 10, 0.1, layout="table", provider = "csv")
ret = grab_frames(image, 10, sleep=0.1)
av = average_ips(ret, None, True)
data = get_ip_array(av)
plot(data)
save_image(av, "{images}/float.tif","tiff")
av = average_ips(ret, None, False)
save_image(av, "{images}/int.tif","tiff")
###############################################################################
# ROI Integration
# Triggering
###############################################################################
def integrate_roi(source, x,y, w, h):
if source.data is None:
source.update()
roi = source.data.getRoi(Rectangle(x,y, w, h))
return roi.integrate(False)
class RoiIntensity(ReadonlyRegisterBase):
def __init__(self, name, source, x,y, w, h):
ReadonlyRegisterBase.__init__(self, name)
self.source=source
self.roi = x,y, w, h
def doRead(self):
x,y, w, h = self.roi
return integrate_roi(self.source, x,y, w, h)
###############################################################################
# Frame integration
###############################################################################
def get_image(source, roi=None, wait_next=False):
if wait_next:
source.waitNext(-1)
ret = load_image(Utils.grayscale(source.output, Rectangle(roi[0], roi[1], roi[2], roi[3]) if (roi is not None) else None))
return ret
def trigger_eiger(wait=False):
eiger.start()
if wait:
eiger.waitNewImage(20000)
def grab_frames(source, samples, roi=None, wait_next=False, sleep=0):
frames = []
for i in range(samples):
if sleep>0:
time.sleep(sleep)
aux = get_image(source, roi, wait_next)
frames.append(aux)
return frames
def average_frames(source, samples=1, roi=None, wait_next=False, sleep=0, as_float=True):
return average_ips(grab_frames(source, samples, roi, wait_next, sleep), as_float)
def integrate_frames(source, samples=1, roi=None, wait_next=False, sleep=0, as_float=True):
return integrate_ips(grab_frames(source, samples, roi, wait_next, sleep), as_float)
print integrate_roi(image, 10, 5, 20, 10)
add_device(RoiIntensity("Region1", image, 10, 5, 20, 10), True)
add_device(RoiIntensity("Region2", image, 10, 5, 40, 20), True)
import ch.psi.pshell.data.ProviderCSV as ProviderCSV
ProviderCSV.setDefaultItemSeparator(" ")
tscan((Region1, Region2), 10, 0.1, layout="table", provider = "csv")
ret = grab_frames(image, 10, sleep=0.1)
av = average_ips(ret, None, True)
data = get_ip_array(av)
plot(data)
save_image(av, "{images}/float.tif","tiff")
av = average_ips(ret, None, False)
save_image(av, "{images}/int.tif","tiff")

View File

@@ -231,3 +231,10 @@ def otf(start, end, time, delay = 0.0, mode = None, offset = None, alpha = None,
run("templates/EnergyScan", {"E1":start, "E2":end, "TIME":time, "DELAY":float(delay), "MODE":mode, "OFFSET":(offset), "FOLDER":folder, "FILE":name, "ALPHA":float(alpha) if alpha is not None else None})
###################################################################################################
#Devices
###################################################################################################
run("devices/eiger")

View File

@@ -0,0 +1,29 @@
#If running from editor
if get_exec_pars().source == CommandSource.ui:
ID = "ID1"
SWITCHING = "Normal"
POL_ID_1 = "Circ_Plus"
ALPHA_ID_1 = 0.0
HARMONIC_ID_1 = 1
OFFSET_ID_1 = 0.0
POL_ID_2 = "Circ_Minus"
ALPHA_ID_2 = 0.0
HARMONIC_ID_2 = 1
OFFSET_ID_2 = 0.0
ROI = {"ROI1": [50,50,200, 100]}
METHOD = "Two_Pol"
MEASUREMENTS = 1
CONTRAST = 0
AUTO_SAVE = True
AS_SEQUENCE = False
EXPOSURE_1 = 1.0
AVERAGE_1 = 1.0
ENERGY_1 = 1000.0
POLARIZATION_1 = "Circ_Plus"
EXPOSURE_2 = 1.0
AVERAGE_2 = 1.0
ENERGY_2= 1000.0
POLARIZATION_2 = "Circ_Minus"
tscan((keithley_1a,keithley_2a,keithley_3a), 10, 0.1)

View File

@@ -0,0 +1,25 @@
#If running from editor
if get_exec_pars().source == CommandSource.ui:
ID = "ID1"
SWITCHING = "Normal"
POL_ID_1 = "Circ_Plus"
ALPHA_ID_1 = 0.0
HARMONIC_ID_1 = 1
OFFSET_ID_1 = 0.0
POL_ID_2 = "Circ_Minus"
ALPHA_ID_2 = 0.0
HARMONIC_ID_2 = 1
OFFSET_ID_2 = 0.0
ROI = {"Region1": [10,5,20, 10], "Region2": [20,15,20, 10]}
SAVE_SPECTRUM = True
SAVE_IMAGES = False
WITH_I0 = True
SWITCH_POL = False
EXPOSURE = 1.0
AVERAGE = 1
NUMBER_SCANS =1
rois = create_roi_devices(ROI)