Skip to content

Merging all new updates #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 65 commits into from
Mar 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
cea70f3
fix viewbox error
Aug 23, 2019
5dd9f37
added csv handling, added ref/inpath/outpath data options
Aug 23, 2019
6dbf4e3
disable col selection auto close
Aug 23, 2019
28cbe55
fix loading files for single spec as saved from microscope app, added…
SarthakJariwala Aug 26, 2019
0eebe88
added 4th order poly fit for scattering correction, can choose b/w me…
SarthakJariwala Aug 27, 2019
eca3884
Update README.md
SarthakJariwala Aug 27, 2019
e00d96e
load in text file of histogram sums for plotting, old labview txt fil…
SarthakJariwala Aug 28, 2019
06ba42d
ui modifications, change textedit to spinbox
SarthakJariwala Aug 28, 2019
c44991b
launch h5/pkl viewer when h5 or pkl file is loaded in FLIM Analysis, …
SarthakJariwala Aug 28, 2019
793f4bf
launch pkl/h5 viewer for spectra scan raw and fit files
SarthakJariwala Aug 29, 2019
04d4828
implemented much faster saving of fit file and loading fit file, opti…
SarthakJariwala Aug 29, 2019
ded12b5
minor import statement fix
SarthakJariwala Aug 30, 2019
a43a68b
pkl view now reads lmfit ModelResult from a saved fit result file and…
SarthakJariwala Aug 30, 2019
ccee7df
implement busy cursor, fit files now have 'Scan Paramaters' and 'Ocea…
SarthakJariwala Aug 30, 2019
48ddbf1
minor fixes
SarthakJariwala Aug 30, 2019
78ecc3f
analyze individual spectrum fits from spectra fit file, will open mat…
SarthakJariwala Sep 2, 2019
e7c5fb5
remove old ui file
SarthakJariwala Sep 2, 2019
c08e572
add a new table view for general use, can be easily edited, selective…
SarthakJariwala Sep 3, 2019
30686b9
comment correction
SarthakJariwala Sep 3, 2019
c9587b4
minor gui fixes
SarthakJariwala Sep 3, 2019
f2ded3e
fixed background correction problem for analyzing PSF, corrected usin…
SarthakJariwala Sep 4, 2019
a107fea
fix single spec file input, fix plot function for single spectrum
SarthakJariwala Sep 9, 2019
72b5457
auto configure wavelength range for PhotonEtc hyperspec data, no need…
SarthakJariwala Oct 15, 2019
7110331
added option to smooth traces using simple boxcar width smoothening
SarthakJariwala Oct 22, 2019
4413533
create a new export plot ui window
SarthakJariwala Oct 25, 2019
2fa77a7
parameters for export figure can now be controlled using export fig w…
SarthakJariwala Oct 28, 2019
73f2011
change upper X lim auto display value
SarthakJariwala Oct 28, 2019
5bf7e64
inlcude export figure window for exporting images
SarthakJariwala Oct 29, 2019
4532fa1
calculate both conditions, srv1=srv2 and srv1=0, while doing srv calc…
SarthakJariwala Nov 4, 2019
ae68877
change x lower lim to include negative numbers, y lower lim is now 4 …
SarthakJariwala Nov 4, 2019
0d21d2d
Refactor Code to have a separate Export Window module imported when r…
SarthakJariwala Nov 4, 2019
fe38a7a
delete ui files- cosequence of code refactor
SarthakJariwala Nov 4, 2019
6d5a0e9
update ExportImages class
SarthakJariwala Nov 4, 2019
e2c7918
Include CheckBox for ColorBar Label and check for state
SarthakJariwala Nov 4, 2019
bc1d1ab
Export Window included in FLIM export
SarthakJariwala Nov 4, 2019
95d5606
Fix export figure window not popping up issue
SarthakJariwala Nov 4, 2019
9989212
set colorbar values based on min max of data
SarthakJariwala Nov 5, 2019
4d8d74d
FIX: X,Y pixels now take np.ceil of ScanSize/StepSize
SarthakJariwala Nov 18, 2019
9eb4fd5
change no of skiprows for csv loading statement
SarthakJariwala Nov 28, 2019
804727f
FIX:4th order polyfit
SarthakJariwala Nov 30, 2019
3bc7b4e
FLIM_adjust made False to make it look exactly as the data comes in
SarthakJariwala Dec 9, 2019
bda05b2
added .QUA file type compatibility for analysis
SarthakJariwala Feb 11, 2020
872da74
avg lifetime in double exponential assigned to greater of the taus an…
SarthakJariwala Feb 11, 2020
2270b02
Added another viewing capability for PL line scans after fitting
SarthakJariwala Feb 23, 2020
7b41091
Convert Multiple PKL files to H5 and TXT at once
SarthakJariwala Mar 7, 2020
ceb7c6e
increase skipheader for QUA files
SarthakJariwala Mar 7, 2020
90278cb
add TODO note
SarthakJariwala Mar 7, 2020
ced176b
pop up plots for spectra scans and fits
SarthakJariwala Mar 12, 2020
08af959
some gui rearrangements
SarthakJariwala Mar 12, 2020
74296f9
initial attempts at sorting 'Analyse Spectra Fits' function
SarthakJariwala Mar 12, 2020
9475741
modified spec file
SarthakJariwala Mar 15, 2020
d591cbc
clean up
SarthakJariwala Mar 16, 2020
f68fcce
Merge branch 'development' of https://github.com/SarthakJariwala/Pyth…
SarthakJariwala Mar 16, 2020
0c66cf3
clean up
SarthakJariwala Mar 16, 2020
027fec1
added TODO
SarthakJariwala Mar 16, 2020
d5166ba
adding multi-trace exporter for picoharp data
SarthakJariwala Mar 16, 2020
6580ad0
add multiple traces for export
SarthakJariwala Mar 16, 2020
d97bcf7
export mulitple plots and fits to the same export plot w legend; can …
SarthakJariwala Mar 17, 2020
3d5f259
changes to export window
SarthakJariwala Mar 17, 2020
98ac680
Export mulitple plots and fits w legends from multiple files, started…
SarthakJariwala Mar 17, 2020
f102eac
changes to include fit in eV instead of nm, lmfit not able to fit it …
SarthakJariwala Mar 17, 2020
7da1bb4
can now fit and plot spectra in eV, user bound inputs are still in nm…
SarthakJariwala Mar 17, 2020
4a58856
add decimal and neg value input for x lims
SarthakJariwala Mar 17, 2020
c9487fd
pop-up plot widget, expand textbrowser view
SarthakJariwala Mar 17, 2020
4baa92f
Merge branch 'master' into development
SarthakJariwala Mar 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions PythonGUI_apps/DataBrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
from PLQE_analysis import plqe_analysis
from H5_Pkl import h5_pkl_view, h5_view_and_plot
from Image_analysis import Image_analysis
from Table import Table_widget
from Export_Windows import Multi_Trace_Exporter

