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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373 | def parse_args() -> argparse.Namespace:
"""
Parse the arguments.
Returns:
The argument namespace.
"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
'--coords',
type=str,
help=("Right Ascension and Declination in quotes. Can be formatted as"
" \"HH:MM:SS [+/-]DD:MM:SS\" (e.g. \"12:00:00 -20:00:00\") or "
"decimal degrees (e.g. \"12.123 -20.123\"). Multiple "
"coordinates are supported by separating with a comma (no space)"
" e.g. \"12.231 -56.56,123.4 +21.3\"."
" Finally you can also enter coordinates using a .csv file."
" See example file for format."),
default=None)
parser.add_argument(
'--source-names',
type=str,
help=("Only for use when entering coordaintes via the command line. "
"State the name of the source being searched. "
"Use quote marks for names that contain a space. "
"For multiple sources separate with a comma with no "
"space, e.g. \"SN 1994N,SN 2003D,SN 2019A\"."),
default="")
parser.add_argument(
'--ncpu',
type=int,
help="Number of cpus to use in queries",
default=2)
parser.add_argument(
'--epochs',
type=str,
help=("Select the VAST Pilot Epoch to query. Epoch 0 is RACS. "
"All available epochs can be queried using "
"'all' or all VAST Epochs using 'all-vast'. Otherwise"
" enter as a comma separated list with no spaces, e.g."
" '1,2,3x,4x'."),
default="1")
parser.add_argument(
'--imsize',
type=float,
help='Edge size of the postagestamp in arcmin',
default=5.)
parser.add_argument(
'--maxsep',
type=float,
help='Maximum separation of source from beam centre in degrees.',
default=1.5)
parser.add_argument(
'--out-folder',
type=str,
help='Name of the output directory to place all results in.',
default="find_sources_output_{}".format(
runstart.strftime("%Y%m%d_%H:%M:%S")))
parser.add_argument(
'--crossmatch-radius',
type=float,
help='Crossmatch radius in arcseconds',
default=10.0)
parser.add_argument(
'--search-all-fields',
action="store_true",
help='Return all data at the requested location(s) regardless of field'
)
parser.add_argument(
'--use-combined',
action="store_true",
help='Use the combined mosaics instead of individual tiles.')
parser.add_argument(
'--uncorrected-data',
action="store_true",
help='Use the uncorrected data. Only relevant with --use-tiles')
parser.add_argument(
'--corrected-data',
action="store_true",
help='Use the corrected data. Only relevant with --use-tiles. '
'Note: this is distinct from the post-processed data, which '
'will be used by default if no data arguments are passed.'
)
parser.add_argument(
'--islands',
action="store_true",
help='Search islands instead of components.')
parser.add_argument(
'--base-folder',
type=str,
help=(
'Path to base folder if using default directory structure.'
' Not required if the `VAST_DATA_DIR` environment variable'
' has been set.'
))
parser.add_argument(
'--stokes',
type=str,
choices=["I", "Q", "U", "V"],
help='Select the Stokes parameter.',
default="I")
parser.add_argument(
'--quiet',
action="store_true",
help='Turn off non-essential terminal output.')
parser.add_argument(
'--forced-fits',
action="store_true",
help=(
'Perform forced fits at the locations requested.'
)
)
parser.add_argument(
'--forced-cluster-threshold',
type=float,
default=1.5,
help=(
'Multiple of `major_axes` to use for identifying clusters,'
' when performing forced fits.'
)
)
parser.add_argument(
'--forced-allow-nan',
action="store_true",
help=(
'When used, forced fits are attempted even when NaN'
' values are present.'
)
)
parser.add_argument(
'--crossmatch-only',
action="store_true",
help='Only run crossmatch, do not generate any fits or png files.')
parser.add_argument(
'--selavy-simple',
action="store_true",
help='Only include flux density and uncertainty in returned table.')
parser.add_argument(
'--process-matches',
action="store_true",
help='Only produce data products for sources with a selavy match.')
parser.add_argument(
'--debug',
action="store_true",
help='Turn on debug output.')
parser.add_argument(
'--no-background-rms',
action="store_true",
help='Do not estimate the background RMS around each source.')
parser.add_argument(
'--planets',
default=[],
help=(
"Also search for solar system objects. "
"Enter as a comma separated list, e.g. 'jupiter,venus,moon'. "
"Allowed choices are: {}".format(ALLOWED_PLANETS)))
parser.add_argument(
'--find-fields',
action="store_true",
help='Only return the associated field for each source.')
parser.add_argument(
'--search-around-coordinates',
action="store_true",
help=(
'Return all crossmatches within the queried crossmatch radius.'
'Plotting options will be unavailable.'
))
parser.add_argument(
'--clobber',
action="store_true",
help=("Overwrite the output directory if it already exists."))
parser.add_argument(
'--scheduler',
default='processes',
choices=['processes', 'single-threaded'],
help=("Dask scheduling option to use. Options are 'processes' "
"(parallel processing) or 'single-threaded'.")
)
parser.add_argument(
'--sort-output',
action="store_true",
help=(
"Place results into individual source directories within the "
"main output directory."
))
parser.add_argument(
'--nice',
type=int,
help='Set nice level.',
default=5)
parser.add_argument(
'--crossmatch-radius-overlay',
action="store_true",
help=('A circle is placed on all PNG and region/annotation'
' files to represent the crossmatch radius.'))
parser.add_argument(
'--no-fits',
action="store_true",
help='Do not save the FITS cutouts.')
parser.add_argument(
'--rms-cutouts',
action="store_true",
help='Create FITS files containing noisemap cutouts.')
parser.add_argument(
'--bkg-cutouts',
action="store_true",
help='Create FITS files containing meanmap cutouts.')
parser.add_argument(
'--plot-dpi',
type=int,
help="Specify the DPI of all saved figures.",
default=150)
parser.add_argument(
'--create-png',
action="store_true",
help='Create a png of the fits cutout.')
parser.add_argument(
'--png-selavy-overlay',
action="store_true",
help='Overlay selavy components onto the png image.')
parser.add_argument(
'--png-linear-percentile',
type=float,
default=99.9,
help='Choose the percentile level for the png normalisation.')
parser.add_argument(
'--png-use-zscale',
action="store_true",
help='Select ZScale normalisation (default is \'linear\').')
parser.add_argument(
'--png-zscale-contrast',
type=float,
default=0.1,
help='Select contrast to use for zscale.')
parser.add_argument(
'--png-hide-beam',
action="store_true",
help='Select to not show the image synthesised beam on the plot.')
parser.add_argument(
'--png-no-island-labels',
action="store_true",
help='Disable island lables on the png.')
parser.add_argument(
'--png-no-colorbar',
action="store_true",
help='Do not show the colorbar on the png.')
parser.add_argument(
'--png-disable-autoscaling',
action="store_true",
help=(
'Do not use the auto normalisation and instead apply'
' scale settings to each epoch individually.'
))
parser.add_argument(
'--png-absolute-axes',
action="store_true",
help=(
'Create PNGs with axis labels in absolute coordinates,'
' rather than offsets from the central position.'
))
parser.add_argument(
'--ann',
action="store_true",
help='Create a kvis annotation file of the components.')
parser.add_argument(
'--reg',
action="store_true",
help='Create a DS9 region file of the components.')
parser.add_argument(
'--lightcurves',
action="store_true",
help='Create lightcurve plots.')
parser.add_argument(
'--lc-use-int-flux',
action="store_true",
help='Use the integrated flux, rather than peak flux')
parser.add_argument(
'--lc-no-plotting',
action="store_true",
help='Write lightcurves to file without plotting')
parser.add_argument(
'--lc-min-points',
type=int,
help='Minimum number of epochs a source must be covered by',
default=2)
parser.add_argument(
'--lc-min-detections',
type=int,
help='Minimum number of times a source must be detected',
default=0)
parser.add_argument(
'--lc-mjd',
action="store_true",
help='Plot lightcurve in MJD rather than datetime.')
parser.add_argument(
'--lc-start-date',
type=str,
help=(
"Plot lightcurve in days from some start date, "
"formatted as YYYY-MM-DD HH:MM:SS or any other form "
"that is accepted by pd.to_datetime()"
))
parser.add_argument(
'--lc-grid',
action="store_true",
help="Turn on the 'grid' in the lightcurve plot.")
parser.add_argument(
'--lc-yaxis-start',
type=str,
choices=["auto", "0"],
default="0",
help=(
"Define where the y axis on the lightcurve plot starts from."
" 'auto' will let matplotlib decide the best range and '0' "
" will start from 0."
))
parser.add_argument(
'--lc-use-forced-for-limits',
action="store_true",
help="Use the forced fits values instead of upper limits.")
parser.add_argument(
'--lc-use-forced-for-all',
action="store_true",
help="Use the forced fits for all datapoints.")
parser.add_argument(
'--lc-hide-legend',
action="store_true",
help="Don't show the legend on the final lightcurve plot.")
args = parser.parse_args()
return args
|