def save_classifications(self): filename = save_file_gui("Save classifications", filetypes='*.json') if filename is None: return None states = [np.asscalar(a) for a in self.window_states] data = {'states': states} # this saves the array in .json format json.dump(data, codecs.open(filename, 'w', encoding='utf-8'), separators=(',', ':'), sort_keys=True, indent=4)
def save_data(self): filename = save_file_gui(prompt="Save CDF", filetypes='.txt') if filename == '' or filename is None: return xdata = self.squared_SLDs ydata = self.y data = np.array([xdata, ydata]).T np.savetxt(filename, data, fmt='%f') #SLD_Histogram(g.m.pynsight.points) #y,x =np.histogram(track_lens, bins = np.arange(np.max(track_lens))) #x=x[:-1] #pg.plot(x,y)
def save_training_data(self): progress = g.quantimus.create_progress_bar( 'Please wait training data is being saved...') progress.show() QtWidgets.QApplication.processEvents() filename = save_file_gui("Save training_data", filetypes='*.json') if filename is None: return None x, y = self.get_training_data() y = y.tolist() x = x.tolist() data = {'features': x, 'states': y} # this saves the array in .json format json.dump(data, codecs.open(filename, 'w', encoding='utf-8'), separators=(',', ':'), sort_keys=True, indent=4)
def select_file(self): filename = save_file_gui("Select file name") self.fnameTextBox.setText(filename) print(filename)
def export_histogram(self): filename = save_file_gui(prompt="Save Histogram", filetypes='.txt') if filename != '' and filename is not None: np.savetxt(filename, self.plotWidget.plot_data, fmt='%f')