diff options
author | andreas128 <Andreas> | 2016-12-02 10:03:43 +0100 |
---|---|---|
committer | andreas128 <Andreas> | 2016-12-02 10:03:43 +0100 |
commit | 9623ce222ae217b816eb11dcb4bdf3289dc616cb (patch) | |
tree | c12230ebcb3ea77ead6814585c2b897646f2d2ba /amplitude_ramp.py | |
parent | d31ea5a51f0cc17b0556423896b7b0b7b3c2c217 (diff) | |
download | ODR-StaticPrecorrection-9623ce222ae217b816eb11dcb4bdf3289dc616cb.tar.gz ODR-StaticPrecorrection-9623ce222ae217b816eb11dcb4bdf3289dc616cb.tar.bz2 ODR-StaticPrecorrection-9623ce222ae217b816eb11dcb4bdf3289dc616cb.zip |
Linearised by using search for best amplitude
Diffstat (limited to 'amplitude_ramp.py')
-rwxr-xr-x | amplitude_ramp.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/amplitude_ramp.py b/amplitude_ramp.py index 7ef72e8..fb06d84 100755 --- a/amplitude_ramp.py +++ b/amplitude_ramp.py @@ -68,6 +68,9 @@ class RampGenerator(threading.Thread): if not options.lut is '': self.lut_dict = pickle.load(open(options.lut, "rb")) + assert(type(self.lut_dict) == dict) + assert(len(self.lut_dict["ampl"]) > 2) + assert(len(self.lut_dict["fac"]) > 2) self.tcpa = tcpa @@ -75,7 +78,10 @@ class RampGenerator(threading.Thread): if self.lut_dict is None: return 1 else: - return np.interp(ampl, self.lut_dict["ampl"], self.lut_dict["fac"]) + interp = np.interp(ampl, self.lut_dict["ampl"], self.lut_dict["fac"]) + print("interp " + str(interp)) + print("ampl " + str(ampl)) + return interp def set_source_ampl(self, ampl): self.event_queue_.put(ampl) @@ -107,8 +113,10 @@ class RampGenerator(threading.Thread): amplitudes = xrange(self.ampl_start, self.ampl_stop, self.ampl_step) measurements = [] - for ampl in amplitudes: + for idx, ampl in enumerate(amplitudes): + print("run ampl " + str(ampl)) ampl_lut = self.lut(ampl) * ampl + print("run ampl_lut " + str(ampl_lut)) measurement_correct = False max_iter = 10 while measurement_correct == False and max_iter > 0: @@ -240,6 +248,8 @@ try: elif event == "quit": break else: + print("event") + print(event) top.set_source_ampl(event) rampgen.confirm_source_ampl_updated() finally: |