Skip to content

Commit

Permalink
GUI filter options
Browse files Browse the repository at this point in the history
  • Loading branch information
plasmapotential committed Oct 25, 2021
1 parent 4a420fd commit bccd875
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 3 deletions.
2 changes: 1 addition & 1 deletion AppImageBuilder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ AppDir:
id: HEATAppimage
name: HEAT_AppImage
icon: flame
version: v1.3.9
version: v1.4.0
# # Set the python executable as entry point
# exec: usr/bin/python3
# # Set the application main script path as argument. Use '$@' to forward CLI parameters
Expand Down
33 changes: 33 additions & 0 deletions source/GUIclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,39 @@ def initializeHF(self):
tools.initializeInput(self.HF, infile=self.infile)
return

def loadAccFilters(self, accFilters):
"""
loads status of acceleration filters. user can choose to filter by:
-toroidal angle
-poloidal flux surface
"""
#poloidal flux filtering
if 'psiFilt' in accFilters:
print("Poloidal flux filter: ON")
log.info("Poloidal flux filter: ON")
psiFilterSwitch = True
else:
print("Poloidal flux filter: OFF")
log.info("Poloidal flux filter: OFF")
psiFilterSwitch = False

#toroidal angle filtering
if 'torFilt' in accFilters:
print("Toroidal angle filter: ON")
log.info("Toroidal angle filter: ON")
phiFilterSwitch = True
else:
print("Toroidal angle filter: OFF")
log.info("Toroidal angle filter: OFF")
phiFilterSwitch = False

#for now all PFCs share a single filter state
for PFC in self.PFCs:
PFC.psiFilterSwitch = psiFilterSwitch
PFC.phiFilterSwitch = phiFilterSwitch
return


def runHEAT(self, runList):
"""
Run a HEAT calculation. This is called from gui by user.
Expand Down
35 changes: 34 additions & 1 deletion source/dashGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ def saveGUIinputs( n_clicks,
return [outputDiv, send_file(gui.tmpDir + "HEATinput.csv")]



#==========MHD==========
def buildMHDbox():
"""
Expand Down Expand Up @@ -2057,6 +2058,8 @@ def runChildren():
children = [
html.H4("HEAT Run Settings", className="buttonRibbon"),
html.Br(),
html.H6("Acceleration, Filters, Settings: "),
buildRunSettings(),
html.H6("Point Clouds at Tile Surface:"),
runTabChecklist(),
html.H6("Traces from Points:"),
Expand All @@ -2068,6 +2071,30 @@ def runChildren():
)


#==========HEAT Run Settings==========
def buildRunSettings():
"""
returns user options for the HEAT run
"""
return html.Div(
id="runSettings",
className="buttonRibbon",
children=[
html.Label(children="Acceleration Filters: "),
dcc.Checklist(
options=[
{'label': 'Toroidal Filter', 'value': 'torFilt'},
{'label': 'Psi Filter', 'value': 'psiFilt'},
],
value=['torFilt'],
id='accFilters',
className="PCbox",
)
],
)



def runTabChecklist():
return html.Div(
id="runTabChecklist",
Expand Down Expand Up @@ -2330,20 +2357,26 @@ def loadGyroTrace(display):
State('N_gyroSteps_trace','value'),
State('gyroDir_trace','value'),
State('gyroPhase_trace','value'),
State('accFilters','value'),
])
def runHEAT(n_clicks,runList,Btrace,OFtrace,gyrotrace,
BtraceTableData,
xOFtrace,yOFtrace,zOFtrace,
xGyroTrace,yGyroTrace,zGyroTrace,
t,
gyroT_eV_trace,gyroDeg_trace,N_gyroSteps_trace,
gyroDir_trace,gyroPhase_trace):
gyroDir_trace,gyroPhase_trace, accFilters):
if n_clicks == 0:
raise PreventUpdate

#acceleration structure filters
gui.loadAccFilters(accFilters)

#Bfield trace
if 'Btrace' in Btrace:
gui.BtraceMultiple(BtraceTableData, t)

#gyro orbit trace
if 'gyrotrace' in gyrotrace:
gui.gyroTrace(xGyroTrace,yGyroTrace,zGyroTrace,t,gyroPhase_trace,
gyroDeg_trace,N_gyroSteps_trace,gyroDir_trace,gyroT_eV_trace)
Expand Down
6 changes: 5 additions & 1 deletion source/pfcClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,11 @@ def findShadows_structure(self,MHD,CAD,verbose=False, shadowMaskClouds=False):

totalMeshCounter = 0
for i,target in enumerate(CAD.intersectMeshes):
totalMeshCounter+=target.CountFacets
try:
totalMeshCounter+=target.CountFacets
except:
print("Cannot count faces because "+CAD.intersectList[i]+" is not a mesh!")
continue
#check if this target is a potential intersection
if CAD.intersectList[i] in self.intersects:
numTargetFaces += target.CountFacets
Expand Down

0 comments on commit bccd875

Please sign in to comment.