forked from AWehrhahn/PyReduce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings_schema.json
822 lines (822 loc) · 32.8 KB
/
settings_schema.json
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
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
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "pyreduce.schema",
"title": "PyReduce Settings",
"description": "Available settings for the PyReduce reduction pipeline",
"type": "object",
"properties": {
"__instrument__": {
"description": "The name of the instrument these settings are designed for",
"type": "string"
},
"reduce": {
"type": "object",
"properties": {
"base_dir": {
"description": "Base directory of all reduce operations, to keep input and output seperate",
"type": "string"
},
"input_dir": {
"description": "Directory containing the input data, relative to the base directory. May contain {instrument}, {night}, {mode}, {target} tags.",
"type": "string"
},
"output_dir": {
"description": "Directory to place the output (and temporary) files in, relative to the base directory. May contain {instrument}, {night}, {mode}, {target} tags.",
"type": "string"
}
},
"required": [
"base_dir",
"input_dir",
"output_dir"
]
},
"instrument": {
"type": "object"
},
"mask": {
"type": "object"
},
"bias": {
"allOf": [
{
"$ref": "#/definitions/step"
},
{
"type": "object",
"properties": {
"degree": {
"description": "Polynomial degree of the fit between exposure time and pixel values",
"type": "number",
"minimum": 0
}
},
"required": [
"degree"
]
}
]
},
"flat": {
"allOf": [
{
"$ref": "#/definitions/step"
},
{
"$ref": "#/definitions/bias_scaling"
}
]
},
"orders": {
"allOf": [
{
"$ref": "#/definitions/step"
},
{
"$ref": "#/definitions/bias_scaling"
},
{
"type": "object",
"properties": {
"degree": {
"description": "Polynomial degree of the fit to the orders on the detector",
"type": "integer",
"minimum": 0
},
"degree_before_merge": {
"description": "Polynomial degree of the first fit to the orders, before merging clusters",
"type": [
"integer",
"string"
],
"minimum": 0
},
"regularization": {
"description": "Regularization parameter for the order fitting (before merging)",
"type": "number",
"minimum": 0
},
"closing_shape": {
"description": "Shape for the binary closing",
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": {
"type": "integer",
"minimum": 1
}
},
"auto_merge_threshold": {
"description": "Fractional threshold, for automatic merging",
"type": "number",
"minimum": 0,
"maximum": 1
},
"merge_min_threshold": {
"description": "Minimum merge probabilty to consider",
"type": "number",
"minimum": 0,
"maximum": 1
},
"split_sigma": {
"description": "Number of standard deviations around the best fit polyonomial of all orders, to split data points of of. Set to 0 to disable splitting.",
"type": "number",
"minimum": 0
},
"filter_size": {
"description": "Size of the gaussian filter that smoothes the columns for the detection of pixels with signal. Estimated automatically if null.",
"type": [
"integer",
"null"
],
"minimum": 0
},
"min_cluster": {
"description": "Smallest allowed size of clusters before merging. Estimated automatically if null.",
"type": [
"integer",
"null"
],
"minimum": 0
},
"min_width": {
"description": "Minimum width of a cluster to be considered after merging. If between 0 and 1, use that fraction of the detector width. Estimated automatically if null",
"type": [
"number",
"null"
],
"minimum": 0
},
"noise": {
"description": "Background noise level cutoff. Estimated automatically if null.",
"type": [
"integer",
"null"
],
"minimum": 0
},
"border_width": {
"description": "Number of pixels to disregard at the border of the image. Estimated automatically if null.",
"type": [
"integer",
"null"
],
"minimum": 0
},
"manual": {
"description": "Ask for manual confirmation before merging any clusters. Otherwise only ask when overlap below 90%.",
"type": "boolean"
}
},
"required": [
"degree",
"filter_size",
"min_cluster",
"noise",
"border_width",
"manual"
]
}
]
},
"scatter": {
"allOf": [
{
"$ref": "#/definitions/step"
},
{
"$ref": "#/definitions/bias_scaling"
},
{
"type": "object",
"properties": {
"scatter_degree": {
"description": "Polynomial degree of the background scatter, in both pixel dimensions",
"type": [
"integer",
"array"
],
"minimum": 0,
"items": {
"type": "integer",
"minimum": 0
}
},
"extraction_width": {
"description": "Number of pixels below and above the order to use in the extraction. If a value under 1.5 is given it will be understood as the fractional difference to the next order. If only a single value is given it will be applied to all orders, otherwise values need to be provided for all orders",
"type": [
"integer",
"number",
"array"
],
"items": {
"type": [
"integer",
"number"
]
}
},
"scatter_cutoff": {
"description": "Number of sigmas around the mean to include in the background scatter fit",
"type": "number",
"exclusiveMinimum": 0
},
"border_width": {
"description": "Border Width to ignore for background fit.",
"type": [
"number",
"null"
],
"minimum": 0
}
},
"required": [
"scatter_degree",
"scatter_cutoff",
"border_width"
]
}
]
},
"norm_flat": {
"allOf": [
{
"$ref": "#/definitions/step"
},
{
"$ref": "#/definitions/extraction"
},
{
"type": "object",
"properties": {
"threshold": {
"description": "Background level threshold, if lower than 0, it is understood as a fraction of the maximum",
"type": [
"number",
"integer"
],
"exclusiveMinimum": 0
},
"threshold_lower":{
"description": "Lower background level threshold, after the extraction. Always absolute, by default 0.",
"type": "number",
"minimum": 0
}
},
"required": [
"threshold",
"threshold_lower"
]
}
]
},
"wavecal_master": {
"allOf": [
{
"$ref": "#/definitions/step"
},
{
"$ref": "#/definitions/extraction"
},
{
"$ref": "#/definitions/bias_scaling"
}
]
},
"wavecal_init": {
"allOf": [
{
"$ref": "#/definitions/step"
},
{
"type": "object",
"properties": {
"degree": {
"description": "Degree of the polynomial fit for the initial guess",
"type": "number",
"minimum": 2
},
"element": {
"description": "Element(s) of the Gas Lamp used for calibration",
"type": "string"
},
"medium": {
"description": "Medium of the detector, either air or vaccum. This affects the wavelength scale",
"type": "string",
"enum": [
"vac",
"air"
]
},
"wave_delta": {
"description": "Wavelength uncertainty on the initial guess in Angstrom",
"type": "number",
"minimum": 0
},
"nwalkers": {
"description": "Number of MCMC walkers",
"type": "number",
"minimum": 1
},
"steps": {
"description": "Number of MCMC steps per walker",
"type": "number",
"minimum": 1
},
"resid_delta": {
"description": "Residual Uncertainty allowed to match a peak to its known wavelength in m/s",
"type": "number",
"minimum": 0
},
"smoothing": {
"description": "Gaussian smoothing parameter applied to the observed spectrum in pixel scale, set to 0 to disable smoothing",
"type": "number",
"minimum": 0
},
"cutoff": {
"description": "Minimum height of spectral lines in the normalized spectrum, values of 1 and above are interpreted as percentiles of the spectrum, set to 0 to disable the cutoff",
"type": "number",
"minimum": 0,
"maximum": 100
}
},
"required": [
"degree",
"element",
"medium",
"wave_delta",
"nwalkers",
"steps",
"resid_delta",
"smoothing",
"cutoff"
]
}
]
},
"wavecal": {
"allOf": [
{
"$ref": "#/definitions/step"
},
{
"$ref": "#/definitions/polynomialfit"
},
{
"type": "object",
"properties": {
"manual": {
"description": "Use only manual order alignment if true. When false still allow manual alignment after automatic alignment if plot is true",
"type": "boolean"
},
"shift_window": {
"description": "The fraction of the columns that each order can be shifted individually to align with the reference",
"type": "number",
"minimum": 0,
"maximum": 1
},
"threshold": {
"description": "Residual threshold in m/s above which lines will be removed from the fit",
"type": "number",
"exclusiveMinimum": 0
},
"iterations": {
"description": "Number of iterations in the Remove Lines, Identify Lines loop",
"type": "integer",
"minimum": 0
},
"element": {
"description": "Element(s) of the Gas Lamp used for calibration",
"type": ["string", "null"]
},
"medium": {
"description": "Medium of the detector, either air or vaccum. This affects the wavelength scale",
"type": "string",
"enum": [
"vac",
"air"
]
}
},
"required": [
"manual",
"shift_window",
"threshold",
"iterations",
"element",
"medium"
]
}
]
},
"freq_comb_master": {
"allOf": [
{
"$ref": "#/definitions/step"
},
{
"$ref": "#/definitions/extraction"
},
{
"$ref": "#/definitions/bias_scaling"
}
]
},
"freq_comb": {
"allOf": [
{
"$ref": "#/definitions/step"
},
{
"$ref": "#/definitions/polynomialfit"
},
{
"type": "object",
"properties": {
"lfc_peak_width": {
"description": "Required width of the frequency comb peaks, in the peak detection algorithm",
"type": [
"integer",
"null"
],
"minimum": 1
},
"threshold": {
"description": "Residual threshold in m/s above which lines will be removed from the fit",
"type": "number",
"exclusiveMinimum": 0
}
},
"required": [
"lfc_peak_width",
"degree",
"dimensionality",
"threshold"
]
}
]
},
"curvature": {
"allOf": [
{
"$ref": "#/definitions/step"
},
{
"$ref": "#/definitions/polynomialfit"
},
{
"$ref": "#/definitions/bias_scaling"
},
{
"$ref": "#/definitions/extraction"
},
{
"type": "object",
"properties": {
"curv_degree": {
"description": "Number of orders of the curvature to fit. I.e. 1: only linear curvature, 2: second order curvature",
"type": "integer",
"minimum": 1,
"maximum": 2
},
"peak_threshold": {
"description": "Peak detection noise threshold. This much times * 10% noise must be the prominence of the peaks",
"type": "number",
"minimum": 0
},
"peak_width": {
"description": "Minimum width of the peaks in the curvature detection. Usually 1 for sharp peaks as in the wavecal, or 3 for broader peaks of the freq comb",
"type": [
"null",
"number",
"array"
],
"minimum": 1,
"items": {
"type": "number"
},
"minItems": 2,
"maxItems": 2
},
"window_width": {
"description": "Width of the window to look for the peak of each row, within each line. The value here speciefies only on direction the window size is actually twice this +1.",
"type": "integer",
"minimum": 1
},
"peak_function": {
"description": "Function that is used to fit individual line peaks",
"type": "string",
"enum": [
"gaussian",
"lorentzian"
]
}
},
"required": [
"dimensionality",
"degree",
"peak_function",
"window_width",
"peak_width",
"peak_threshold",
"curv_degree"
]
}
]
},
"rectify": {
"allOf": [
{
"$ref": "#/definitions/step"
},
{
"type": "object",
"properties": {
"extraction_width": {
"description": "Number of pixels below and above the order to use in the extraction. If a value under 1.5 is given it will be understood as the fractional difference to the next order. If only a single value is given it will be applied to all orders, otherwise values need to be provided for all orders",
"type": [
"integer",
"number",
"array"
],
"items": {
"type": [
"integer",
"number"
]
}
},
"input_files": {
"description": "Which input files to rectify. Usually 'science' for the science files, but could be any other step with input files",
"type": "string",
"enum": [
"science",
"flat",
"bias",
"scatter",
"orders",
"curvature",
"wavecal",
"freq_comb"
]
}
},
"required": [
"extraction_width"
]
}
]
},
"science": {
"allOf": [
{
"$ref": "#/definitions/step"
},
{
"$ref": "#/definitions/extraction"
}
]
},
"continuum": {
"$ref": "#/definitions/step"
},
"finalize": {
"allOf": [
{
"$ref": "#/definitions/step"
},
{
"properties": {
"filename": {
"description": "Name of the output file. Can include placeholders for instrument, mode, night and observation this night",
"type": "string"
}
}
}
]
}
},
"required": [
"reduce",
"instrument",
"mask",
"bias",
"flat",
"orders",
"scatter",
"norm_flat",
"wavecal_master",
"wavecal_init",
"wavecal",
"freq_comb_master",
"freq_comb",
"curvature",
"continuum",
"finalize"
],
"definitions": {
"step": {
"type": "object",
"properties": {
"plot": {
"description": "Plot results and progress if true",
"type": [
"boolean",
"integer"
],
"minimum": 0
},
"plot_title": {
"description": "Title used in the plots, if any",
"type": [
"string",
"null"
]
}
},
"required": [
"plot",
"plot_title"
]
},
"extraction": {
"description": "Common settings for an extraction",
"type": "object",
"$comment": "There are two options for the extraction. Each has its own set of parameters that need to be present",
"oneOf": [
{
"title": "Optimal Extraction",
"properties": {
"extraction_method": {
"description": "The method to use for extraction",
"type": "string",
"enum": [
"normalize",
"optimal"
]
},
"oversampling": {
"description": "Ovsersampling factor",
"type": "integer",
"minimum": 1
},
"smooth_slitfunction": {
"description": "Smoothing parameter for the slitfunction",
"type": "number",
"minimum": 0
},
"smooth_spectrum": {
"description": "Smoothing parameter for the spectrum",
"type": "number",
"minimum": 0
},
"swath_width": {
"description": "Approximate width of each swath. Exact width might vary slightly",
"type": "integer",
"minimum": 3
},
"extraction_width": {
"description": "Number of pixels below and above the order to use in the extraction. If a value under 1.5 is given it will be understood as the fractional difference to the next order. If only a single value is given it will be applied to all orders, otherwise values need to be provided for all orders",
"type": [
"integer",
"number",
"array"
],
"items": {
"type": [
"integer",
"number"
]
}
},
"extraction_cutoff": {
"description": "Number of sigma above the median of the sorounding pixels to curoff the pixel as a bad pixel. Before the main extraction!. Set to 0 to ignore.",
"type": "number",
"minimum": 0
}
},
"required": [
"extraction_method",
"oversampling",
"smooth_slitfunction",
"smooth_spectrum",
"swath_width",
"extraction_width",
"extraction_cutoff"
]
},
{
"title": "Arc Extraction",
"properties": {
"extraction_method": {
"description": "The method to use for extraction",
"type": "string",
"enum": [
"arc"
]
},
"extraction_width": {
"description": "Number of pixels below and above the order to use in the extraction. If a value under 1.5 is given it will be understood as the fractional difference to the next order. If only a single value is given it will be applied to all orders, otherwise values need to be provided for all orders",
"type": [
"integer",
"number",
"array"
],
"items": {
"type": [
"integer",
"number"
]
}
},
"extraction_cutoff": {
"description": "Number of sigma above the median of the sorounding pixels to curoff the pixel as a bad pixel. Before the main extraction!. Set to 0 to ignore.",
"type": "number",
"minimum": 0
},
"collapse_function": {
"description": "Function used to collapse the image into a spectrum",
"type": "string",
"enum": [
"sum",
"mean",
"median"
]
}
},
"required": [
"extraction_method",
"extraction_width",
"extraction_cutoff",
"collapse_function"
]
}
]
},
"polynomialfit": {
"type": "object",
"oneOf": [
{
"properties": {
"dimensionality": {
"type": "string",
"enum": [
"1D"
]
},
"degree": {
"description": "Polynomial degree in column direction",
"type": "integer",
"minimum": 0
}
}
},
{
"properties": {
"dimensionality": {
"type": "string",
"enum": [
"2D"
]
},
"degree": {
"description": "Polynomial degree in each direction. The first element is in column direction, the second in order direction",
"type": "array",
"items": {
"type": "integer",
"minimum": 0
},
"minItems": 2,
"maxItems": 2
}
}
}
]
},
"bias_scaling": {
"type": "object",
"properties": {
"bias_scaling": {
"description": "determines how the bias is applied",
"type": "string",
"enum": [
"number_of_files",
"exposure_time",
"mean",
"median",
"none"
]
},
"norm_scaling":{
"description": "determines how to apply the normalized flat",
"type": "string",
"enum": ["divide", "none"]
}
},
"required": [
"bias_scaling",
"norm_scaling"
]
}
}
}