added exporter for NIS
@@ -3142,8 +3142,8 @@ class Window(QtGui.QMainWindow):
file_menu.addSeparator()
export_txt_action = file_menu.addAction('Export as .txt for FRC')
export_txt_action.triggered.connect(self.export_txt)
- #export_txt_nis_action = file_menu.addAction('Export as .txt for NIS')
- #export_txt_nis_action.triggered.connect(self.export_txt_nis)
+ export_txt_nis_action = file_menu.addAction('Export as .txt for NIS')
+ export_txt_nis_action.triggered.connect(self.export_txt_nis)
view_menu = self.menu_bar.addMenu('View')
display_settings_action = view_menu.addAction('Display settings')
@@ -3308,12 +3308,21 @@ class Window(QtGui.QMainWindow):
path = QtGui.QFileDialog.getSaveFileName(self, 'Save localizations as txt for NIS (x,y,z,channel,width,bg,length,area,frame)', out_path, filter='*.nis.txt')
if path:
locs = self.view.locs[channel]
+ if hasattr(locs, 'z'):
loctxt = locs[['x','y','z','sx','bg','photons','frame']].copy()
loctxt = [(row[0]*pixelsize, row[1]*pixelsize, row[2], 1, row[3]*pixelsize, row[4], 1, row[5], row[6]) for row in loctxt]
with open(path, 'wb') as f:
f.write(b'X\tY\tZ\tChannel\tWidth\tBG\tLength\tArea\tFrame\r\n')
np.savetxt(f, loctxt, fmt=['%.2f','%.2f','%.2f','%.i','%.2f','%.i','%.i','%.i','%.i'], newline='\r\n', delimiter='\t')
print('Saving complete.')
+ else:
+ loctxt = locs[['x','y','sx','bg','photons','frame']].copy()
+ loctxt = [(row[0]*pixelsize, row[1]*pixelsize, 1, row[2]*pixelsize, row[3], 1, row[4], row[5]) for row in loctxt]
+ with open(path, 'wb') as f:
+ f.write(b'X\tY\tChannel\tWidth\tBG\tLength\tArea\tFrame\r\n')
+ np.savetxt(f, loctxt, fmt=['%.2f','%.2f','%.i','%.2f','%.i','%.i','%.i','%.i'], newline='\r\n', delimiter='\t')
+ print('Saving complete.')
+
def load_picks(self):
path = QtGui.QFileDialog.getOpenFileName(self, 'Load pick regions', filter='*.yaml')
