From ef24a758e5efd3d1f4dfbac1ed789c45bf2e5528 Mon Sep 17 00:00:00 2001 From: SarthakJariwala Date: Mon, 6 May 2019 14:44:56 -0700 Subject: [PATCH] modiy 'live' function --- wavelengths are saved at the end now, while statement modified --- .../OceanOptics_acquire/OceanOptics_acquire_plot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PythonGUI_apps/OceanOptics_acquire/OceanOptics_acquire_plot.py b/PythonGUI_apps/OceanOptics_acquire/OceanOptics_acquire_plot.py index 55bc224..4bff33c 100644 --- a/PythonGUI_apps/OceanOptics_acquire/OceanOptics_acquire_plot.py +++ b/PythonGUI_apps/OceanOptics_acquire/OceanOptics_acquire_plot.py @@ -230,18 +230,18 @@ def save_single_spec(self): def live(self): save_array = np.zeros(shape=(2048,2)) - save_array[:,0] = self.spec.wavelengths() self.ui.plot.setLabel('left', 'Intensity', units='a.u.') self.ui.plot.setLabel('bottom', 'Wavelength', units='nm') j = 0 - while self.ui.connect_checkBox.isChecked(): # this while loop works! + while self.spec is not None:#self.ui.connect_checkBox.isChecked(): # this while loop works! self._read_spectrometer() save_array[:,1] = self.y self.ui.plot.plot(self.spec.wavelengths(), self.y, pen='r', clear=True) if self.ui.save_every_spec_checkBox.isChecked(): + save_array[:,0] = self.spec.wavelengths() np.savetxt(self.save_folder+"/"+self.ui.lineEdit.text()+str(j)+".txt", save_array, fmt = '%.5f', header = 'Wavelength (nm), Intensity (counts)', delimiter = ' ')