Skip to content

Commit

Permalink
changed GUI defaults and added screenshot to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlieCallahan committed Sep 10, 2024
1 parent e130b59 commit d8d1f90
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The repo comes with an example GUI to get you started. Run it with the following
```bash
python gaasGUI.py
```
![Alt Text](./assets/GAAS_GUI.png?raw=true "Title")

# Example
Additionally, the repo includes some example code to demonstrate how to run spectrum simulations using GAAS (example_voigt.py and example_htp.py).
Expand Down
Binary file added assets/GAAS_GUI.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 15 additions & 8 deletions gaasGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import os

class FloatSlider(QWidget):
def __init__(self, min, max, name):
def __init__(self, min, max, name, defaultVal=None):
QWidget.__init__(self)
self.min = min
self.max = max
Expand All @@ -23,9 +23,14 @@ def __init__(self, min, max, name):
self.layout.addWidget(label_name, stretch=1)
self.slider = QSlider(Qt.Horizontal, self)
self.slider.setRange(0,1000)
self.slider.setSliderPosition(500)
if defaultVal:
self.slider.setSliderPosition(int((defaultVal-min)/(max-min)*1000))
self.label_val = QLabel(str(defaultVal))
else:
self.slider.setSliderPosition(500)
self.label_val = QLabel(str((max-min)/2))

self.layout.addWidget(self.slider, stretch=4)
self.label_val = QLabel(str((max-min)/2))
self.layout.addWidget(self.label_val)
self.setLayout(self.layout)
self.slider.valueChanged[int].connect(self.updateVal)
Expand Down Expand Up @@ -162,10 +167,10 @@ def __init__(self, parent=None):
self.mainLayout.addWidget(self.plot,0,0)
self.make_sliders()

self.startWavenum = 6020
self.endWavenum = 6130
self.startWavenum = 2200
self.endWavenum = 2400
self.wavenumStep = 0.007 #wavenums per simulation step
self.mol = 'H2O' #'O3', 'N2O', 'CO', 'CH4', 'O2', 'NO', 'SO2', 'NO2', 'NH3', 'HNO3'
self.mol = 'CO2' #'O3', 'N2O', 'CO', 'CH4', 'O2', 'NO', 'SO2', 'NO2', 'NH3', 'HNO3'
self.iso = 1 #isotopologue num
cwd = os.path.dirname(os.path.realpath(__file__))
if sys.platform == 'win32' or sys.platform == 'win64':
Expand All @@ -188,6 +193,8 @@ def __init__(self, parent=None):
self.dbLock = threading.Lock()

self.moleculeSelector = DropdownMenu(gaas.getHITRANMolecules())
#set to the self.mol
self.moleculeSelector.dropdown.setCurrentIndex(gaas.getHITRANMolecules().index(self.mol))
self.moleculeSelector.set_callback(self.setMolecule)
self.mainLayout.addWidget(self.moleculeSelector)

Expand All @@ -208,9 +215,9 @@ def update_plot(self):
self.plot.plot(self.nus, self.coefs, pen = pen, clear=True)

def make_sliders(self):
self.Temp = FloatSlider(200,4000,"Temp (K)")
self.Temp = FloatSlider(200,4000,"Temp (K)",300)
self.Conc = FloatSlider(0.001,0.5,"Concentration")
self.Pressure = FloatSlider(0.1,50,"Pressure")
self.Pressure = FloatSlider(0.1,50,"Pressure",1)
self.mainLayout.addWidget(self.Temp)
self.mainLayout.addWidget(self.Conc)
self.mainLayout.addWidget(self.Pressure)
Expand Down

0 comments on commit d8d1f90

Please sign in to comment.