chromaquant 0.4.0__py3-none-any.whl → 0.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. chromaquant/__init__.py +9 -2
  2. chromaquant/data/__init__.py +14 -0
  3. chromaquant/data/breakdown.py +430 -0
  4. chromaquant/data/dataset.py +195 -0
  5. chromaquant/data/table.py +412 -0
  6. chromaquant/data/value.py +215 -0
  7. chromaquant/formula/__init__.py +13 -0
  8. chromaquant/formula/base_formulas.py +168 -0
  9. chromaquant/formula/formula.py +507 -0
  10. chromaquant/import_local_packages.py +55 -0
  11. chromaquant/logging_and_handling.py +76 -0
  12. chromaquant/match/__init__.py +13 -0
  13. chromaquant/match/match.py +184 -0
  14. chromaquant/match/match_config.py +296 -0
  15. chromaquant/match/match_tools.py +154 -0
  16. chromaquant/{Quant → results}/__init__.py +2 -2
  17. chromaquant/results/reporting_tools.py +190 -0
  18. chromaquant/results/results.py +250 -0
  19. chromaquant/utils/__init__.py +14 -0
  20. chromaquant/utils/categories.py +127 -0
  21. chromaquant/utils/chemical_formulas.py +104 -0
  22. chromaquant/utils/dataframe_processing.py +222 -0
  23. chromaquant/utils/file_tools.py +100 -0
  24. chromaquant/utils/formula_tools.py +119 -0
  25. chromaquant-0.5.0.dist-info/METADATA +61 -0
  26. chromaquant-0.5.0.dist-info/RECORD +29 -0
  27. {chromaquant-0.4.0.dist-info → chromaquant-0.5.0.dist-info}/WHEEL +1 -1
  28. {chromaquant-0.4.0.dist-info → chromaquant-0.5.0.dist-info}/licenses/LICENSE.txt +1 -1
  29. chromaquant-0.5.0.dist-info/licenses/LICENSES_bundled.txt +251 -0
  30. chromaquant/Handle/__init__.py +0 -13
  31. chromaquant/Handle/fileChecks.py +0 -172
  32. chromaquant/Handle/handleDirectories.py +0 -89
  33. chromaquant/Hydro/__init__.py +0 -12
  34. chromaquant/Hydro/hydroMain.py +0 -496
  35. chromaquant/Manual/HydroUI.py +0 -418
  36. chromaquant/Manual/QuantUPP.py +0 -373
  37. chromaquant/Manual/Quantification.py +0 -1305
  38. chromaquant/Manual/__init__.py +0 -10
  39. chromaquant/Manual/duplicateMatch.py +0 -211
  40. chromaquant/Manual/fpm_match.py +0 -798
  41. chromaquant/Manual/label-type.py +0 -179
  42. chromaquant/Match/AutoFpmMatch.py +0 -1133
  43. chromaquant/Match/MatchSub/__init__.py +0 -13
  44. chromaquant/Match/MatchSub/matchTools.py +0 -282
  45. chromaquant/Match/MatchSub/peakTools.py +0 -259
  46. chromaquant/Match/__init__.py +0 -13
  47. chromaquant/Match/matchMain.py +0 -233
  48. chromaquant/Quant/AutoQuantification.py +0 -1329
  49. chromaquant/Quant/QuantSub/__init__.py +0 -15
  50. chromaquant/Quant/QuantSub/gasFID.py +0 -241
  51. chromaquant/Quant/QuantSub/gasTCD.py +0 -425
  52. chromaquant/Quant/QuantSub/liquidFID.py +0 -310
  53. chromaquant/Quant/QuantSub/parseTools.py +0 -162
  54. chromaquant/Quant/quantMain.py +0 -417
  55. chromaquant/UAPP/__init__.py +0 -12
  56. chromaquant/UAPP/uappMain.py +0 -427
  57. chromaquant/__main__.py +0 -526
  58. chromaquant/oldui.py +0 -492
  59. chromaquant/properties.json +0 -4
  60. chromaquant-0.4.0.dist-info/METADATA +0 -189
  61. chromaquant-0.4.0.dist-info/RECORD +0 -38
  62. chromaquant-0.4.0.dist-info/entry_points.txt +0 -2
  63. chromaquant-0.4.0.dist-info/licenses/LICENSES_bundled.txt +0 -1035
