msc.py 12.3 KB
Newer Older
Wei Shoulin's avatar
Wei Shoulin committed
1
import dataclasses
Wei Shoulin's avatar
Wei Shoulin committed
2
3
from typing import Dict
from .common import BaseModel, default_field
Wei Shoulin's avatar
Wei Shoulin committed
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

@dataclasses.dataclass
class Level0PrcRecord(BaseModel):
    id: int = 0
    level0_id: str = ""
    pipeline_id: str = ""
    prc_module: str = ""
    params_file_path: str=""
    prc_status: int = 0
    prc_time: str=""
    result_file_path: str=""

@dataclasses.dataclass
class Level0Record(BaseModel):
    id: int = 0
    level0_id: str = ""
    obs_id: str = ""
    detector_no: str = ""
    obs_type: str = ""
    obs_time: str=""
    exp_time: float = 0
    detector_status_id: int = 0
    filename: str=""
    file_path: str=""
    qc0_status: int = 0
    qc0_time: str=""
    prc_status: int = 0
    prc_time: str=""
    create_time: str=""
Wei Shoulin's avatar
Wei Shoulin committed
33
    header: Dict[str,object] = default_field({})
Wei Shoulin's avatar
Wei Shoulin committed
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

@dataclasses.dataclass
class CalMergeRecord(BaseModel):
    id: int = 0
    cal_id: str = ""
    detector_no: str = ""
    ref_type: str = ""
    obs_time: str=""
    exp_time: float = 0
    filename: str=""
    file_path: str=""
    qc1_status: int = 0
    qc1_time: str=""
    prc_status: int = 0
    prc_time: str=""
    prc_time: str=""
    create_time: str=""
    level0_ids: list = dataclasses.field(default_factory=list)
    
@dataclasses.dataclass
Wei Shoulin's avatar
Wei Shoulin committed
54
55
class Level1Record(BaseModel):
    id: int = 0
Wei Shoulin's avatar
Wei Shoulin committed
56
    level0_id : str = ""
Wei Shoulin's avatar
Wei Shoulin committed
57
    data_type: str=""
Wei Shoulin's avatar
mc3    
Wei Shoulin committed
58
    cor_sci_id: int = 0
Wei Shoulin's avatar
Wei Shoulin committed
59
60
61
62
63
64
65
66
67
    prc_params: str=""
    filename : str=""
    file_path: str=""
    qc1_status: int = 0
    qc1_time: str=""
    prc_status: int = 0
    prc_time: str=""
    create_time: str=""
    pipeline_id: str=""
Wei Shoulin's avatar
Wei Shoulin committed
68
    refs: Dict[str,int] = default_field({})
Wei Shoulin's avatar
Wei Shoulin committed
69

Wei Shoulin's avatar
Wei Shoulin committed
70
71
72
73
74
75
76
77
78
79
80
@dataclasses.dataclass
class Level1PrcRecord(BaseModel):
    id: int = 0
    level1_id: int = 0
    pipeline_id: str = ""
    prc_module: str = ""
    params_file_path: str=""
    prc_status: int = 0
    prc_time: str=""
    result_file_path: str=""  

Wei Shoulin's avatar
Wei Shoulin committed
81
@dataclasses.dataclass
Wei Shoulin's avatar
Wei Shoulin committed
82
83
84
85
86
87
88
89
90
91
92
class Level2Record(BaseModel):
    id: int = 0
    level1_id : int = 0
    data_type: str=""
    filename : str=""
    file_path: str=""
    qc2_status: int = 0
    qc2_time: str=""
    prc_status: int = 0
    prc_time: str=""
    create_time: str=""
Wei Shoulin's avatar
Wei Shoulin committed
93
    pipeline_id: str=""
Wei Shoulin's avatar
Wei Shoulin committed
94
95
96
97
98
99
100
101
102
103
104
105
106
    import_status: int = 0

@dataclasses.dataclass
class Level2CoRecord(BaseModel):
    id: int = 0
    data_type: str=""
    filename : str=""
    file_path: str=""
    qc2_status: int = 0
    qc2_time: str=""
    prc_status: int = 0
    prc_time: str=""
    create_time: str=""
Wei Shoulin's avatar
Wei Shoulin committed
107
    pipeline_id: str=""
Wei Shoulin's avatar
Wei Shoulin committed
108
    import_status: int = 0
Wei Shoulin's avatar
Wei Shoulin committed
109
110
111

@dataclasses.dataclass
class Level2CatalogRecord(BaseModel):
Wei Shoulin's avatar
ifs ver    
Wei Shoulin committed
112
    level2_id: int = 0
Wei Shoulin's avatar
Wei Shoulin committed
113
    seq: int = 0
Wei Shoulin's avatar
Wei Shoulin committed
114
115
116
117
    flux_aper: list = dataclasses.field(default_factory=list)
    fluxerr_aper: list = dataclasses.field(default_factory=list)
    mag_aper: list = dataclasses.field(default_factory=list)
    magerr_aper: list = dataclasses.field(default_factory=list)
Wei Shoulin's avatar
Wei Shoulin committed
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
    flux_auto: float = -1
    fluxerr_auto: float = -1
    mag_auto: float = -1
    magerr_auto: float = -1
    kron_radius: float = -1
    background: float = -1
    x_image: float = -1
    y_image: float = -1
    alpha_j2000: float = -1
    delta_j2000: float = -1
    a_image: float = -1
    b_image: float = -1
    theta_image: float = -1
    a_world: float = -1
    b_world: float = -1
    theta_world: float = -1
    theta_j2000: float = -1
    errx2_image: float = -1
    erry2_image: float = -1
    erra_image: float = -1
    errb_image: float = -1
    errtheta_image: float = -1
    erra_world: float = -1
    errb_world: float = -1
    errtheta_world: float = -1
    errtheta_j2000: float = -1
    xwin_image: float = -1
    ywin_image: float = -1
    alphawin_j2000: float = -1
    deltawin_j2000: float = -1
    errx2win_image: float = -1
    erry2win_image: float = -1
    flags: int = 0
    flags_weight: int = 0
    imaflags_iso: float = -1
    nimaflags_iso: float = -1
    fwhm_image: float = -1
    fwhm_world: float = -1
    elongation: float = -1
    ellipticity: float = -1
    class_star: float = -1
    flux_radius: float = -1
    fwhmpsf_image: float = -1
    fwhmpsf_world: float = -1
    xpsf_image: float = -1
    ypsf_image: float = -1
    alphapsf_j2000: float = -1
    deltapsf_j2000: float = -1
    flux_psf: float = -1
    fluxerr_psf: float = -1
    mag_psf: float = -1
    magerr_psf: float = -1
    niter_psf: int = 0
    chi2_psf: float = -1
    errx2psf_image: float = -1
    erry2psf_image: float = -1
    chi2_model: float = -1
    flags_model: int = 0
    niter_model: int = 0
    flux_model: float = -1
    fluxerr_model: float = -1
    mag_model: float = -1
    magerr_model: float = -1
    flux_hybrid: float = -1
    fluxerr_hybrid: float = -1
    mag_hybrid: float = -1
    magerr_hybrid: float = -1
    flux_max_model: float = -1
    mu_max_model: float = -1
    flux_eff_model: float = -1
    mu_eff_model: float = -1
    flux_mean_model: float = -1
    mu_mean_model: float = -1
    xmodel_image: float = -1
    ymodel_image: float = -1
    alphamodel_j2000: float = -1
    deltamodel_j2000: float = -1
    erry2model_image: float = -1
    erramodel_image: float = -1
    errbmodel_image: float = -1
    errthetamodel_image: float = -1
    erramodel_world: float = -1
    errbmodel_world: float = -1
    errthetamodel_world: float = -1
    errthetamodel_j2000: float = -1
    amodel_image: float = -1
    bmodel_image: float = -1
    thetamodel_image: float = -1
    amodel_world: float = -1
    bmodel_world: float = -1
    thetamodel_world: float = -1
    thetamodel_j2000: float = -1
    spread_model: float = -1
    spreaderr_model: float = -1
    noisearea_model: float = -1
    flux_spheroid: float = -1
    fluxerr_spheroid: float = -1
    mag_spheroid: float = -1
    magerr_spheroid: float = -1
    flux_max_spheroid: float = -1
    mu_max_spheroid: float = -1
    flux_eff_spheroid: float = -1
    mu_eff_spheroid: float = -1
    flux_mean_spheroid: float = -1
    mu_mean_spheroid: float = -1
    fluxratio_spheroid: float = -1
    fluxratioerr_spheroid: float = -1
    spheroid_reff_image: float = -1
    spheroid_refferr_image: float = -1
    spheroid_reff_world: float = -1
    spheroid_refferr_world: float = -1
    spheroid_aspect_image: float = -1
    spheroid_aspecterr_image: float = -1
    spheroid_aspect_world: float = -1
    spheroid_aspecterr_world: float = -1
    spheroid_theta_image: float = -1
    spheroid_thetaerr_image: float = -1
    spheroid_theta_world: float = -1
    spheroid_thetaerr_world: float = -1
    spheroid_theta_j2000: float = -1
    spheroid_sersicn: float = -1
    spheroid_sersicnerr: float = -1
    flux_disk: float = -1
    fluxerr_disk: float = -1
    mag_disk: float = -1
    magerr_disk: float = -1
    flux_max_disk: float = -1
    mu_max_disk: float = -1
    flux_eff_disk: float = -1
    mu_eff_disk: float = -1
    flux_mean_disk: float = -1
    mu_mean_disk: float = -1
    fluxratio_disk: float = -1
    fluxratioerr_disk: float = -1
    disk_scale_image: float = -1
    disk_scaleerr_image: float = -1
    disk_scale_world: float = -1
    disk_scaleerr_world: float = -1
    disk_aspect_image: float = -1
    disk_aspecterr_image: float = -1
    disk_aspect_world: float = -1
    disk_aspecterr_world: float = -1
    disk_inclination: float = -1
    disk_inclinationerr: float = -1
    disk_theta_image: float = -1
    disk_thetaerr_image: float = -1
    disk_theta_world: float = -1
    disk_thetaerr_world: float = -1
    disk_theta_j2000: float = -1    
