Last active
April 16, 2024 19:14
-
-
Save MiCurry/692c98242b890981b4c1c2e5c869ec51 to your computer and use it in GitHub Desktop.
ArgParser Example
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
import argparse | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser(description='Easy way to produce plots of\ | |
3D vector fields in python.') | |
parser.add_argument('task', | |
help='task name', | |
type=str) | |
parser.add_argument("-f", '--fileNameTag', | |
help='Appends it to the end of a filename so it can be unique when you plot it', | |
type=str, | |
default="0") | |
parser.add_argument("-d", '--depths', | |
help='integer - amount of depths/layers', | |
type=int, | |
default=3) | |
parser.add_argument("-s", '--size', | |
help='int - size of the domain (s,s)', | |
type=int, | |
default=15) | |
parser.add_argument("-p", '--density', | |
help='int - density of the plot (higher values mean more lines)', | |
type=float, | |
default=1) | |
parser.add_argument("-l", '--length', | |
help='int - length or min length', | |
type=float, | |
default=0.1) | |
args = parser.parse_args() | |
if args.task == "quiver": | |
quiver(size = args.size, | |
layers = args.depths, | |
fileTag = args.fileNameTag) | |
if args.task == "stream": | |
stream(size = args.size, | |
layers = args.depths, | |
density = args.density, | |
minLength = args.length, | |
fileTag = args.fileNameTag) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment