Commit d2f9e909 authored by Yoann Sallaz Damaz's avatar Yoann Sallaz Damaz
Browse files

s

parent 4dad439f
Pipeline #55326 failed with stages
......@@ -34,7 +34,9 @@ class bac24(object):
return resp
def init(self):
verbose = True
self.zero()
def reset(self):
# Set up the BAC24-I counter box
# set the display mode to 0, no visualisation - the fastest mode
......@@ -60,6 +62,8 @@ class bac24(object):
sleep(1);
# flush the rest of the input buffer (if any)
self.ser.flush()
def zero(self):
print("bac24_zero()")
......
......@@ -85,10 +85,14 @@ class FindMaxAttenuation:
self.t_table = kwargs.get("transmission_table", self.transmission_table)
def _prepare(self, ctime=None):
def _prepare(self, ctime=None, fname=None, roi=None):
if ctime:
self.ctime = ctime
if roi:
self.roi[0]=roi[0]
self.roi[1]=roi[1]
if fname:
self.datafile=fname
# set the mca
mca.set_roi(
self.roi[0],
......@@ -115,11 +119,15 @@ class FindMaxAttenuation:
if safshut:
fastshut.close_manual()
def _procedure(self, ctime=None):
def _procedure(self, ctime=None, fname=None, roi=None):
""" The procedure itself """
if ctime:
self.ctime = ctime
if roi:
self.roi[0]=roi[0]
self.roi[1]=roi[1]
if fname:
self.datafile=fname
def restore_transmission(old_transmission=transmission.get()):
transmission.set(old_transmission)
......
......@@ -42,7 +42,7 @@ class mirrorup(CalcController):
upbk = positions_dict["altitude"]+sinangle*self.distancedetweenelevator/2.
return {"upfr":upfr, "upbk":upbk}
class c2bend_calc(CalcController):
class bend_calc(CalcController):
def __init__(self, *args, **kwargs):
CalcController.__init__(self, *args, **kwargs)
......@@ -50,14 +50,14 @@ class c2bend_calc(CalcController):
CalcController.initialize_axis(self, axis)
def calc_from_real(self, positions_dict):
c2benddiff = positions_dict["c2bendfr"]-positions_dict["c2bendbk"]
c2bend = (positions_dict["c2bendfr"]+positions_dict["c2bendbk"])/2.
return {"c2benddiff":c2benddiff, "c2bend":c2bend}
c2benddiff = positions_dict["bend1"]-positions_dict["bend2"]
c2bend = (positions_dict["bend1"]+positions_dict["bend2"])/2.
return {"benddiff":c2benddiff, "bend":c2bend}
def calc_to_real(self, positions_dict):
c2bendbk = positions_dict["c2bend"]-0.5*positions_dict["c2benddiff"]
c2bendfr = positions_dict["c2bend"]+0.5*positions_dict["c2benddiff"]
return {"c2bendbk":c2bendbk, "c2bendfr":c2bendfr}
bend2 = positions_dict["bend"]-0.5*positions_dict["benddiff"]
bend1 = positions_dict["bend"]+0.5*positions_dict["benddiff"]
return {"bend2":bend2, "bend1":bend1}
#class inclino(tango_attr_as_counter):
......
......@@ -585,7 +585,7 @@ def mesure_beam_oscill_fluo3(nbimages,Name):
def saveMonitorsImage(cam,string): #cam in binary string 0000 to 1111, each character for a camera: wires, fluo1, fluo2, fluo3
path = "/tmp/pictures/"
path = "/data/bm07/inhouse/FILM_DE_FIP/"
now=datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
if cam[0:1] == "1": # download wire camera picture
urllib.request.urlretrieve("http://bm07recorder.esrf.fr:7011/jpg/image.jpg", path + now + "_wires_" + string + ".jpg")
......@@ -597,7 +597,16 @@ def saveMonitorsImage(cam,string): #cam in binary string 0000 to 1111, each char
urllib.request.urlretrieve("http://bm07recorder.esrf.fr:7006/jpg/image.jpg", path + now + "_fluo3_" + string + ".jpg")
sleep(0.5)
def film_FIP(temps_en_deux_image_sec, duree_total_enregis_sec):
for i in range(0,int(duree_total_enregis_sec/temps_en_deux_image_sec)):
safshut.open()
sleep(2)
saveMonitorsImage("0001","")
sleep(2)
safshut.close()
sleep(temps_en_deux_image_sec)
def scanMovehM1Sl0(relMin, relMax, step, pics=False, sourceAngle_uRad=0):
M1posInit = m1up.position
MovehposInit = moveh.position
......@@ -942,13 +951,13 @@ def nrjcal_vYo2(eMin, eMax, eStep, tMoy):
import numpy as np
mca.mca.times['real_t_preset']=tMoy
mca.set_roi(2.0,15.0,channel=1,element="Se",atomic_nb=34)
txt="energy beta dstop dmono\n"
txt="energy beta p0 dstop dmono\n"
for e in np.arange(eMin,eMax,eStep):
energy.move(e)
mca.start_acq()
counts = pico_moyenne(tMoy)
resp = mca.mca.sl.write_readline(b"$GR 1\r")
p0 = int(resp[3:])
txt+="%f %f %f %f %f\n"%(energy.position, beta.position, p0,counts[0], counts[1])
txt+="%f %f %f %f %f\n"%(energy.position, beta.position, p0,counts[0], counts[0], counts[1])
print(txt)
......@@ -17,28 +17,40 @@ import time
class pseudo_shutter(object):
def __init__(self, name, config):
self.name = name
self.wago = config["wago"]
self.logical_device = config["logical_device"]
self.wago_cmd = config["wago_cmd"]
self.wago_cmd_device = config["wago_cmd_device"]
self.wago_state = config["wago_state"]
self.wago_state_device = config["wago_state_device"]
self.bac24 = config["bac24"]
self.channel = self.wago.controller.devname2key(self.logical_device)
self.channel = self.wago_state.controller.devname2key(self.wago_state_device)
def __info__(self):
bac24info = self.bac24.readramp()
shutmanualval = self.wago.get(self.logical_device)
shutmanualval = self.wago_cmd.get(self.wago_cmd_device)
shutrealpos = self.wago_state.get(self.wago_state_device)
info_string = f"'{self.name}` shutter manual + bac24 + robot:\n"
info_string += f" Wago = {self.wago.name}\n"
info_string += f" Logical device = {self.logical_device}\n"
info_string += f" Wago_cmd = {self.wago_cmd.name}\n"
info_string += f" Wago_cmd_device = {self.wago_cmd_device}\n"
info_string += f" Wago_state = {self.wago_state.name}\n"
info_string += f" Wago_state_devicee = {self.wago_state_device}\n"
info_string += f" BAC24 shutter ramp = {shutmanualval}\n"
if self.state():
info_string += f"OPEN\n"
else:
info_string += f"CLOSE\n"
return info_string
def open_manual(self):
self.wago.set(self.logical_device,1)
self.wago_cmd.set(self.wago_cmd_device,1)
def close_manual(self):
self.wago.set(self.logical_device,0)
self.wago_cmd.set(self.wago_cmd_device,0)
def set_manual_mode(self):
self.bac24.zero()
def get_manual_value(self):
return self.wago.get(self.logical_device)
return self.wago_cmd.get(self.wago_cmd_device)
def state(self):
return self.wago_state.get(self.wago_state_device)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment