Commit e8a3630e authored by Antonia Beteva's avatar Antonia Beteva
Browse files

controllers/leica_microscope.py: removed unused 'oscil' method, call ABORT on...

controllers/leica_microscope.py: removed unused 'oscil' method, call ABORT on musst in data_collection_end_hook, added third column in diag file
parent a03de106
......@@ -108,7 +108,7 @@ class LeicaMicroscope:
calc_velocity = float(abs_ang) / osctime
acc_time = 0.1
acc_ang = (acc_time * calc_velocity) / 2
return d, calc_velocity, acc_time, acc_ang #oscil_start, oscil_final, calc_velocity, acc_time, acc_ang
return d, calc_velocity, acc_time, acc_ang
def oscil_prepare(self, start_ang, stop_ang, exp_time,diagfile=None, operate_shutter=False):
d, calc_velocity, acc_time, acc_ang = self._oscil_calc(start_ang, stop_ang, exp_time)
......@@ -142,53 +142,18 @@ class LeicaMicroscope:
return oscil_final
def data_collection_end_hook(self):
return
def oscil(self, start_ang, stop_ang, exp_time,diagfile=None, operate_shutter=False):
d, calc_velocity, acc_time, acc_ang = self._oscil_calc(start_ang, stop_ang, exp_time)
def oscil_cleanup(v=self.phi.velocity(from_config=True), a=self.phi.acceleration(from_config=True)):
self.phi.velocity(v)
self.phi.acceleration(a)
with cleanup(oscil_cleanup):
#self.fshut.close()
#encoder_step_size = -self.phi.steps_per_unit
encoder_step_size = self.phi.steps_per_unit
pixel_detector_trigger_steps = encoder_step_size*start_ang
shutter_predelay_steps = math.fabs(float(self.shutter_predelay * calc_velocity * encoder_step_size))
shutter_postdelay_steps = math.fabs(float(self.shutter_postdelay * calc_velocity * encoder_step_size))
oscil_start = start_ang - d*(acc_ang + shutter_predelay_steps/encoder_step_size)
oscil_final = stop_ang + d*acc_ang
self.phi.move(oscil_start)
self.phi.velocity(calc_velocity)
self.phi.acctime(acc_time)
if operate_shutter:
e1=oscil_start*encoder_step_size + 5
e2=oscil_final*encoder_step_size - 5
esh1 = start_ang*encoder_step_size - d*shutter_predelay_steps
esh2 = stop_ang*encoder_step_size - d*shutter_postdelay_steps
self._musst_prepare(e1, e2, esh1, esh2, pixel_detector_trigger_steps)
self.phi.move(oscil_final)
if diagfile:
self._diagnostic_task = self.save_diagnostic(diagfile, wait=False)
self.musst.putget("ABORT")
@task
def save_diagnostic(self, diagfile, phi_encoder_pos=0):
from_last = 0
with open(diagfile, "a+") as diagfile:
diagfile.write("\n#S %d\n#D %s\n" % (self._diag_n, datetime.datetime.now().strftime("%a %b %d %H:%M:%S %Y")))
diagfile.write("#N %d\n" % 2)
diagfile.write("#L Time(ms) Phi\n")
diagfile.write("#N %d\n" % 3)
diagfile.write("#L Time(us) Phi DetectorTrigger\n")
while self.musst.STATE == self.musst.RUN_STATE:
diag_data = self.musst.get_data(2, from_last)
diag_data = self.musst.get_data(3, from_last)
if diag_data.size > 0:
from_last += diag_data.shape[0]
numpy.savetxt(diagfile, diag_data)
......
Supports Markdown
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