-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathiseult.py
executable file
·86 lines (70 loc) · 3.89 KB
/
iseult.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#! /usr/bin/env python
if __name__ == '__main__':
import argparse
import warnings
import importlib.metadata
matplotlib_version = importlib.metadata.version('matplotlib')
required_mpl_version = '3.7'
if matplotlib_version[:3] != required_mpl_version:
raise RuntimeError(f"Unsupported Matplotlib version. Must be version {required_mpl_version}.x, environment has version {matplotlib_version}. " \
"See README.md for details on how to set up the environment.")
parser = argparse.ArgumentParser(description='Plotting program for Tristan-MP files.')
parser.add_argument('-n', nargs = '?',# dest='accumulate', action='store_const',
const=-1, default=-1, type=int,
help='Maximum file # to consider')
parser.add_argument('-framerate', nargs = '?',# dest='accumulate', action='store_const',
const=10, default=10, type=int,
help='FPS for the movie')
parser.add_argument('-outmovie', nargs = '?',# dest='accumulate', action='store_const',
const='out.mov', default='out.mov', type=str,
help='FPS for the movie')
parser.add_argument('-O', nargs = '+',# dest='accumulate', action='store_const',
default=[''], type=str,
help='Directory Iseult will open. Default is output')
parser.add_argument('-p', nargs = '?',# dest='accumulate', action='store_const',
const='Default', default='Default', type=str,
help='''Open Iseult with the given saved view.
If the name of view contains whitespace,
either it must be enclosed in quotation marks or given
with whitespace removed. Name is case sensitive.''')
parser.add_argument("-b", help="Run Iseult from bash script. Makes a movie.",
action="store_true")
parser.add_argument("-name", nargs = '+',# dest='accumulate', action='store_const',
default=[''], type=str,
help='Plot Title')
parser.add_argument("--wait", help="Wait until current simulation is finished before making movie.",
action="store_true")
parser.add_argument("-e",
"--electron-spectra",
default=None,
type=str,
choices=['n'+str(i) for i in range(1,11)],
help="Which data set to use for the electron spectra. Should be of the format 'nX` where X is the integer number of the dataset")
parser.add_argument("-i",
"--ion-spectra",
default=None,
type=str,
choices=['n'+str(i) for i in range(1,11)],
help="Which data set to use for the ion spectra. Should be of the format 'nX` where X is the integer number of the dataset")
cmd_args = parser.parse_args()
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), 'src'))
if not cmd_args.b:
from main_app import runMe
runMe(cmd_args)
else:
warnings.warn('The `-b` option has not been verified to be fully functional.', RuntimeWarning)
if cmd_args.wait:
import subprocess, time
slurm_num = sys.stdin.read().split[-1]
print(slurm_num)
num = 0
done = False
while num < 2000 and not done:
slurm_queue = subprocess.check_output(["squeue"])
if slurm_queue.find(slurm_num) != -1:
num += 1
time.sleep(300)
from oengus import runMe
print(cmd_args.name, cmd_args.O)
runMe(cmd_args)