pg.mkQApp()
#pg.setConfigOption('background', 'w')

Expand All @@ -38,7 +41,8 @@ def __init__(self):
self.ui = WindowTemplate()
self.ui.setupUi(self)
self.ui.select_comboBox.addItems(["Lifetime Analysis", "Spectrum Analysis", "FLIM Analysis",
"UV-Vis Analysis", "PLQE Analysis", "H5 View/Plot", "H5/PKL Viewer", "Image Analysis"])
"UV-Vis Analysis", "PLQE Analysis", "H5 View/Plot", "H5/PKL Viewer", "Image Analysis", "Table View",
"Mulit-Trace Exporter"])
self.ui.load_pushButton.clicked.connect(self.load_app)

self.show()
Expand Down Expand Up @@ -72,7 +76,12 @@ def load_app(self):
elif analysis_software == "Image Analysis":
self.image_window = Image_analysis.MainWindow()
self.image_window.show()

elif analysis_software == "Table View":
self.table_widget = Table_widget.MainWindow()
self.table_widget.show()
elif analysis_software == "Mulit-Trace Exporter":
self.trace_exporter = Multi_Trace_Exporter.MainWindow()
self.trace_exporter.show()


def run():
Expand Down
7 changes: 4 additions & 3 deletions PythonGUI_apps/DataBrowser.spec
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- mode: python -*-
# -*- mode: python ; coding: utf-8 -*-

block_cipher = None


