Setup
The setup module contains functions that setup arguments for the main modules.
Table of Contents:
Argument Parser (setup.args)
Contains functions for creating a consistent set of argparse arguments for the entire couponmlactivation suite.
Default file paths execute the example code for the tensorflow coupon models
- fns.setup.args.argument(parser, dft)
Example function to create the argument “–ARGUMENT”
- Parameters
parser (argparse.ArgumentParser) – pre-existing parser
dft (type varies, optional) – default value, should be same type as the argument being defined
- Returns
No Return Objects
Show All Arguments
usage: module [-h] [--PACKAGE] [--EXPERIMENT] [--MODEL] [--INPUT_FIELD] [--INPUT_NPZ]
[--INPUT_DIR] [--FILE_LIST] [--DESIGN_FILE] [--NORM_FILE]
[--PRINT_LAYERS] [--PRINT_FEATURES] [--PRINT_FIELDS] [--PRINT_KEYS]
[--PRINT_SAMPLES] [--LAYER] [--FEATURES [...]] [--D_SCALE] [--MAT_NORM]
[--SCLR_NORM] [--FIELDS [...]] [--FIXED_KEY] [--NUM_SAMPLES] [--ALPHA1]
[--ALPHA2] [--COLOR1] [--COLOR2] [--SAVE_FIG]
Named Arguments
- --PACKAGE, -P
Possible choices: tensorflow, pytorch
Which python package was used to create the model
Default: “tensorflow”
- --EXPERIMENT, -E
Possible choices: coupon, nestedcylinder
Which experiment the model was trained on
Default: “coupon”
- --MODEL, -M
Model file
Default: “../examples/tf_coupon/trained_pRad2TePla_model.h5”
- --INPUT_FIELD, -IF
The radiographic/hydrodynamic field the model is trained on
Default: “pRad”
- --INPUT_NPZ, -IN
The .npz file with an input image to the model
Default: “../examples/tf_coupon/data/r60um_tpl112_complete_idx00110.npz”
- --INPUT_DIR, -ID
Directory path where all of the .npz files are stored
Default: “../examples/tf_coupon/data/”
- --FILE_LIST, -FL
The .txt file containing a list of .npz file paths; use “MAKE” to generate a file list given an input directory (passed with -ID) and a number of samples (passed with -NS).
Default: “MAKE”
- --DESIGN_FILE, -DF
The .csv file with master design study parameters
Default: “../examples/tf_coupon/coupon_design_file.csv”
- --NORM_FILE, -NF
The .npz file normalization values
Default: “../examples/tf_coupon/coupon_normalization.npz”
- --PRINT_LAYERS, -PL
Prints list of layer names in a model (passed with -M) and quits program
Default: False
- --PRINT_FEATURES, -PT
Prints number of features extracted by a layer (passed with -L) and quits program
Default: False
- --PRINT_FIELDS, -PF
Prints list of hydrodynamic/radiographic fields present in a given .npz file (passed with -IN) and quits program
Default: False
- --PRINT_KEYS, -PK
Prints list of choices for the fixed key avialable in a given input dirrectory (passed with -ID) and quits program
Default: False
- --PRINT_SAMPLES, -PS
Prints number of samples in a directory (passed with -ID) matching a fixed key (passed with -XK) and quits program
Default: False
- --LAYER, -L
Name of model layer that features will be extracted from
Default: “None”
- --FEATURES, -T
List of features to include; “Grid” plots all features in one figure using subplots; “All” plots all features each in a new figure; A list of integers can be passed to plot those features each in a new figure. Integer convention starts at 1.
Default: [‘Grid’]
- --D_SCALE, -DS
Scaling factor used in feature derivatives.
Default: 0.001
- --MAT_NORM, -NM
Possible choices: ft01, all01, none
How the extracted features will be normalized, resulting in a scaled matrix; “ft01” normalizes by the min and max of each feature separately; “all01” normalizes by the min and max of all extracted features; “none” does not normalize features.
Default: “ft01”
- --SCLR_NORM, -NR
Possible choices: fro, nuc, inf, -inf, 0, 1, -1, 2, -2
How the extracted features will be normalized, resulting in a scalar value; for choices, see numpy.linalg.norm documentation.
Default: “2”
- --FIELDS, -F
List of fields to be included; pass “none” to use an all-zero field; pass “All” to use all valid fields.
Default: [‘rho’, ‘eqps’, ‘eqps_rate’, ‘eff_stress’, ‘porosity’]
- --FIXED_KEY, -XK
The identifying string for some subset of all data samples; pass “None” to consider all samples
Default: “None”
- --NUM_SAMPLES, -NS
Number of samples to use; pass “All” to use all samples in a given input dirrectory (passed with -ID)
Default: “All”
- --ALPHA1, -A1
Opacity of colormap at value 0
Default: 0.25
- --ALPHA2, -A2
Opacity of colormap at value 1
Default: 1.0
- --COLOR1, -C1
Possible choices: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgreen, darkgrey, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, green, greenyellow, grey, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgreen, lightgrey, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, rebeccapurple, red, rosybrown, royalblue, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen
Color of colormap at value 0; Choose from matplotlib CSS4 color list.
Default: “yellow”
- --COLOR2, -C2
Possible choices: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgreen, darkgrey, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, green, greenyellow, grey, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgreen, lightgrey, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, rebeccapurple, red, rosybrown, royalblue, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen
Color of colormap at value 1; Choose from matplotlib CSS4 color list.
Default: “red”
- --SAVE_FIG, -S
Directory to save the outputs to.
Default: “../examples/tf_coupon/figures/”
Data Prints (setup.data_prints)
Contains functions to print out lists of options for data-related input arguments
- fns.setup.data_prints.print_fields(npz)
Function that prints a list of radiographic/hydrodynamic fields in an npz file
- Parameters
npz (np.lib.npyio.NpzFile) – a loaded .npz file
- Returns
No Return Objects
- fns.setup.data_prints.print_samples(search_dir)
Function that prints how many samples (npz files) in a directory
- Parameters
search_dir (str) – file path to directory to search for samples in; include any restrictions for file name
- Returns
No Return Objects
Data Checks (setup.data_checks)
Contains functions to check that the data-related input arguments passed are valid
- fns.setup.data_checks.check_fields(npz, fields)
Function that checks if all fields in a list exist in a npz file
- Parameters
npz (np.lib.npyio.NpzFile) – a loaded .npz file
fields (list[str]) – list of the fields to test
- Returns
No Return Objects
- fns.setup.data_checks.check_key(fixed_key, search_dir)
Function that prints a list of unique variable indexes for a given fixed variable
- Parameters
fixed_key (str) – the key for samples that is being checked
search_dir (str) – file path to directory to search for samples in
- Returns
No Return Objects
- fns.setup.data_checks.check_samples(num_samples, search_dir)
Function that checks if the number of samples requested are aviailable in a directory
- Parameters
num_samples (str) – should be ‘All’, or an integer; number of samples the script will use
search_dir (str) – path to directory of .npz files
- Returns
No Return Objects