Wei Shoulin's avatar
ifs ver    
Wei Shoulin committed
267
268
269
270
271
    NS8HIdx: int = 0
    NS16HIdx: int = 0
    NS32HIdx: int = 0
    NS64HIdx: int = 0
    create_time: str = ''
Wei Shoulin's avatar
Wei Shoulin committed
272

Wei Shoulin's avatar
Wei Shoulin committed
273
@dataclasses.dataclass
Wei Shoulin's avatar
Wei Shoulin committed
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
class Level2CoCatalogRecord(BaseModel):
    level2_id: int = 0
    seq: int = 0
    flux_aper: list = dataclasses.field(default_factory=list)
    fluxerr_aper: list = dataclasses.field(default_factory=list)
    mag_aper: list = dataclasses.field(default_factory=list)
    magerr_aper: list = dataclasses.field(default_factory=list)
    flux_auto: float = -1
    fluxerr_auto: float = -1
    mag_auto: float = -1
    magerr_auto: float = -1
    kron_radius: float = -1
    background: float = -1
    x_image: float = -1
    y_image: float = -1
    alpha_j2000: float = -1
    delta_j2000: float = -1
    a_image: float = -1
    b_image: float = -1
    theta_image: float = -1
    a_world: float = -1
    b_world: float = -1
    theta_world: float = -1
    theta_j2000: float = -1
    errx2_image: float = -1
    erry2_image: float = -1
    erra_image: float = -1
    errb_image: float = -1
    errtheta_image: float = -1
    erra_world: float = -1
    errb_world: float = -1
    errtheta_world: float = -1
    errtheta_j2000: float = -1
    xwin_image: float = -1
    ywin_image: float = -1
    alphawin_j2000: float = -1
    deltawin_j2000: float = -1
    errx2win_image: float = -1
    erry2win_image: float = -1
    flags: int = 0
    flags_weight: int = 0
    imaflags_iso: float = -1
    nimaflags_iso: float = -1
    fwhm_image: float = -1
    fwhm_world: float = -1
    elongation: float = -1
    ellipticity: float = -1
    class_star: float = -1
    flux_radius: float = -1
    fwhmpsf_image: float = -1
    fwhmpsf_world: float = -1
    xpsf_image: float = -1
    ypsf_image: float = -1
    alphapsf_j2000: float = -1
    deltapsf_j2000: float = -1
    flux_psf: float = -1
    fluxerr_psf: float = -1
    mag_psf: float = -1
    magerr_psf: float = -1
    niter_psf: int = 0
    chi2_psf: float = -1
    errx2psf_image: float = -1
    erry2psf_image: float = -1
    chi2_model: float = -1
    flags_model: int = 0
    niter_model: int = 0
    flux_model: float = -1
    fluxerr_model: float = -1
    mag_model: float = -1
    magerr_model: float = -1
    flux_hybrid: float = -1
    fluxerr_hybrid: float = -1
    mag_hybrid: float = -1
    magerr_hybrid: float = -1
    flux_max_model: float = -1
    mu_max_model: float = -1
    flux_eff_model: float = -1
    mu_eff_model: float = -1
    flux_mean_model: float = -1
    mu_mean_model: float = -1
    xmodel_image: float = -1
    ymodel_image: float = -1
    alphamodel_j2000: float = -1
    deltamodel_j2000: float = -1
    erry2model_image: float = -1
    erramodel_image: float = -1
    errbmodel_image: float = -1
    errthetamodel_image: float = -1
    erramodel_world: float = -1
    errbmodel_world: float = -1
    errthetamodel_world: float = -1
    errthetamodel_j2000: float = -1
    amodel_image: float = -1
    bmodel_image: float = -1
    thetamodel_image: float = -1
    amodel_world: float = -1
    bmodel_world: float = -1
    thetamodel_world: float = -1
    thetamodel_j2000: float = -1
    spread_model: float = -1
    spreaderr_model: float = -1
    noisearea_model: float = -1
    flux_spheroid: float = -1
    fluxerr_spheroid: float = -1
    mag_spheroid: float = -1
    magerr_spheroid: float = -1
    flux_max_spheroid: float = -1
    mu_max_spheroid: float = -1
    flux_eff_spheroid: float = -1
    mu_eff_spheroid: float = -1
    flux_mean_spheroid: float = -1
    mu_mean_spheroid: float = -1
    fluxratio_spheroid: float = -1
    fluxratioerr_spheroid: float = -1
    spheroid_reff_image: float = -1
    spheroid_refferr_image: float = -1
    spheroid_reff_world: float = -1
    spheroid_refferr_world: float = -1
    spheroid_aspect_image: float = -1
    spheroid_aspecterr_image: float = -1
    spheroid_aspect_world: float = -1
    spheroid_aspecterr_world: float = -1
    spheroid_theta_image: float = -1
    spheroid_thetaerr_image: float = -1
    spheroid_theta_world: float = -1
    spheroid_thetaerr_world: float = -1
    spheroid_theta_j2000: float = -1
    spheroid_sersicn: float = -1
    spheroid_sersicnerr: float = -1
    flux_disk: float = -1
    fluxerr_disk: float = -1
    mag_disk: float = -1
    magerr_disk: float = -1
    flux_max_disk: float = -1
    mu_max_disk: float = -1
    flux_eff_disk: float = -1
    mu_eff_disk: float = -1
    flux_mean_disk: float = -1
    mu_mean_disk: float = -1
    fluxratio_disk: float = -1
    fluxratioerr_disk: float = -1
    disk_scale_image: float = -1
    disk_scaleerr_image: float = -1
    disk_scale_world: float = -1
    disk_scaleerr_world: float = -1
    disk_aspect_image: float = -1
    disk_aspecterr_image: float = -1
    disk_aspect_world: float = -1
    disk_aspecterr_world: float = -1
    disk_inclination: float = -1
    disk_inclinationerr: float = -1
    disk_theta_image: float = -1
    disk_thetaerr_image: float = -1
    disk_theta_world: float = -1
    disk_thetaerr_world: float = -1
    disk_theta_j2000: float = -1    
    NS8HIdx: int = 0
    NS16HIdx: int = 0
    NS32HIdx: int = 0
    NS64HIdx: int = 0
    create_time: str = ''