@@ -8,7 +8,8 @@ def __init__(self, args):
8
8
self .min_window = 10
9
9
self .max_window = 100
10
10
self .increments = 5
11
- self .convergence_threshold = 0.01
11
+ self .asymptotic_convergence_threshold = 0.01
12
+ self .max_iterations = 0
12
13
self ._process_cla ()
13
14
14
15
def _process_cla (self ):
@@ -39,14 +40,19 @@ def _process_cla(self):
39
40
print ('If you want to change these defaults, see the help message with -h or --help\n ' )
40
41
41
42
42
- if '-ct ' in self .args :
43
- self .convergence_threshold = float (self .args [int (self .args .index ('-ct ' ) + 1 )])
44
- elif '--convergence-threshold' in self .args :
45
- self .convergence_threshold = float (self .args [int (self .args .index ('--convergence-threshold' ) + 1 )])
43
+ if '-act ' in self .args :
44
+ self .asymptotic_convergence_threshold = float (self .args [int (self .args .index ('-act ' ) + 1 )])
45
+ elif '--asymptotic- convergence-threshold' in self .args :
46
+ self .asymptotic_convergence_threshold = float (self .args [int (self .args .index ('--asymptotic -convergence-threshold' ) + 1 )])
46
47
else :
47
48
print ('No asymptotic convergence threshold specified.' )
48
49
print ('Using default asymptotic convergence threshold of 0.01 (1%)\n ' )
49
50
51
+ if '-mi' in self .args :
52
+ self .max_iterations = int (self .args [int (self .args .index ('-mi' ) + 1 )])
53
+ elif '--max-iterations' in self .args :
54
+ self .max_iterations = int (self .args [int (self .args .index ('--max-iterations' ) + 1 )])
55
+
50
56
if '-h' in self .args or '--help' in self .args :
51
57
self ._print_help ()
52
58
@@ -56,25 +62,29 @@ def get_case(self):
56
62
def get_window_sizes (self ):
57
63
return self .min_window , self .max_window , self .increments
58
64
59
- def get_convergence_threshold (self ):
60
- return self .convergence_threshold
65
+ def get_asymptotic_convergence_threshold (self ):
66
+ return self .asymptotic_convergence_threshold
67
+
68
+ def get_max_iterations (self ):
69
+ return self .max_iterations
61
70
62
71
63
72
def _print_help (self ):
64
73
if '-h' in self .args or '--help' in self .args :
65
74
print ('Usage: python3 pyOSC.py -c <case>\n ' )
66
- print (' -c, --case <case> Case to run' )
67
- print (' -h, --help Show this help message and exit' )
68
- print (' -w, --window Window size to use for convergence analysis' )
69
- print (' Specified as a list of integers separated by spaces' )
70
- print (' Use the format <smallest window> <largest window> <increments>' )
71
- print (' Example: -w 10 100 10. Smallest window = 10' )
72
- print (' largest window = 100, and window increments = 10' )
73
- print (' If no window size is specified, the default 10 100 5 is used' )
75
+ print (' -c, --case <case> Case to run' )
76
+ print (' -h, --help Show this help message and exit' )
77
+ print (' -w, --window Window size to use for convergence analysis' )
78
+ print (' Specified as a list of integers separated by spaces' )
79
+ print (' Use the format <smallest window> <largest window> <increments>' )
80
+ print (' Example: -w 10 100 10. Smallest window = 10' )
81
+ print (' largest window = 100, and window increments = 10' )
82
+ print (' If no window size is specified, the default 10 100 5 is used' )
74
83
print (' -act, --asymptotic-convergence-threshold' )
75
- print (' Asymptotic convergence threshold to use for convergence analysis.' )
76
- print (' This value will be used to check if coefficients have converged' )
77
- print (' to the asymptotic value at the end of the simulation.' )
84
+ print (' Asymptotic convergence threshold to use for convergence analysis.' )
85
+ print (' This value will be used to check if coefficients have converged' )
86
+ print (' to the asymptotic value at the end of the simulation.' )
87
+ print (' -mi, --max-iteration Max number of iterations to consider in convergence analysis' )
78
88
79
89
exit ()
80
90
0 commit comments