a = Analysis(['C:\\Users\\lindat18\\Dropbox\\Ginger_Lab\\Data_Analysis\\PythonGUI_apps\\DataBrowser.py'],
pathex=['C:\\Users\\lindat18\\Dropbox\\Ginger_Lab\\Data_Analysis\\PythonGUI_apps'],
a = Analysis(['DataBrowser.py'],
pathex=['E:\\QT_projects\\Python_GUI_apps\\PythonGUI_apps'],
binaries=[],
datas=[],
hiddenimports=['ipykernel.datapub'],
Expand Down Expand Up @@ -33,4 +33,5 @@ coll = COLLECT(exe,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='DataBrowser')
77 changes: 77 additions & 0 deletions PythonGUI_apps/Export_Windows/Export_window.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 3 20:43:12 2019

@author: sarth
"""
from pathlib import Path
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui

"""Export Images GUI"""
base_path = Path(__file__).parent
ui_file_path = (base_path / "export_fig_gui.ui").resolve()
exportFig_WindowTemplate, exportFig_TemplateBaseClass = pg.Qt.loadUiType(ui_file_path)

class ExportFigureWindow(exportFig_TemplateBaseClass):

export_fig_signal = QtCore.pyqtSignal()

def __init__(self):
exportFig_TemplateBaseClass.__init__(self)

self.ui = exportFig_WindowTemplate()
self.ui.setupUi(self)
self.ui.cmap_comboBox.addItems(['viridis', 'plasma', 'inferno', 'magma',
'cividis','Greys', 'Purples', 'Blues',
'Greens', 'Oranges', 'Reds', 'YlOrBr',
'YlOrRd', 'OrRd', 'PuRd', 'RdPu', 'BuPu',
'GnBu', 'PuBu', 'YlGnBu', 'PuBuGn', 'BuGn',
'YlGn', 'binary', 'gist_yarg', 'gist_gray',
'gray', 'bone', 'pink', 'spring', 'summer',
'autumn', 'winter', 'cool', 'Wistia', 'hot',
'afmhot', 'gist_heat', 'copper', 'rainbow', 'jet'])
self.ui.cbar_checkBox.stateChanged.connect(self.cbar_title_state)
self.ui.exportFig_pushButton.clicked.connect(self.export)
self.show()

def cbar_title_state(self):
if self.ui.cbar_checkBox.isChecked():
self.ui.cbar_label.setEnabled(True)
else:
self.ui.cbar_label.setEnabled(False)

def export(self):
self.export_fig_signal.emit()
self.close()

"""Export plot GUI"""
ui_file_path = (base_path / "export_plot.ui").resolve()
export_WindowTemplate, export_TemplateBaseClass = pg.Qt.loadUiType(ui_file_path)

class ExportPlotWindow(export_TemplateBaseClass):

export_fig_signal = QtCore.pyqtSignal()

def __init__(self):
export_TemplateBaseClass.__init__(self)

self.ui = export_WindowTemplate()
self.ui.setupUi(self)
#self.ui.traceColor_comboBox.addItems(["C0","C1","C2","C3","C4","C5","C6","C7", "r", "g", "b", "y", "k"])
#self.ui.fitColor_comboBox.addItems(["k", "r", "b", "y", "g","C0","C1","C2","C3","C4","C5","C6","C7"])
self.ui.export_pushButton.clicked.connect(self.export)
#self.ui.legend_checkBox.stateChanged.connect(self.legend_title)
self.show()

#def legend_title(self):
# if self.ui.legend_checkBox.isChecked():
# self.ui.legend1_lineEdit.setEnabled(True)
# self.ui.legend2_lineEdit.setEnabled(True)
# else:
# self.ui.legend1_lineEdit.setEnabled(False)
# self.ui.legend2_lineEdit.setEnabled(False)

def export(self):
self.export_fig_signal.emit()
self.close()
147 changes: 147 additions & 0 deletions PythonGUI_apps/Export_Windows/Multi_Trace_Exporter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
import pyqtgraph as pg
from pathlib import Path
from pyqtgraph.Qt import QtCore, QtGui, QtWidgets
try:
from Lifetime_analysis.read_ph_phd import read_picoharp_phd, get_x_y
except Exception as e:
print(e)
import matplotlib.pyplot as plt

"""Recylce params for plotting"""
plt.rc('xtick', labelsize = 20)
plt.rc('xtick.major', pad = 3)
plt.rc('ytick', labelsize = 20)
plt.rc('lines', lw = 2.5, markersize = 7.5)
plt.rc('legend', fontsize = 20)
plt.rc('axes', linewidth=3.5)

pg.mkQApp()

base_path = Path(__file__).parent
file_path = (base_path / "Multi_Trace_Exporter.ui").resolve()

uiFile = file_path

WindowTemplate, TemplateBaseClass = pg.Qt.loadUiType(uiFile)

class MainWindow(TemplateBaseClass):

def __init__(self):
super(TemplateBaseClass, self).__init__()

# Create the main window
self.ui = WindowTemplate()
self.ui.setupUi(self)

self.temp_layout = pg.GraphicsLayoutWidget()

# file system tree
self.fs_model = QtWidgets.QFileSystemModel()
self.fs_model.setRootPath(QtCore.QDir.currentPath())
self.ui.treeView.setModel(self.fs_model)
self.ui.treeView.setIconSize(QtCore.QSize(25,25))
self.ui.treeView.setSortingEnabled(True)

self.tree_selectionModel = self.ui.treeView.selectionModel()
self.tree_selectionModel.selectionChanged.connect(self.on_treeview_selection_change)

self.ui.comboBox.currentIndexChanged.connect(self.add_trace_to_temp_plot)
self.ui.add_pushButton.clicked.connect(self.add_trace_to_mem)
self.ui.export_pushButton.clicked.connect(self.pub_ready_plot_export)

self.x_i = []
self.y_i = []
self.x_mem = []
self.y_mem = []
self.legend = []

self.show()

def on_treeview_selection_change(self):
try:
fname = self.fs_model.filePath(self.tree_selectionModel.currentIndex())
_ , ext = fname.rsplit('.',1)

self.ui.comboBox.clear()
self.ui.textBrowser.clear()
self.x_i = []
self.y_i = []

if ext in ['phd']:
self.parser = read_picoharp_phd(fname)
curve_list = []

for i in range(self.parser.no_of_curves()):
curve_list.append("Curve "+str(i))
x, y = get_x_y(i, self.parser, smooth_trace=self.ui.smooth_checkBox.isChecked(), boxwidth=self.ui.smooth_spinBox.value())
self.x_i.append(x)
self.y_i.append(y)

self.ui.comboBox.addItems(curve_list)
self.ui.textBrowser.setText(str(self.parser.info()))

else:
self.ui.textBrowser.setText(str("Select a PicoHarp File"))
except Exception as e:
print(e)

def add_trace_to_temp_plot(self):
try:
#self.temp_layout = pg.GraphicsLayoutWidget()
self.temp_layout.clear()
self.temp_plot = self.temp_layout.addPlot(title = "Current Selection")
self.temp_plot.plot(self.x_i[self.ui.comboBox.currentIndex()], self.y_i[self.ui.comboBox.currentIndex()], pen='r')
self.temp_plot.setLogMode(False, True)
self.temp_layout.show()
except Exception as e:
print(e)

def add_trace_to_mem(self):
try:
self.x_mem.append(self.x_i[self.ui.comboBox.currentIndex()])
self.y_mem.append(self.y_i[self.ui.comboBox.currentIndex()])
self.legend.append(self.ui.lineEdit.text())
except Exception as e:
print(e)

def pub_ready_plot_export(self):
try:
filename = QtWidgets.QFileDialog.getSaveFileName(self,caption="Filename with EXTENSION")

plt.figure(figsize=(8,6))
plt.tick_params(direction='out', length=8, width=3.5)
for i in range(len(self.x_mem)):
if self.ui.Normalize_checkBox.isChecked():
plt.plot(self.x_mem[i], self.y_mem[i]/max(self.y_mem[i]), label=str(self.legend[i]))
else:
plt.plot(self.x_mem[i], self.y_mem[i], label=str(self.legend[i]))

plt.yscale('log')
plt.xlabel("Time (ns)", fontsize=20, fontweight='bold')
plt.ylabel("Intensity (norm.)", fontsize=20, fontweight='bold')
plt.legend()
plt.tight_layout()

plt.savefig(filename[0],bbox_inches='tight', dpi=300)
plt.close()

self.clear_memory()

except Exception as e:
print(e)
pass

def clear_memory(self):
self.x_mem = []
self.y_mem = []
self.legend = []




def run():
win = MainWindow()
QtGui.QApplication.instance().exec_()
return win

#run()
85 changes: 85 additions & 0 deletions PythonGUI_apps/Export_Windows/Multi_Trace_Exporter.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1108</width>
<height>1063</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QComboBox" name="comboBox"/>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="smooth_checkBox">
<property name="text">
<string>Smoothen Trace</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLineEdit" name="lineEdit">
<property name="text">
<string>Enter Trace Legend Here</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="add_pushButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="Normalize_checkBox">
<property name="text">
<string>Normalize (for export)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="smooth_spinBox">
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="export_pushButton">
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QTextBrowser" name="textBrowser"/>
</item>
<item row="3" column="0">
<widget class="QTreeView" name="treeView"/>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1108</width>
<height>38</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>
1 change: 1 addition & 0 deletions PythonGUI_apps/Export_Windows/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# -*- coding: utf-8 -*-
Loading