-
Notifications
You must be signed in to change notification settings - Fork 17
724 cpttf and cpttf max error catching integer turns option #3114
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
Closed
cjwgriesel
wants to merge
9
commits into
main
from
724-cpttf-and-cpttf_max-error-catching-integer-turns-option
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
21bee46
issue 724 mods
cjwgriesel bd69e1b
issue 724 corrections to hdf_to_scatter_plot1.py
cjwgriesel 50f4a2f
issue 724 corrections to hdf_to_scatter_plot1.py
cjwgriesel 8ff4b7a
issue 724 corrections to hdf_to_scatter_plot1.py
cjwgriesel 7b5902c
issue 724 corrections to hdf_to_scatter_plot1.py
cjwgriesel aff1ead
issue 724 corrections to hdf_to_scatter_plot1.py
cjwgriesel 5979686
issue 724 mods
cjwgriesel 79f9d77
updated regression test
cjwgriesel 477eec5
updated regression test
cjwgriesel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| """ | ||
| script for reading and display HDF5 files as pdf scatter plots | ||
|
|
||
| Alexander J Pearce | ||
| 05/03/22 | ||
| CCFE | ||
|
|
||
| """ | ||
|
|
||
| import argparse | ||
| import pandas as pd | ||
| import matplotlib.pyplot as plt | ||
| from pylab import figure, savefig | ||
|
|
||
|
|
||
| def parse_args(args): | ||
| """Parse supplied arguments. | ||
|
|
||
| :param args: arguments to parse | ||
| :type args: list, None | ||
| :return: parsed arguments | ||
| :rtype: Namespace | ||
| """ | ||
| parser = argparse.ArgumentParser( | ||
| description="Program to read and " "plot PROCESS hdf5 output." | ||
| ) | ||
|
|
||
| parser.add_argument( | ||
| "-i", | ||
| "--inputfile", | ||
| default="uncertainties_data.h5", | ||
| help="input hdf5 file (default=uncertainties_data.h5)", | ||
| ) | ||
|
|
||
| parser.add_argument( | ||
| "-v", | ||
| "--vars", | ||
| default="None", | ||
| nargs="*", | ||
| help="Select the output variables (default = None) \n More than one output can be plotted eg: -v 'var1 var2'\n A separate plot will be created in matrix for each inputs combination", | ||
| ) | ||
|
|
||
| parser.add_argument( | ||
| "-sf", | ||
| "--save_format", | ||
| nargs="?", | ||
| default="pdf", | ||
| help="Output format (default='pdf') ", | ||
| ) | ||
|
|
||
| parser.add_argument( | ||
| "-p", | ||
| "--print", | ||
| action="store_true", | ||
| help="(print the PROCESS data to comannd line. default=False) ", | ||
| ) | ||
|
|
||
| return parser.parse_args(args) | ||
|
|
||
|
|
||
| def main(args=None): | ||
| """reads inputfile and creats figure as outputfile | ||
|
|
||
| :param args: None | ||
| :return: None | ||
| """ | ||
| args = parse_args(args) | ||
|
|
||
| data_set = pd.read_hdf(args.inputfile) | ||
| if args.print: | ||
| print(data_set) | ||
|
|
||
| output_names = args.vars | ||
|
|
||
| # Select only the converged runs for creating KDF plots | ||
| # see if we can only use if ifail = 1 for the KDF | ||
|
|
||
| # TO DO make separate list of converged and failed runs | ||
| # find way to display both to look at margins | ||
| # we want to colour red for ifail = 2-6 and blue for ifail = 1 | ||
| ioptimz = data_set["ioptimz"][0] | ||
| if ioptimz == -2: | ||
| data_set_converge = data_set | ||
| else: | ||
| data_set_converge = data_set[data_set["ifail"] == 1.0] | ||
|
|
||
| figsize = (8, 8) | ||
| figure(figsize=figsize) | ||
| # kde or hist (hs) in the diagonal below | ||
| Axes = pd.plotting.scatter_matrix( | ||
| data_set_converge[output_names], alpha=0.19, diagonal="kde" | ||
| ) | ||
|
|
||
| # y ticklabels | ||
| [plt.setp(item.yaxis.get_majorticklabels(), "size", 6) for item in Axes.ravel()] | ||
| # x ticklabels | ||
| [plt.setp(item.xaxis.get_majorticklabels(), "size", 6) for item in Axes.ravel()] | ||
| # y labels | ||
| [plt.setp(item.yaxis.get_label(), "size", 6) for item in Axes.ravel()] | ||
| # x labels | ||
| [plt.setp(item.xaxis.get_label(), "size", 6) for item in Axes.ravel()] | ||
|
|
||
| savefig("uncertainties." + args.save_format) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should not be included in this pull request.