def OnEnter(self,event):
     text = self.Timepoints.Value
     self.Parent.timepoints = \
         [seconds(t) for t in text.split(",") if not isnan(seconds(t))]
     self.Parent.min_dt = seconds(self.Min.Value)
     self.Parent.max_dt = seconds(self.Max.Value)
     self.Parent.update_interval = seconds(self.UpdateInterval.Value)
     self.update()
     self.Parent.refresh_chart()
 def OnChange(self, event):
     from time_string import seconds
     value = seconds(self.Current.Value.replace(" ", ""))
     self.pre_update()
     setattr(self.register, self.attribute, value)
     for proc in self.update:
         proc()
     self.refresh()
 def OnIncr(self, event):
     from time_string import seconds
     step = self.next_step(seconds(self.Step.Value))
     self.pre_update()
     value = getattr(self.register, self.attribute)
     value += step
     setattr(self.register, self.attribute, value)
     self.post_update()
     for proc in self.update:
         proc()
     self.refresh()
def filename_delay(filename):
    """Decode image filename and extract delay
    e.g. "AlCl3-2_1_90C_-10us-3.mccd" -> -10e-6"""
    from time_string import seconds
    delay = filename.replace(".mccd","")
    delay = delay.split("_")[-1]
    if delay.startswith("-"): delay = delay[1:]; sign = "-"
    else: sign = "-"
    delay = delay.split("-")[0]
    delay = sign+delay
    delay = seconds(delay)
    return delay
Beispiel #5
0
def motor_position(s, format="%g"):
    """Convert string to float and return 'not a number' if not possiple"""
    from time_string import seconds
    from numpy import nan
    if "time" in format: value = seconds(s)
    elif "s" in format: value = s  # "%s" -> keep as string
    else:
        try:
            value = float(eval(s))
        except Exception:
            value = nan
    return value
 def OnSet(self, event):
     from time_string import time_string, seconds
     from numpy import isnan
     dlg = wx.TextEntryDialog(self, "New user value", "Redefine User Value",
                              "")
     dlg.Value = time_string(self.register.value)
     OK = (dlg.ShowModal() == wx.ID_OK)
     if not OK: return
     value = seconds(dlg.Value)
     if isnan(value): return
     setattr(self.register, self.attribute, value - self.register.dial)
     ##self.register.define_value(value)
     self.refresh()
 def OnStep(self, event):
     from time_string import time_string, seconds
     step = self.next_step(seconds(self.Step.Value))
     self.step = step
     self.Step.Value = time_string(self.step)
     self.refresh()
Beispiel #8
0
 def get_time_window(self):
     value = seconds(self.TimeWindow.Value)
     debug("Read TimeWindow %r: %g s" % (self.TimeWindow.Value, value))
     return value