-
Notifications
You must be signed in to change notification settings - Fork 4
/
param_test_func.py
236 lines (234 loc) · 11.8 KB
/
param_test_func.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
import os
from utils import is_power2
from astropy import units as u
from datetime import date
def test_target(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
def test_obsDate(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
def test_refFrequency(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
def test_intervalSizeH(form,field):
if field.data not in xrange(0,24):
raise ValueError("Value must be between 0 and 23. Please change input.")
def test_intervalSizeM(form,field):
if field.data not in xrange(0,60):
raise ValueError("Value must be between 0 and 59. Please change input.")
def test_intervalSizeS(form,field):
if field.data < 0. or field.data >= 60.:
raise ValueError("Value must be between 0.0 and 59.9. Please change input.")
def test_interval_set(form,field):
if field.data not in ['int','scan','full']:
raise ValueError("Value must be int,scan,or full please change input")
def test_visibility(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
if not os.path.isdir(field.data):
raise ValueError("This data set does not appear to be in the correct format of a CASA MS. Please check input.")
def test_imageSize(form,field):
if not isinstance(field.data,int):
raise ValueError("Value entered is not a integer. Please change input to an integer.")
if not is_power2(field.data):
raise ValueError("Value entered is not a power of 2^n. To optimize cleaning process please change input.")
def test_numberIters(form,field):
if not isinstance(field.data,int):
raise ValueError("Value entered is not a integer. Please change input to an integer.")
if field.data > 20000:
raise ValueError("Value is greater then the maximum allowed niters. Please enter a value < 20000.")
def test_cellSize(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
u.Unit('arcsec')
letters=re.findall("[a-zA-Z]+",field.data)
number=re.findall(r"[-+]?\d*\.\d+|\d+", field.data)
if not u.Unit(letters[0]).is_equivalent:
raise ValueError("Incorrect unit specified. Please use arcsec.")
def test_taylorTerms(form,field):
if not isinstance(field.data,int):
raise ValueError("Value entered is not a integer. Please change input to an integer.")
if field.data < 1:
raise ValueError("Value must be 1 or greater. Please change input.")
def test_myStokes(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
def test_thre(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
u.Unit('mJy')
u.Unit('uJy')
letters=re.findall("[a-zA-Z]+",field.data)
number=re.findall(r"[-+]?\d*\.\d+|\d+", field.data)
if not u.Unit(letters[0]).is_equivalent:
raise ValueError("Incorrect unit specified. Please use mJy or uJy.")
def test_spw_choice(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
string=field.data
str_split=string.split(':')
if '~' not in str_split[0] or '~' not in str_split[1]:
raise ValueError("Value entered is not in the correct format. Please change input to X~X:X~X format.")
def test_weighting(form,field):
if field.data not in ['briggs','natural','uniform']:
raise ValueError("Invalid Value entered. Allowed values are briggs,uniform or natural.")
def test_robust(form,field):
if not isinstance(field.data,float):
raise ValueError("Value entered is not a float. Please change input to an float.")
if field.data < -2. or field.data > 2.:
raise ValueError("Invalid Value entered. Allowed values are between -2 and 2.")
def test_mask_option(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
allowed=['box','mask','aegean']
if field.data not in allowed:
raise ValueError("Value entered is invalid. Please enter 'box', 'mask', or 'aegean'.")
def test_mask_file(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
def test_var_anal(form,field):
allowed=['T','F']
if field.data not in allowed:
raise ValueError("Value entered is invalid. Please enter 'T' or 'F'.")
def test_power_spec(form,field):
allowed=['T','F']
if field.data not in allowed:
raise ValueError("Value entered is invalid. Please enter 'T' or 'F'.")
def test_seed(form,field):
if not isinstance(field.data,int):
raise ValueError("Value entered is not a integer. Please change input to an integer.")
def test_flood(form,field):
if not isinstance(field.data,int):
raise ValueError("Value entered is not a integer. Please change input to an integer.")
def test_tele(form,field):
allowed=['VLA','SMA','NOEMA']
if field.data not in allowed:
raise ValueError("Value entered is not in the default telescope list. Please enter latitude value in degrees in lat parameter instead.")
def test_lat(form,field):
if not isinstance(field.data,float):
raise ValueError("Value entered is not a float. Please change input to an float.")
def test_runObj(form,field):
allowed=['T','F']
if field.data not in allowed:
raise ValueError("Value entered is invalid. Please enter 'T' or 'F'.")
def test_targetBox(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
string=field.data
str_split=string.split(',')
if len(str_split) != 4:
raise ValueError("Value entered is not in the correct format. Please change input to 'X1,Y1,X2,Y2'.")
def test_outlierFile(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
def test_runClean(form,field):
allowed=['T','F','U']
if field.data not in allowed:
raise ValueError("Value entered is invalid. Please enter 'T' or 'F' or 'U'.")
def test_fix_pos(form,field):
allowed=['T','F']
if field.data not in allowed:
raise ValueError("Value entered is invalid. Please enter 'T' or 'F'.")
def test_do_monte(form,field):
allowed=['T','F']
if field.data not in allowed:
raise ValueError("Value entered is invalid. Please enter 'T' or 'F'.")
def test_integ_fit(form,field):
allowed=['B','T','F']
if field.data not in allowed:
raise ValueError("Value entered is invalid. Please enter 'T' (integrated only),'F' (peak only), or B' (both).")
def test_uv_fit(form,field):
allowed=['T','F']
if field.data not in allowed:
raise ValueError("Value entered is invalid. Please enter 'T' or 'F'.")
def test_uv_fix(form,field):
allowed=['T','F']
if field.data not in allowed:
raise ValueError("Value entered is invalid. Please enter 'T' or 'F'.")
def test_uv_initp(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
def test_def_times(form,field):
allowed=['T','F']
if field.data not in allowed:
raise ValueError("Value entered is invalid. Please enter 'T' or 'F'.")
def test_startTimeH(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
if int(field.data) not in xrange(0,24):
raise ValueError("Value entered is invalid. Please change input to a number between 0 and 24.")
def test_startTimeM(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
if int(field.data) not in xrange(0,60):
raise ValueError("Value entered is invalid. Please change input to a number between 0 and 59.")
def test_startTimeS(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
if int(field.data) < 0. or int(field.data) >= 60.:
raise ValueError("Value entered is invalid. Please change input to a number between 0.0 and 59.9")
def test_endTimeH(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
if int(field.data) not in xrange(0,24):
raise ValueError("Value entered is invalid. Please change input to a number between 0 and 24.")
def test_endTimeM(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
if int(field.data) not in xrange(0,60):
raise ValueError("Value entered is invalid. Please change input to a number between 0 and 59.")
def test_endTimeS(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
if int(field.data) < 0. or int(field.data) >= 60.:
raise ValueError("Value entered is invalid. Please change input to a number between 0.0 and 59.9")
def test_startD(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
if int(field.data) not in xrange(0,32):
raise ValueError("Value entered is invalid. Please change input to a number between 0 and 31.")
def test_startM(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
if int(field.data) not in xrange(0,13):
raise ValueError("Value entered is invalid. Please change input to a number between 0 and 12.")
def test_startY(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
if int(field.data) < 0 or int(field.data) > date.today().year:
raise ValueError("Value entered is invalid. Please change input to a valid 4 digit date")
def test_endD(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
if int(field.data) not in xrange(0,32):
raise ValueError("Value entered is invalid. Please change input to a number between 0 and 31.")
def test_endM(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
if int(field.data) not in xrange(0,13):
raise ValueError("Value entered is invalid. Please change input to a number between 0 and 12.")
def test_endY(form,field):
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
if int(field.data) < 0 or int(field.data) > date.today().year:
raise ValueError("Value entered is invalid. Please change input to a valid 4 digit date")
def test_lc_scale_unit(form,field):
allowed=['','m','u']
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
if field.data not in allowed:
raise ValueError("Value entered is invalid. Please enter '' or 'm', or 'u'.")
def test_lc_scale_time(form,field):
allowed=['H','M','S']
if not isinstance(field.data,str):
raise ValueError("Value entered is not a string. Please change input to a string format.")
if field.data not in allowed:
raise ValueError("Value entered is invalid. Please enter 'H' or 'M', or 'S'.")
def test_image_view(form,field):
allowed=['T','F']
if field.data not in allowed:
raise ValueError("Value entered is invalid. Please enter 'T' or 'F'.")
def test_im_shift_time(form,field):
if not isinstance(field.data,int):
raise ValueError("Value must be an integer. Please change input.")