Skip to content

Commit ef24a75

Browse files
modiy 'live' function --- wavelengths are saved at the end now, while statement modified
1 parent c639079 commit ef24a75

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

PythonGUI_apps/OceanOptics_acquire/OceanOptics_acquire_plot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,18 +230,18 @@ def save_single_spec(self):
230230

231231
def live(self):
232232
save_array = np.zeros(shape=(2048,2))
233-
save_array[:,0] = self.spec.wavelengths()
234233

235234
self.ui.plot.setLabel('left', 'Intensity', units='a.u.')
236235
self.ui.plot.setLabel('bottom', 'Wavelength', units='nm')
237236
j = 0
238-
while self.ui.connect_checkBox.isChecked(): # this while loop works!
237+
while self.spec is not None:#self.ui.connect_checkBox.isChecked(): # this while loop works!
239238
self._read_spectrometer()
240239
save_array[:,1] = self.y
241240

242241
self.ui.plot.plot(self.spec.wavelengths(), self.y, pen='r', clear=True)
243242

244243
if self.ui.save_every_spec_checkBox.isChecked():
244+
save_array[:,0] = self.spec.wavelengths()
245245
np.savetxt(self.save_folder+"/"+self.ui.lineEdit.text()+str(j)+".txt", save_array, fmt = '%.5f',
246246
header = 'Wavelength (nm), Intensity (counts)', delimiter = ' ')
247247

0 commit comments

Comments
 (0)