Skip to content

Commit

Permalink
improving odt parsing and reworking the namespace visible fro user fo…
Browse files Browse the repository at this point in the history
…r more intuitive
  • Loading branch information
LemurPwned committed Aug 17, 2018
1 parent e64c8dc commit 1a6f448
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 31 deletions.
43 changes: 21 additions & 22 deletions Widgets/widget_pane.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"CubicGLContext": {
"alias": "3D_CUBIC",
"alias": "3D CUBIC",
"object": "CubicGLContext",
"object_type": "3d_object",
"settings": ["PerfOptions", "file_header",
Expand All @@ -16,25 +16,8 @@
["Screenshot", "screenshot_manager"],
["Text", "popup_text_selector"]]
},
"VectorGLContext": {
"alias": "3D_VECTOR",
"object": "VectorGLContext",
"object_type": "3d_object",
"settings": ["PerfOptions", "file_header"],
"required": ["current_state", "options",
"file_header","color_vectors",
"screenshot_dir", "geom"],
"optional": ["iterations"],
"iterable_type": "structure",
"toolbar" : [["Reset", "initial_transformation"],
["Zoom in", "zoomIn"],
["Zoom out", "zoomOut"],
["Screenshot", "screenshot_manager"],
["Text", "popup_text_selector"]]
},

"ArrowGLContext": {
"alias": "3D_ARROW",
"alias": "3D ARROW",
"object": "ArrowGLContext",
"object_type": "3d_object",
"settings": ["ArrowPerfOptions", "file_header",
Expand All @@ -50,8 +33,24 @@
["Screenshot", "screenshot_manager"],
["Text", "popup_text_selector"]]
},
"VectorGLContext": {
"alias": "3D VECTOR",
"object": "VectorGLContext",
"object_type": "3d_object",
"settings": ["PerfOptions", "file_header"],
"required": ["current_state", "options",
"file_header","color_vectors",
"screenshot_dir", "geom"],
"optional": ["iterations"],
"iterable_type": "structure",
"toolbar" : [["Reset", "initial_transformation"],
["Zoom in", "zoomIn"],
["Zoom out", "zoomOut"],
["Screenshot", "screenshot_manager"],
["Text", "popup_text_selector"]]
},
"Canvas": {
"alias": "2D_Matplotlib",
"alias": "2D Matplotlib",
"object": "Canvas",
"object_type": "2d_object",
"settings": ["PlotSettings", "plot_data"],
Expand All @@ -62,7 +61,7 @@
"toolbar": "NavigationToolbar"
},
"Canvas2Dupgraded": {
"alias": "2D_BetterPlot",
"alias": "2D PyQT",
"object": "Canvas2Dupgraded",
"object_type": "2d_object",
"settings": ["PlotSettings", "plot_data"],
Expand All @@ -73,7 +72,7 @@
"toolbar": null
},
"CanvasLayer": {
"alias": "2D_Layer",
"alias": "2D Layer",
"object": "CanvasLayer",
"object_type": "2d_object",
"settings": ["SimplePerfOptions", "file_header"],
Expand Down
8 changes: 6 additions & 2 deletions Windows/PlotSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,14 @@ def additionalSetup(self, plotOptions=[None]):

# set default for comboBox X axis - time or iteration
try:
indx = list(plotOptions.columns.values).index('TimeDriver::Simulation time')
indx = list(plotOptions.columns.values).index('Oxs_TimeDriver::Simulation time')
self.comboBox5[self.GroupCounter].setCurrentIndex(indx)
except ValueError:
pass
try:
indx = list(plotOptions.columns.values).index('Oxs_MinDriver::Iteration')
self.comboBox5[self.GroupCounter].setCurrentIndex(indx)
except ValueError:
pass

self.radioButton.append(QRadioButton("Run synchronized with Animation",
self))
Expand Down
27 changes: 20 additions & 7 deletions cython_modules/cython_parse.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@ def normalized(array, axis=-1, order=2):
l2[l2==0] = 1
return array / np.expand_dims(l2, axis)

def parseODTColumn(line):
cols = []
line = line.replace('# Columns: ', '')
while line != "":
if line[0] == '{':
patch = line[1:line.index('}')]
if patch != '':
cols.append(patch)
line = line[line.index('}')+1:]
else:
try:
patch = line[:line.index(' ')]
if patch != '':
cols.append(patch)
line = line[line.index(' ')+1:]
except ValueError:
line = ""
break
return cols

def getPlotData(filename):
"""
Expand All @@ -61,13 +80,7 @@ def getPlotData(filename):
lines = f.readlines()
f.close()
cols = header[-1]
cols = cols.replace("}", "")
cols = cols.replace("{", "")
cols = cols.replace("MF", "Oxs_MF")
cols = cols.replace("PBC", "Oxs_PBC")
cols = cols.split("Oxs_")
del cols[0]
cols = [x.strip() for x in cols]
cols = parseODTColumn(cols)
dataset = []
lines = [x.strip() for x in lines]
lines = [x.split(' ') for x in lines]
Expand Down

0 comments on commit 1a6f448

Please sign in to comment.