33
33
34
34
# constants
35
35
DATA_FORMATS = "csv" , "nc" , "zarr" , "zarr.zip"
36
- DEFAULT_DATA_TYPE = "auto"
37
36
DEFAULT_DEBUG = False
38
37
DEFAULT_FIGSIZE = 12 , 4
39
38
DEFAULT_FORMAT = "png"
42
41
DEFAULT_INCL_MKID_IDS = None
43
42
DEFAULT_MIN_FREQUENCY = None
44
43
DEFAULT_MAX_FREQUENCY = None
44
+ DEFAULT_MEASURE = "brightness"
45
45
DEFAULT_ROLLING_TIME = 200
46
46
DEFAULT_OUTDIR = Path ()
47
47
DEFAULT_OVERWRITE = False
@@ -122,7 +122,7 @@ def daisy(
122
122
exclude_mkid_ids : Optional [Sequence [int ]] = DEFAULT_EXCL_MKID_IDS ,
123
123
min_frequency : Optional [str ] = DEFAULT_MIN_FREQUENCY ,
124
124
max_frequency : Optional [str ] = DEFAULT_MAX_FREQUENCY ,
125
- data_type : Literal ["auto" , " brightness" , "df/f" ] = DEFAULT_DATA_TYPE ,
125
+ measure : Literal ["brightness" , "df/f" ] = DEFAULT_MEASURE ,
126
126
# options for analysis
127
127
rolling_time : int = DEFAULT_ROLLING_TIME ,
128
128
source_radius : str = "60 arcsec" ,
@@ -151,8 +151,7 @@ def daisy(
151
151
Defaults to no minimum frequency bound.
152
152
max_frequency: Maximum frequency to be included in analysis.
153
153
Defaults to no maximum frequency bound.
154
- data_type: Data type of the input DEMS file.
155
- Defaults to the ``long_name`` attribute in it.
154
+ measure: Measure in analysis (either ``'brightness'`` or ``'df/f'``).
156
155
rolling_time: Moving window size.
157
156
source_radius: Radius of the on-source area.
158
157
Other areas are considered off-source in sky subtraction.
@@ -187,7 +186,7 @@ def daisy(
187
186
exclude_mkid_ids = exclude_mkid_ids ,
188
187
min_frequency = min_frequency ,
189
188
max_frequency = max_frequency ,
190
- data_type = data_type ,
189
+ measure = measure ,
191
190
skycoord_units = skycoord_units ,
192
191
)
193
192
da = select .by (da , "state" , exclude = "GRAD" )
@@ -311,7 +310,7 @@ def pswsc(
311
310
exclude_mkid_ids : Optional [Sequence [int ]] = DEFAULT_EXCL_MKID_IDS ,
312
311
min_frequency : Optional [str ] = DEFAULT_MIN_FREQUENCY ,
313
312
max_frequency : Optional [str ] = DEFAULT_MAX_FREQUENCY ,
314
- data_type : Literal ["auto" , " brightness" , "df/f" ] = DEFAULT_DATA_TYPE ,
313
+ measure : Literal ["brightness" , "df/f" ] = DEFAULT_MEASURE ,
315
314
frequency_units : str = DEFAULT_FREQUENCY_UNITS ,
316
315
# options for saving
317
316
format : str = DEFAULT_FORMAT ,
@@ -334,8 +333,7 @@ def pswsc(
334
333
Defaults to no minimum frequency bound.
335
334
max_frequency: Maximum frequency to be included in analysis.
336
335
Defaults to no maximum frequency bound.
337
- data_type: Data type of the input DEMS file.
338
- Defaults to the ``long_name`` attribute in it.
336
+ measure: Measure in analysis (either ``'brightness'`` or ``'df/f'``).
339
337
frequency_units: Units of the frequency axis.
340
338
format: Output data format of the quick-look result.
341
339
outdir: Output directory for the quick-look result.
@@ -359,7 +357,7 @@ def pswsc(
359
357
exclude_mkid_ids = exclude_mkid_ids ,
360
358
min_frequency = min_frequency ,
361
359
max_frequency = max_frequency ,
362
- data_type = data_type ,
360
+ measure = measure ,
363
361
frequency_units = frequency_units ,
364
362
)
365
363
@@ -401,7 +399,7 @@ def raster(
401
399
exclude_mkid_ids : Optional [Sequence [int ]] = DEFAULT_EXCL_MKID_IDS ,
402
400
min_frequency : Optional [str ] = DEFAULT_MIN_FREQUENCY ,
403
401
max_frequency : Optional [str ] = DEFAULT_MAX_FREQUENCY ,
404
- data_type : Literal ["auto" , " brightness" , "df/f" ] = DEFAULT_DATA_TYPE ,
402
+ measure : Literal ["brightness" , "df/f" ] = DEFAULT_MEASURE ,
405
403
# options for analysis
406
404
chan_weight : Literal ["uniform" , "std" , "std/tx" ] = "std/tx" ,
407
405
pwv : Literal ["0.5" , "1.0" , "2.0" , "3.0" , "4.0" , "5.0" ] = "5.0" ,
@@ -428,8 +426,7 @@ def raster(
428
426
Defaults to no minimum frequency bound.
429
427
max_frequency: Maximum frequency to be included in analysis.
430
428
Defaults to no maximum frequency bound.
431
- data_type: Data type of the input DEMS file.
432
- Defaults to the ``long_name`` attribute in it.
429
+ measure: Measure in analysis (either ``'brightness'`` or ``'df/f'``).
433
430
chan_weight: Weighting method along the channel axis.
434
431
uniform: Uniform weight (i.e. no channel dependence).
435
432
std: Inverse square of temporal standard deviation of sky.
@@ -461,7 +458,7 @@ def raster(
461
458
exclude_mkid_ids = exclude_mkid_ids ,
462
459
min_frequency = min_frequency ,
463
460
max_frequency = max_frequency ,
464
- data_type = data_type ,
461
+ measure = measure ,
465
462
skycoord_units = skycoord_units ,
466
463
)
467
464
@@ -571,7 +568,7 @@ def skydip(
571
568
exclude_mkid_ids : Optional [Sequence [int ]] = DEFAULT_EXCL_MKID_IDS ,
572
569
min_frequency : Optional [str ] = DEFAULT_MIN_FREQUENCY ,
573
570
max_frequency : Optional [str ] = DEFAULT_MAX_FREQUENCY ,
574
- data_type : Literal ["auto" , " brightness" , "df/f" ] = DEFAULT_DATA_TYPE ,
571
+ measure : Literal ["brightness" , "df/f" ] = DEFAULT_MEASURE ,
575
572
# options for analysis
576
573
chan_weight : Literal ["uniform" , "std" , "std/tx" ] = "std/tx" ,
577
574
pwv : Literal ["0.5" , "1.0" , "2.0" , "3.0" , "4.0" , "5.0" ] = "5.0" ,
@@ -596,8 +593,7 @@ def skydip(
596
593
Defaults to no minimum frequency bound.
597
594
max_frequency: Maximum frequency to be included in analysis.
598
595
Defaults to no maximum frequency bound.
599
- data_type: Data type of the input DEMS file.
600
- Defaults to the ``long_name`` attribute in it.
596
+ measure: Measure in analysis (either ``'brightness'`` or ``'df/f'``).
601
597
chan_weight: Weighting method along the channel axis.
602
598
uniform: Uniform weight (i.e. no channel dependence).
603
599
std: Inverse square of temporal standard deviation of sky.
@@ -627,7 +623,7 @@ def skydip(
627
623
exclude_mkid_ids = exclude_mkid_ids ,
628
624
min_frequency = min_frequency ,
629
625
max_frequency = max_frequency ,
630
- data_type = data_type ,
626
+ measure = measure ,
631
627
)
632
628
633
629
# make continuum series
@@ -668,7 +664,7 @@ def still(
668
664
exclude_mkid_ids : Optional [Sequence [int ]] = DEFAULT_EXCL_MKID_IDS ,
669
665
min_frequency : Optional [str ] = DEFAULT_MIN_FREQUENCY ,
670
666
max_frequency : Optional [str ] = DEFAULT_MAX_FREQUENCY ,
671
- data_type : Literal ["auto" , " brightness" , "df/f" ] = DEFAULT_DATA_TYPE ,
667
+ measure : Literal ["brightness" , "df/f" ] = DEFAULT_MEASURE ,
672
668
# options for analysis
673
669
chan_weight : Literal ["uniform" , "std" , "std/tx" ] = "std/tx" ,
674
670
pwv : Literal ["0.5" , "1.0" , "2.0" , "3.0" , "4.0" , "5.0" ] = "5.0" ,
@@ -693,8 +689,7 @@ def still(
693
689
Defaults to no minimum frequency bound.
694
690
max_frequency: Maximum frequency to be included in analysis.
695
691
Defaults to no maximum frequency bound.
696
- data_type: Data type of the input DEMS file.
697
- Defaults to the ``long_name`` attribute in it.
692
+ measure: Measure in analysis (either ``'brightness'`` or ``'df/f'``).
698
693
chan_weight: Weighting method along the channel axis.
699
694
uniform: Uniform weight (i.e. no channel dependence).
700
695
std: Inverse square of temporal standard deviation of sky.
@@ -724,7 +719,7 @@ def still(
724
719
exclude_mkid_ids = exclude_mkid_ids ,
725
720
min_frequency = min_frequency ,
726
721
max_frequency = max_frequency ,
727
- data_type = data_type ,
722
+ measure = measure ,
728
723
)
729
724
730
725
# make continuum series
@@ -764,7 +759,7 @@ def xscan(
764
759
exclude_mkid_ids : Optional [Sequence [int ]] = DEFAULT_EXCL_MKID_IDS ,
765
760
min_frequency : Optional [str ] = DEFAULT_MIN_FREQUENCY ,
766
761
max_frequency : Optional [str ] = DEFAULT_MAX_FREQUENCY ,
767
- data_type : Literal ["auto" , " brightness" , "df/f" ] = DEFAULT_DATA_TYPE ,
762
+ measure : Literal ["brightness" , "df/f" ] = DEFAULT_MEASURE ,
768
763
# options for analysis
769
764
chan_weight : Literal ["uniform" , "std" , "std/tx" ] = "std/tx" ,
770
765
pwv : Literal ["0.5" , "1.0" , "2.0" , "3.0" , "4.0" , "5.0" ] = "5.0" ,
@@ -789,8 +784,7 @@ def xscan(
789
784
Defaults to no minimum frequency bound.
790
785
max_frequency: Maximum frequency to be included in analysis.
791
786
Defaults to no maximum frequency bound.
792
- data_type: Data type of the input DEMS file.
793
- Defaults to the ``long_name`` attribute in it.
787
+ measure: Measure in analysis (either ``'brightness'`` or ``'df/f'``).
794
788
chan_weight: Weighting method along the channel axis.
795
789
uniform: Uniform weight (i.e. no channel dependence).
796
790
std: Inverse square of temporal standard deviation of sky.
@@ -821,7 +815,7 @@ def xscan(
821
815
exclude_mkid_ids = exclude_mkid_ids ,
822
816
min_frequency = min_frequency ,
823
817
max_frequency = max_frequency ,
824
- data_type = data_type ,
818
+ measure = measure ,
825
819
# options for analysis
826
820
chan_weight = chan_weight ,
827
821
pwv = pwv ,
@@ -843,7 +837,7 @@ def yscan(
843
837
exclude_mkid_ids : Optional [Sequence [int ]] = DEFAULT_EXCL_MKID_IDS ,
844
838
min_frequency : Optional [str ] = DEFAULT_MIN_FREQUENCY ,
845
839
max_frequency : Optional [str ] = DEFAULT_MAX_FREQUENCY ,
846
- data_type : Literal ["auto" , " brightness" , "df/f" ] = DEFAULT_DATA_TYPE ,
840
+ measure : Literal ["brightness" , "df/f" ] = DEFAULT_MEASURE ,
847
841
# options for analysis
848
842
chan_weight : Literal ["uniform" , "std" , "std/tx" ] = "std/tx" ,
849
843
pwv : Literal ["0.5" , "1.0" , "2.0" , "3.0" , "4.0" , "5.0" ] = "5.0" ,
@@ -868,8 +862,7 @@ def yscan(
868
862
Defaults to no minimum frequency bound.
869
863
max_frequency: Maximum frequency to be included in analysis.
870
864
Defaults to no maximum frequency bound.
871
- data_type: Data type of the input DEMS file.
872
- Defaults to the ``long_name`` attribute in it.
865
+ measure: Measure in analysis (either ``'brightness'`` or ``'df/f'``).
873
866
chan_weight: Weighting method along the channel axis.
874
867
uniform: Uniform weight (i.e. no channel dependence).
875
868
std: Inverse square of temporal standard deviation of sky.
@@ -900,7 +893,7 @@ def yscan(
900
893
exclude_mkid_ids = exclude_mkid_ids ,
901
894
min_frequency = min_frequency ,
902
895
max_frequency = max_frequency ,
903
- data_type = data_type ,
896
+ measure = measure ,
904
897
# options for analysis
905
898
chan_weight = chan_weight ,
906
899
pwv = pwv ,
@@ -922,7 +915,7 @@ def zscan(
922
915
exclude_mkid_ids : Optional [Sequence [int ]] = DEFAULT_EXCL_MKID_IDS ,
923
916
min_frequency : Optional [str ] = DEFAULT_MIN_FREQUENCY ,
924
917
max_frequency : Optional [str ] = DEFAULT_MAX_FREQUENCY ,
925
- data_type : Literal ["auto" , " brightness" , "df/f" ] = DEFAULT_DATA_TYPE ,
918
+ measure : Literal ["brightness" , "df/f" ] = DEFAULT_MEASURE ,
926
919
# options for analysis
927
920
chan_weight : Literal ["uniform" , "std" , "std/tx" ] = "std/tx" ,
928
921
pwv : Literal ["0.5" , "1.0" , "2.0" , "3.0" , "4.0" , "5.0" ] = "5.0" ,
@@ -947,8 +940,7 @@ def zscan(
947
940
Defaults to no minimum frequency bound.
948
941
max_frequency: Maximum frequency to be included in analysis.
949
942
Defaults to no maximum frequency bound.
950
- data_type: Data type of the input DEMS file.
951
- Defaults to the ``long_name`` attribute in it.
943
+ measure: Measure in analysis (either ``'brightness'`` or ``'df/f'``).
952
944
chan_weight: Weighting method along the channel axis.
953
945
uniform: Uniform weight (i.e. no channel dependence).
954
946
std: Inverse square of temporal standard deviation of sky.
@@ -979,7 +971,7 @@ def zscan(
979
971
exclude_mkid_ids = exclude_mkid_ids ,
980
972
min_frequency = min_frequency ,
981
973
max_frequency = max_frequency ,
982
- data_type = data_type ,
974
+ measure = measure ,
983
975
# options for analysis
984
976
chan_weight = chan_weight ,
985
977
pwv = pwv ,
@@ -1003,7 +995,7 @@ def _scan(
1003
995
exclude_mkid_ids : Optional [Sequence [int ]] = DEFAULT_EXCL_MKID_IDS ,
1004
996
min_frequency : Optional [str ] = DEFAULT_MIN_FREQUENCY ,
1005
997
max_frequency : Optional [str ] = DEFAULT_MAX_FREQUENCY ,
1006
- data_type : Literal ["auto" , " brightness" , "df/f" ] = DEFAULT_DATA_TYPE ,
998
+ measure : Literal ["brightness" , "df/f" ] = DEFAULT_MEASURE ,
1007
999
# options for analysis
1008
1000
chan_weight : Literal ["uniform" , "std" , "std/tx" ] = "std/tx" ,
1009
1001
pwv : Literal ["0.5" , "1.0" , "2.0" , "3.0" , "4.0" , "5.0" ] = "5.0" ,
@@ -1029,8 +1021,7 @@ def _scan(
1029
1021
Defaults to no minimum frequency bound.
1030
1022
max_frequency: Maximum frequency to be included in analysis.
1031
1023
Defaults to no maximum frequency bound.
1032
- data_type: Data type of the input DEMS file.
1033
- Defaults to the ``long_name`` attribute in it.
1024
+ measure: Measure in analysis (either ``'brightness'`` or ``'df/f'``).
1034
1025
chan_weight: Weighting method along the channel axis.
1035
1026
uniform: Uniform weight (i.e. no channel dependence).
1036
1027
std: Inverse square of temporal standard deviation of sky.
@@ -1060,7 +1051,7 @@ def _scan(
1060
1051
exclude_mkid_ids = exclude_mkid_ids ,
1061
1052
min_frequency = min_frequency ,
1062
1053
max_frequency = max_frequency ,
1063
- data_type = data_type ,
1054
+ measure = measure ,
1064
1055
)
1065
1056
1066
1057
# make continuum series
@@ -1185,7 +1176,7 @@ def load_dems(
1185
1176
exclude_mkid_ids : Optional [Sequence [int ]] = DEFAULT_EXCL_MKID_IDS ,
1186
1177
min_frequency : Optional [str ] = DEFAULT_MIN_FREQUENCY ,
1187
1178
max_frequency : Optional [str ] = DEFAULT_MAX_FREQUENCY ,
1188
- data_type : Literal ["auto" , " brightness" , "df/f" ] = DEFAULT_DATA_TYPE ,
1179
+ measure : Literal ["brightness" , "df/f" ] = DEFAULT_MEASURE ,
1189
1180
frequency_units : str = DEFAULT_FREQUENCY_UNITS ,
1190
1181
skycoord_units : str = DEFAULT_SKYCOORD_UNITS ,
1191
1182
) -> xr .DataArray :
@@ -1201,16 +1192,15 @@ def load_dems(
1201
1192
Defaults to no minimum frequency bound.
1202
1193
max_frequency: Maximum frequency to be included in analysis.
1203
1194
Defaults to no maximum frequency bound.
1204
- data_type: Data type of the input DEMS file.
1205
- Defaults to the ``long_name`` attribute in it.
1195
+ measure: Measure of the DataArray (either brightness or df/f).
1206
1196
frequency_units: Units of the frequency.
1207
1197
skycoord_units: Units of the sky coordinate axes.
1208
1198
1209
1199
Returns:
1210
1200
DEMS as a DataArray with given conversion and selections.
1211
1201
1212
1202
"""
1213
- da = load .dems (dems , chunks = None )
1203
+ da = load .dems (dems , measure = measure , chunks = None )
1214
1204
1215
1205
if min_frequency is not None :
1216
1206
min_frequency = Quantity (min_frequency ).to (frequency_units ).value
@@ -1251,16 +1241,7 @@ def load_dems(
1251
1241
max = max_frequency ,
1252
1242
)
1253
1243
1254
- if data_type == "auto" and "units" in da .attrs :
1255
- return da
1256
-
1257
- if data_type == "brightness" :
1258
- return da .assign_attrs (long_name = "Brightness" , units = "K" )
1259
-
1260
- if data_type == "df/f" :
1261
- return da .assign_attrs (long_name = "df/f" , units = "dimensionless" )
1262
-
1263
- raise ValueError ("Data type could not be inferred." )
1244
+ return da
1264
1245
1265
1246
1266
1247
def save_qlook (
0 commit comments