chromaquant/__main__.py DELETED
@@ -1,526 +0,0 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
- """
4
- COPYRIGHT STATEMENT:
5
-
6
- ChromaQuant – A quantification software for complex gas chromatographic data
7
-
8
- Copyright (c) 2024, by Julia Hancock
9
- Affiliation: Dr. Julie Elaine Rorrer
10
- URL: https://www.rorrerlab.com/
11
-
12
- License: BSD 3-Clause License
13
-
14
- ---
15
-
16
- SCRIPT FOR SIMPLIFYING ANALYSIS WORKFLOW
17
-
18
- Julia Hancock
19
- Started 12-10-2024
20
-
21
- """
22
-
23
- """ PACKAGES """
24
- print("[__main__] Loading packages...")
25
- import tkinter as tk
26
- from tkinter import ttk
27
- from ttkthemes import ThemedTk
28
- import tkinter.font as tkFont
29
- import os
30
- import sys
31
- from PIL import Image, ImageTk
32
- from datetime import datetime
33
- import importlib.util
34
- import threading
35
- import time
36
- import json
37
-
38
- """ LOCAL PACKAGES """
39
- print("[__main__] Importing local packages...")
40
- #Get current file absolute directory
41
- file_dir = os.path.dirname(os.path.abspath(__file__))
42
- #Get absolute directories for subpackages
43
- subpack_dir = {'Handle':os.path.join(file_dir,'Handle','__init__.py'),
44
- 'Manual':os.path.join(file_dir,'Manual','__init__.py'),
45
- 'Match':os.path.join(file_dir,'Match','__init__.py'),
46
- 'Quant':os.path.join(file_dir,'Quant','__init__.py'),
47
- 'UAPP':os.path.join(file_dir,'UAPP','__init__.py'),
48
- 'Hydro':os.path.join(file_dir,'Hydro','__init__.py')}
49
-
50
- #Define function to import from path
51
- def import_from_path(module_name,path):
52
- #Define spec
53
- spec = importlib.util.spec_from_file_location(module_name,path)
54
- #Define module
55
- module = importlib.util.module_from_spec(spec)
56
- #Expand sys.modules dict
57
- sys.modules[module_name] = module
58
- #Load module
59
- spec.loader.exec_module(module)
60
- return module
61
-
62
- #Import all local packages
63
- hd = import_from_path("hd",subpack_dir['Handle'])
64
- mn = import_from_path("mn",subpack_dir['Manual'])
65
- qt = import_from_path("qt",subpack_dir['Quant'])
66
- mt = import_from_path("mt",subpack_dir['Match'])
67
- ua = import_from_path("ua",subpack_dir['UAPP'])
68
- #hy = import_from_path("hy",subpack_dir['Hydro'])
69
-
70
- """ PARAMETERS """
71
- print("[__main__] Defining parameters...")
72
- __version__ = "0.4.0"
73
- version = "0.4.0"
74
-
75
- """ RUNUI FUNCTION """
76
-
77
- #Function to run the UI
78
- def runUI():
79
-
80
- """ DIRECTORIES """
81
- print("[__main__] Defining directories...")
82
- print("[__main__] Using Handle package...")
83
- #Get directories from handling script
84
- directories = hd.handle(os.path.dirname(os.path.abspath(__file__)))
85
-
86
- """ DATA SEARCH """
87
- print("[__main__] Searching for valid data files...")
88
- #Get a list of all available sample data directories (excluding "old") in the data files directory
89
- sampleList = [f.name for f in os.scandir(directories['data']) if f.is_dir() if f.name != "old"]
90
-
91
- """ CODE """
92
- #Define ChromaQuantUI as class
93
- class chromaUI:
94
-
95
- #Key variables = sampleVar, fpm_typevar, fpm_modelvar, quant_typevar, quant_modelvar, hydro_typevar
96
- #Initialization function – master here will be our root widget
97
- def __init__(self, master, directories):
98
-
99
- self.master = master
100
- self.directories = directories
101
-
102
- #ANALYSIS CONFIGURATION
103
- print("[__main__] Interpreting analysis configuration...")
104
- #Read analysis configuration file
105
- with open(os.path.join(self.directories['resources'],'analysis-config.json')) as f:
106
- self.analysis_config = json.load(f)
107
-
108
- #Extract analysis configuration info
109
- #File suffixes to add to form data filenames
110
- self.file_suffix_list = [i[0] for i in list(self.analysis_config["file-suffix"].values())]
111
-
112
- #Standard padding
113
- self.std_padx = 10
114
- self.std_pady = 10
115
-
116
- #Padding for widgets/widget rows
117
- self.widget_padx = 20
118
- self.widget_pady = 20
119
-
120
- #Initialize user variable dictionary
121
- self.var_dict = {}
122
- #Initialize user variable entries
123
- self.var_dict['sampleVar'] = tk.StringVar()
124
- self.var_dict['fpm_typevar'] = tk.StringVar()
125
- self.var_dict['fpm_modelvar'] = tk.StringVar()
126
- self.var_dict['quant_typevar'] = tk.StringVar()
127
- self.var_dict['quant_modelvar'] = tk.StringVar()
128
- self.var_dict['hydro_typevar'] = tk.StringVar()
129
- self.var_dict['hydro_matchvar'] = tk.StringVar()
130
-
131
- #Initialize list of variables to have an anonymous printing function
132
- self.varSelect_list = ['sampleVar','fpm_typevar','fpm_modelvar','quant_modelvar','hydro_typevar','hydro_matchvar']
133
-
134
- #Initialize radiobutton object dictionary
135
- self.radio_dict = {}
136
-
137
- #Setup UI
138
- self.setupUI()
139
-
140
- #Create font objects
141
- self.title_font = tkFont.Font(size=18,weight='bold') #Title font
142
-
143
- #SETUP SELECT FUNCTIONS
144
- self.setupVarSelect()
145
-
146
- #IMAGE AND TITLE
147
- #Add a frame for the logo and title/sample info
148
- self.topFrame = ttk.Frame(self.mainframe)
149
- self.topFrame.grid(column=0,row=0,sticky='WE')
150
- self.topFrame.grid_columnconfigure((0,3),weight=1)
151
- self.setupTitle()
152
-
153
- #WIDGETS
154
- #Add a frame for the first row of widgets
155
- self.rowoneFrame = ttk.Frame(self.mainframe)
156
- self.rowoneFrame.grid(column=0,row=1,sticky='WE')
157
- self.rowoneFrame.grid_columnconfigure((0,4),weight=1)
158
-
159
- #Add a frame for the second row of widgets
160
- self.rowtwoFrame = ttk.Frame(self.mainframe)
161
- self.rowtwoFrame.grid(column=0,row=2,sticky='WE')
162
- self.rowtwoFrame.grid_columnconfigure((0,4),weight=1)
163
-
164
- #FILE TRACKING
165
- #Add a frame for tracking data files
166
- self.trackFrame = ttk.LabelFrame(self.rowoneFrame,text='File Tracking',style='QuantLabelframe.TLabelframe')
167
- self.trackFrame.grid(column=1,row=0,sticky='NSWE',padx=self.widget_padx,pady=self.widget_pady)
168
- self.setupFileTrack()
169
-
170
- #UNKNOWNS ANALYSIS POSTPROCESS
171
- #Add a frame for the UA_UPP script
172
- self.uppFrame = ttk.LabelFrame(self.rowoneFrame,text='Unknowns Analysis Postprocessing',style='QuantLabelframe.TLabelframe')
173
- self.uppFrame.grid(column=2,row=0,sticky='NSWE',padx=(0,self.widget_padx),pady=self.widget_pady)
174
- self.setupUPP()
175
- #padx=self.widget_padx,pady=self.widget_pady
176
-
177
- #FIDpMS MATCHING
178
- #Add a frame for the main matching script
179
- self.matchFrame = ttk.LabelFrame(self.rowoneFrame,text='Peak Matching',style='QuantLabelframe.TLabelframe')
180
- self.matchFrame.grid(column=3,row=0,sticky='NSWE',padx=(0,self.widget_padx),pady=self.widget_pady)
181
- self.setupMatch()
182
-
183
- #QUANTIFICATION
184
- #Add a frame for the main quantification script
185
- self.quantFrame = ttk.LabelFrame(self.rowtwoFrame,text='Quantification',style='QuantLabelframe.TLabelframe')
186
- self.quantFrame.grid(column=1,row=0,sticky='NSWE',padx=self.widget_padx,pady=(0,self.widget_pady))
187
- self.setupQuant()
188
-
189
- #HYDROUI
190
- #Add a frame for the hydroUI script
191
- self.hydroFrame = ttk.LabelFrame(self.rowtwoFrame,text='HydroUI (WIP)',style='QuantLabelframe.TLabelframe')
192
- self.hydroFrame.grid(column=2,row=0,sticky='NSWE',padx=(0,self.widget_padx),pady=(0,self.widget_pady))
193
- self.setupHydro()
194
-
195
- def default(self):
196
- print("[__main__][TEST] Testing message")
197
-
198
- def setupUI(self):
199
-
200
- # Import the tcl file with the tk.call method
201
- self.master.tk.call('source', self.directories['theme'])
202
-
203
- # Set the theme with the theme_use method
204
- style = ttk.Style(root)
205
- style.theme_use('forest-light')
206
- #Set up style button font
207
- style.configure('QuantButton.TButton',font=('Arial',16))
208
- #Set up style accent button font
209
- style.configure('Accent.TButton',font=('Arial',16))
210
- #Set up labelframe font
211
- style.configure('QuantLabelframe.TLabelframe.Label',font=('Arial',16))
212
- #Set up labelframe border
213
- style.configure('QuantLabelframe.TLabelframe',borderwidth=5,bordercolor='red')
214
- #Set up file tracking text font
215
- self.fileTrackFont = tkFont.Font(size=14)
216
-
217
- #root.geometry("890x1000")
218
- root.title("ChromaQuant – Quantification Made Easy")
219
-
220
- #Create a main frame
221
- self.mainframe = ttk.Frame(root)
222
- self.mainframe.grid(column=0,row=0)
223
-
224
- def setupTitle(self):
225
-
226
- #Add a frame for the ChromaQuant logo
227
- self.logoFrame = ttk.Frame(self.topFrame)
228
- self.logoFrame.grid(column=1,row=0,sticky='WE')
229
-
230
- #Add a frame for the title text and sample selection
231
- self.tsFrame = ttk.Frame(self.topFrame)
232
- self.tsFrame.grid(column=2,row=0,sticky='E')
233
-
234
- #Add title text
235
- tk.Label(self.tsFrame,text="ChromaQuant v"+version,font=self.title_font)\
236
- .grid(column=0,row=0,pady=self.std_pady,padx=self.std_padx)
237
-
238
- #Add an image for the ChromaQuant logo
239
- #Load the image
240
- self.image_i = Image.open(os.path.join(self.directories['images'],'ChromaQuantIcon.png'))
241
- #Resize the image
242
- self.resize_image = self.image_i.resize((100,100))
243
- #Redefine the image
244
- self.image = ImageTk.PhotoImage(self.resize_image)
245
- #Add the image to a label
246
- image_label = tk.Label(self.logoFrame, image=self.image)
247
- image_label.grid(column=0,row=0,pady=10,padx=10)
248
-
249
- #Add a frame for selecting the sample
250
- sampleFrame = ttk.Frame(self.tsFrame)
251
- sampleFrame.grid(column=0,row=1,pady=10,padx=10)
252
-
253
- #Add text to the top of the sample frame
254
- tk.Label(sampleFrame,text='Select a sample to analyze:').grid(column=0,row=0)
255
- self.var_dict['sampleVar'] = tk.StringVar()
256
- self.sampleBox = ttk.Combobox(sampleFrame,textvariable=self.var_dict['sampleVar'])
257
- self.sampleBox['values'] = sampleList
258
- self.sampleBox.state(["readonly"])
259
- self.sampleBox.grid(column=0,row=1)
260
-
261
- #Bind the sampleBox to a function
262
- self.sampleBox.bind("<<ComboboxSelected>>",self.sampleSelect)
263
-
264
- def setupFileTrack(self):
265
-
266
- #Create text window, place in grid
267
- self.fileTrack_Text = tk.Text(self.trackFrame, height=12, width=20, fg='black', font=self.fileTrackFont)
268
- self.fileTrack_Text.grid(column=0,row=0,padx=20,pady=10,sticky='NSWE')
269
- #Set text config to NORMAL
270
- self.fileTrack_Text.config(state=tk.NORMAL)
271
- #Configure text options
272
- #Option for default text
273
- self.fileTrack_Text.tag_config('default', background="white", foreground="black")
274
- #Option for present file
275
- self.fileTrack_Text.tag_config('true', background="white", foreground='green')
276
- #Option for file not found
277
- self.fileTrack_Text.tag_config('false', background="white", foreground='red')
278
-
279
- #Create default options
280
- for i in self.file_suffix_list:
281
- self.fileTrack_Text.insert(tk.END,"\n{0}".format(i),'default')
282
-
283
- def updateFileTrack(self):
284
-
285
- #Delete all text in file tracking widget
286
- self.fileTrack_Text.delete(1.0,tk.END)
287
-
288
- #Get list of files currently in data and raw data directory
289
- self.rawDataFiles = [f.lower() for f in os.listdir(directories['raw']) if os.path.isfile(os.path.join(directories['raw'],f))]
290
- self.dataFiles = [f.lower() for f in os.listdir(directories['sample']) if os.path.isfile(os.path.join(directories['sample'],f))]
291
-
292
- #Loop through the data files to search for everything but the INFO file (last index)
293
- for i in self.file_suffix_list[:-1]:
294
-
295
- #If given file exists in list, color green
296
- if (self.sname+i).lower() in self.rawDataFiles:
297
- self.fileTrack_Text.insert(tk.END,"\n{0}".format(i),'true')
298
-
299
- #Otherwise, color red
300
- else:
301
- self.fileTrack_Text.insert(tk.END,"\n{0}".format(i),'false')
302
-
303
- #If last data file (INFO) exists in data files directory, color green
304
- if (self.sname+self.file_suffix_list[-1]).lower() in self.dataFiles:
305
- self.fileTrack_Text.insert(tk.END,"\n{0}".format(self.file_suffix_list[-1]),'true')
306
-
307
- #Otherwise, color red
308
- else:
309
- self.fileTrack_Text.insert(tk.END,"\n{0}".format(self.file_suffix_list[-1]),'false')
310
-
311
- print("[__main__] File tracking results updated...")
312
-
313
- def setupUPP(self):
314
-
315
- #Add start button
316
- self.setupStartButton(self.uppFrame,[0,0],[20,20],1,self.runUPP)
317
-
318
- def setupMatch(self):
319
-
320
- #Add a radiobutton set for selecting sample type
321
- self.radio_dict['fpm_typevar'] = self.setupRadioButton(self.matchFrame,'Please select the sample type:',[0,1],[20,20],1,'fpm_typevar',{'Liquid':'L','Gas':'G'},self.select_dict['fpm_typevar'],'L')
322
- #Add a radiobutton set for selecting match model
323
- self.radio_dict['fpm_modelvar'] = self.setupRadioButton(self.matchFrame,'Please select the desired matching fit model:',[0,2],[20,20],1,'fpm_modelvar',{'Retention\nTime':'R','Polynomial':'P'},self.select_dict['fpm_modelvar'],'R')
324
- #Add start button
325
- self.setupStartButton(self.matchFrame,[0,3],[20,20],4,self.runMatch)
326
-
327
- def setupQuant(self):
328
-
329
- #Add a radiobutton set for selecting sample type
330
- self.radio_dict['quant_typevar'] = self.setupRadioButton(self.quantFrame,'Which components are present in the sample?',[0,1],[20,20],1,'quant_typevar',{'Liquid\nOnly':'L','Gas\nOnly':'G','Liquid\nand Gas':'LG'},self.quant_typevarSelect,'L')
331
-
332
- #Add a radiobutton set for selecting the gas quantification method
333
- self.radio_dict['quant_modelvar'] = self.setupRadioButton(self.quantFrame,'Which method should be used to quantify gas phase products?',[0,2],[20,0],1,'quant_modelvar',{'CO2\nVolume':'C','Scale\nFactor':'S','Internal\nStandard':'I'},self.select_dict['quant_modelvar'],'Disabled')
334
-
335
- #Add start button
336
- self.setupStartButton(self.quantFrame,[0,3],[20,20],4,self.runQuant)
337
-
338
- def setupHydro(self):
339
-
340
- #Add a radiobutton set for selecting sample type
341
- self.radio_dict['hydro_typevar'] = self.setupRadioButton(self.hydroFrame,'Which phase to analyze?',[0,1],[20,20],1,'hydro_typevar',{'Liquid':'L','Gas':'G'},self.select_dict['hydro_typevar'],'L')
342
- #Add a radiobutton set for selecting sample type
343
- self.radio_dict['hydro_matchvar'] = self.setupRadioButton(self.hydroFrame,'Display FID and MS matches?',[0,2],[20,20],1,'hydro_matchvar',{'Yes':'T','No':'F'},self.select_dict['hydro_matchvar'],'F')
344
- #Add start button
345
- self.setupStartButton(self.hydroFrame,[0,3],[20,20],4,self.runHydro)
346
-
347
- def setupStartButton(self,frame,placement,pad,columnspan,function):
348
-
349
- #Add a start button
350
- ttk.Button(frame,text="\n\n\nRun Script\n\n\n",width=20,style='Accent.TButton',command=function)\
351
- .grid(column=placement[0],row=placement[1],padx=pad[0],pady=pad[1],columnspan=columnspan)
352
-
353
- def setupRadioButton(self,frame,label_text,placement,pad,columnspan,var_name,option_val_dict,function,init_state='Option Blank'):
354
-
355
- #placement = [column,row]
356
- #pad = [padx,pady]
357
- #var_dict = {'var_1':tk.StringVar(),...}
358
- #var_name = 'var_1'
359
- #text_val_dict = {'option_1':'value_1',...}
360
-
361
- #Set up a radiobutton for selecting liquid or gas
362
- #Add a label
363
- tk.Label(frame,text=label_text).grid(column=placement[0],row=placement[1],padx=pad[0],pady=pad[1],columnspan=columnspan,sticky='e')
364
-
365
- #Define current column as column to the right of label
366
- current_col = placement[0] + 1
367
- #Define radiobutton padding loop iterable
368
- current_pad = 0
369
- #Define list to iterate through for radiobutton padding
370
- radiopad = [(10,10) for i in range(len(option_val_dict))]
371
- radiopad[-1] = (10,20)
372
-
373
- #Define list of radiobutton objects
374
- dict_radiobutton = {i:0 for i in option_val_dict}
375
-
376
- #For every option in the option-value dictionary, add a radiobutton (iterate over columns)
377
- for option in option_val_dict:
378
-
379
- #Store the radiobutton object
380
- dict_radiobutton[option] = ttk.Radiobutton(frame , text=option , variable=self.var_dict[var_name] , value=option_val_dict[option] , command=function)
381
- dict_radiobutton[option].grid(column=current_col , row=placement[1] , padx=radiopad[current_pad] , sticky='w')
382
-
383
- #Iterate current column and radio padding list
384
- current_col += 1
385
- current_pad += 1
386
-
387
- #Select the initial radiobutton state based on the init_state argument
388
- #If init_state is 'Option Blank', select the first radiobutton
389
- if init_state == 'Option Blank':
390
- self.var_dict[var_name].set(next(iter(option_val_dict.values())))
391
-
392
- #If init_state is 'Disabled', set the radiobuttons to be disabled
393
- elif init_state == 'Disabled':
394
- for option in option_val_dict:
395
- dict_radiobutton[option].config(state=tk.DISABLED)
396
-
397
- #Otherwise, if the init_state does not have a counterpart in the values of the option_val_dict, select the first radiobutton
398
- elif init_state not in option_val_dict.values():
399
- self.var_dict[var_name].set(next(iter(option_val_dict.values())))
400
-
401
- #Otherwise, select the specified radiobutton
402
- else:
403
- self.var_dict[var_name].set(init_state)
404
-
405
- return dict_radiobutton
406
-
407
-
408
- def sampleSelect(self,event):
409
-
410
- self.sname = self.sampleBox.get()
411
-
412
- print("[__main__] User selected " + self.sname)
413
-
414
- print("[__main__] Getting sample directories...")
415
-
416
- #Sample directory
417
- self.directories['sample'] = os.path.join(self.directories['data'],self.sname)
418
-
419
- #Data file log directory
420
- self.directories['log'] = os.path.join(self.directories['sample'],'log')
421
-
422
- #Data file breakdowns directory
423
- self.directories['break'] = os.path.join(self.directories['sample'],'breakdowns')
424
-
425
- #Raw data file directory
426
- self.directories['raw'] = os.path.join(self.directories['sample'],'raw data')
427
-
428
- print("[__main__] Checking files...")
429
- self.updateFileTrack()
430
-
431
- return self.sname
432
-
433
- #Function for setting up anonymous varaible select functions for printing messages
434
- def setupVarSelect(self):
435
-
436
- #Predefine dictionary for selection functions
437
- self.select_dict = {}
438
-
439
- #For every variable...
440
- for i in self.var_dict:
441
-
442
- #If variable is listed in the anonymous variable list...
443
- if i in self.varSelect_list:
444
- #Define lambda function using default argument for user selection message
445
- self.select_dict[i] = lambda i=i: print("[__main__] User Selected " + self.var_dict[i].get() + " for " + i)
446
-
447
- #Otherwise, pass
448
- else:
449
- pass
450
-
451
- return None
452
-
453
- #Function for quant_typevar selection
454
- def quant_typevarSelect(self):
455
-
456
- #If the phase selected is either gas or both liquid and gas...
457
- if self.var_dict['quant_typevar'].get() == 'G' or self.var_dict['quant_typevar'].get() == 'LG':
458
- #Enable all radiobuttons
459
- for radiobutton in self.radio_dict['quant_modelvar']:
460
- self.radio_dict['quant_modelvar'][radiobutton].config(state=tk.NORMAL)
461
-
462
- #Otherwise, disable all radiobuttons
463
- else:
464
- #Disable all radiobuttons
465
- for radiobutton in self.radio_dict['quant_modelvar']:
466
- print(radiobutton)
467
- self.radio_dict['quant_modelvar'][radiobutton].config(state=tk.DISABLED)
468
-
469
- #Set quant_modelvar to none
470
- self.var_dict['quant_modelvar'].set(None)
471
-
472
- print("[__main__] User Selected " + self.var_dict['quant_typevar'].get() + " for quant_typevar")
473
-
474
- return None
475
-
476
- #Function for
477
- def runUPP(self):
478
- #Function for running the UPP function
479
- print("[__main__] Running Unknowns Analysis Postprocessing...")
480
- ua.mainUAPP(self.var_dict['sampleVar'].get())
481
- print("[__main__] UAPP complete")
482
- return None
483
-
484
- def runMatch(self):
485
- #Function for running the match function
486
- print("[__main__] Running FID and MS matching...")
487
- mt.mainMatch(self.var_dict['sampleVar'].get(), self.var_dict['fpm_typevar'].get(),self.var_dict['fpm_modelvar'].get())
488
- print("[__main__] Matching complete")
489
- return None
490
-
491
- def runQuant(self):
492
- #Function for running the quantification function
493
- print("[__main__] Running quantification...")
494
- qt.mainQuant(self.var_dict['sampleVar'].get(), self.var_dict['quant_typevar'].get(), self.var_dict['quant_modelvar'].get())
495
- print("[__main__] Quantification complete")
496
- return None
497
-
498
- def runHydro(self):
499
-
500
- #Function for running the hydroUI function
501
- print("[__main__] Defining HydroUI application...")
502
- """ COMMENT OUT FOR NOW, LAGGY
503
- self.app = hy.mainHydro(self.var_dict['sampleVar'].get(), self.var_dict['hydro_typevar'].get(), self.var_dict['hydro_matchvar'].get())
504
- print("[__main__] Application defined, running...")
505
- if __name__ == "__main__":
506
- #Define a thread and set as daemon – SCRIPT WILL CONTINUE TO RUN UNTIL CHROMAUI CLOSED
507
- hydroThread = threading.Thread(target=lambda: self.app.run(debug=True, use_reloader=False))
508
- hydroThread.daemon = True
509
- #Start thread
510
- hydroThread.start()
511
- print("[__main__] HydroUI active")
512
- """
513
- return None
514
-
515
- root = tk.Tk()
516
- my_gui = chromaUI(root,directories)
517
-
518
- root.mainloop()
519
-
520
- print('[__main__] Program terminated')
521
-
522
-
523
- """ RUN MAIN FUNCTION """
524
- print("[__main__] Starting UI...")
525
- if __name__ == "__main__":
526
- runUI()