-
Notifications
You must be signed in to change notification settings - Fork 1
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
Improvements: Post-Processing revamp #18
Conversation
This PR fixes #13 |
…thon package-like directory and consolidate 2d and 3d main scripts to single file labelled VisitPlot.py Added new test suite to test post processing routines
…between different visit and python versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably remove the .pyc
files and add .pyc
to your `.gitignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats strange, because the .gitignore already contains those. I manually removed them from the remote, so that should fix it
from .Engine import * | ||
from .Utils import * | ||
from .PlotSetup import * | ||
from .Plotter import * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of your files are missing a final new line character
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thanks for catching that. added a new commit fixing that
PostProcessing/IntegralsPlot.py
Outdated
SystemError: No plot variables specified | ||
SystemError: Number of x limits does not match number of plot variables | ||
SystemError: Number of linestyles does not match number of plot variables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SystemError: No plot variables specified | |
SystemError: Number of x limits does not match number of plot variables | |
SystemError: Number of linestyles does not match number of plot variables | |
RuntimeError: No plot variables specified | |
RuntimeError: Number of x limits does not match number of plot variables | |
RuntimeError: Number of linestyles does not match number of plot variables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, forgot to change the docstrings for that
PostProcessing/IntegralsPlot.py
Outdated
if not plot_variables: | ||
raise SystemError("No plot variables specified.") | ||
plot_variables = config["VariableData"].get("plot_variables", "").split() | ||
if len(plot_variables) == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want, you can just write
if len(plot_variables) == 0: | |
if plot_variables: |
An empty list evaluates to false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yea thats right. I've been using so much C++ i forgot about those nice pythonic things. Changed in newest commit to this PR
PostProcessing/IntegralsPlot.py
Outdated
elif __visit_script_file__ == __visit_source_file__: | ||
raise RuntimeError("This file should not be run with VisIt, only Python!") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file doesn't end with a newline
PostProcessing/IntegralsPlot.py
Outdated
@@ -143,26 +67,25 @@ def main(): | |||
linestyles = None | |||
|
|||
if not len(linestyles) == len(plot_variables) and linestyles != None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a little hard to follow these conditionals
also, comparisons with None
should be done with is
instead of ==
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in newest commit edcbb92
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
@@ -5,6 +5,7 @@ | |||
hdf5_path = /home/hd/hd_hd/hd_pb293/WS_GRChombo/testing/GRMilijun_ProcaKerrBH_23320250/hdf5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like an hardcoded path that users won't have access to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the *.ini files are parameter files created by the user, as explained here
plot_files = [x for x in files if config["Header"]["plot_header"] in x] | ||
|
||
#ensure plot files exist in provided directory | ||
if len(plot_files) == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, if you want to remove the len == 0
, you can do it
files = glob.glob(filename_prefix+ "*.3d.hdf5") | ||
|
||
#filter the file list to ensure regex-captured files are actual plot files | ||
plot_files = [x for x in files if config["Header"]["plot_header"] in x] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also use the filter
function to express your intent more clearly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thats probably better. added in latest commit
Close_Database(config) #includes error handling | ||
|
||
print("All Done!") | ||
sys.exit(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed?
…rehension with 'filter' function
This PR will add more documentation for the post processing routines