This commit is contained in:
2021-04-28 09:29:19 +02:00
parent 84e20e54cc
commit a9f0de27e6
1030 changed files with 14567 additions and 227310 deletions

View File

@@ -1,14 +1,3 @@
#from ch.psi.pshell.imaging.Overlays import *
import ch.psi.pshell.imaging.Overlay as Overlay
import ch.psi.pshell.imaging.Pen as Pen
import java.awt.Font as Font
import java.awt.Point as Point
import java.awt.Color as Color
import ch.psi.pshell.crlogic.CrlogicPositioner as CrlogicPositioner
import ch.psi.pshell.crlogic.CrlogicSensor as CrlogicSensor
import ch.psi.pshell.ui.App as App
#get_context().dataManager.provider.embeddedAtributes = False
#get_context().dataManager.provider.ADD_ATTRIBUTE_FILE_TIMESTAMP = True
@@ -27,6 +16,56 @@ def caput_str(ch, val):
caput(ch, ret)
SCI_METADATA = {
"beamlineParameters": {
"Monostripe": "Ru/C",
"Ring current": {
"v": 0.402246,
"u": "A"
},
"Beam energy": {
"v": 22595,
"u": "eV"
}
},
"detectorParameters": {
"Objective": 20,
"Scintillator": "LAG 20um",
"Exposure time": {
"v": 0.4,
"u": "s"
}
},
"scanParameters": {
"Number of projections": 1801,
"Rot Y min position": {
"v": 0,
"u": "deg"
},
"Inner scan flag": 0,
"File Prefix": "817b_B2_",
"Sample In": {
"v": 0,
"u": "m"
},
"Number of darks": 10,
"Rot Y max position": {
"v": 180,
"u": "deg"
},
"Angular step": {
"v": 0.1,
"u": "deg"
},
"Number of flats": 120,
"Sample Out": {
"v": -0.005,
"u": "m"
},
"Flat frequency": 0,
"Number of inter-flats": 0
}
}
###################################################################################################
def on_command_started(info):
@@ -35,11 +74,23 @@ def on_command_finished(info):
pass #print "Finished: " + str(info.script) + " Error: " + str(info.error)
def on_change_data_path(path):
print "Data path: " + str(path)
def on_session_started(id):
print "Start session: ", id
get_context().sessionManager.setMetadata("beamlineState", {"sin": sin.take(), "inp": inp.take()})
get_context().sessionManager.setMetadata("beamlineState2", {"sin": sin.take(), "inp": inp.take()})
def on_session_finished(id):
print "Stop session: ", id
get_context().sessionManager.setMetadata("scientificMetadata",SCI_METADATA)
get_context().sessionManager.setMetadata("scientificMetadata2",SCI_METADATA)
###################################################################################################
# Layout setup
###################################################################################################
#import ch.psi.pshell.data.LayoutSF as LayoutSF
#LayoutSF.setExperimentArguments([pv, motor, pe, cv, energy, sin])
@@ -63,11 +114,6 @@ crlogic_config["additionalBacklash"] = 0.0
"""
from ch.psi.pshell.imaging.Utils import *
from ch.psi.pshell.imaging.Overlays import *
import ch.psi.pshell.imaging.Pen as Pen
import java.awt.Font as Font
import java.awt.Point as Point
old = ov if globals().has_key("ov") else None
r = show_panel(img)
ov1 = Text(Pen(Color.ORANGE), "TEXT", Font("Verdana", Font.PLAIN, 12) , Point(20,20), )
@@ -794,7 +840,7 @@ class DigitalInput(ReadonlyRegisterBase):
return False if (int(time.time()) %2 == 0 ) else True
add_device(DigitalInput("di"),True)
di.polling=1000
#di.polling=1000
@@ -819,7 +865,7 @@ def set_geometry(value, apply = None):
if dev is not None:
remove_device(dev)
return
filename = get_context().setup.expandPath("{script}/geometry/"+ str(value)+".py")
filename = expand_path("{script}/geometry/"+ str(value)+".py")
if not os.path.isfile(filename):
raise Exception("Invalid geometry file: " + value)
former = get_geometry()
@@ -830,9 +876,21 @@ def set_geometry(value, apply = None):
def is_geometry_set():
return get_device("wavelength") is not None
#mu.moveAsync(0.0)
#eta.moveAsync(0.0)
#delta.moveAsync(45.0)
#gamma.moveAsync(0.0)
#energy.write(9.5)
#energy.write(9.5)
class Counter(ReadonlyRegisterBase):
def __init__(self, name):
ReadonlyRegisterBase.__init__(self,name)
self.start = time.time()
def doRead(self):
return int((time.time()-self.start)*1000)
add_device(Counter("counter"), True)