Commit 2937a76b authored by Wei Shoulin's avatar Wei Shoulin
Browse files

add level0_id

parent ef568cfb
......@@ -16,7 +16,10 @@ def default_field(obj):
class Dict(dict):
__setattr__ = dict.__setitem__
__getattr__ = dict.__getitem__
__getattr__ = dict.__getitem__
def __init__(self, **args):
super(Dict, self).__init__()
self.update(args)
def dict_to_object(dictObj):
if not isinstance(dictObj, dict):
......
......@@ -81,10 +81,12 @@ class Level1PrcRecord(BaseModel):
@dataclasses.dataclass
class Level2Record(BaseModel):
id: int = 0
level0_id: str = ''
level1_id : int = 0
data_type: str=""
filename : str=""
file_path: str=""
obs_time: str=""
qc2_status: int = 0
qc2_time: str=""
prc_status: int = 0
......@@ -270,6 +272,138 @@ class Level2CatalogRecord(BaseModel):
NS64HIdx: int = 0
create_time: str = ''
@dataclasses.dataclass
class Level2CatalogRecordV2(BaseModel):
level2_id: int = 0
ID: str = ''
CCDNO: int = 0
objID: int = 0
X: float = -1
XErr: float = -1
Y: float = -1
YErr: float = -1
RA: float = -1
RAErr: float = -1
DEC: float = -1
DECErr: float = -1
A: float = -1
AErr: float = -1
B: float = -1
BErr: float = -1
PA: float = -1
PAErr: float = -1
Flag: int = 0
Flag_ISO: int = 0
Flag_ISO_Num: int = 0
FWHM: float = -1
AB: float = -1
E: float = -1
Flux_Kron: float = -1
FluxErr_Kron: float = -1
Mag_Kron: float = -1
MagErr_Kron: float = -1
Radius_Kron: float = -1
Sky: float = -1
Flux_Aper1: float = -1
FluxErr_Aper1: float = -1
Mag_Aper1: float = -1
MagErr_Aper1: float = -1
Flux_Aper2: float = -1
FluxErr_Aper2: float = -1
Mag_Aper2: float = -1
MagErr_Aper2: float = -1
Flux_Aper3: float = -1
FluxErr_Aper3: float = -1
Mag_Aper3: float = -1
MagErr_Aper3: float = -1
Flux_Aper4: float = -1
FluxErr_Aper4: float = -1
Mag_Aper4: float = -1
MagErr_Aper4: float = -1
Flux_Aper5: float = -1
FluxErr_Aper5: float = -1
Mag_Aper5: float = -1
MagErr_Aper5: float = -1
Flux_Aper6: float = -1
FluxErr_Aper6: float = -1
Mag_Aper6: float = -1
MagErr_Aper6: float = -1
Flux_Aper7: float = -1
FluxErr_Aper7: float = -1
Mag_Aper7: float = -1
MagErr_Aper7: float = -1
Flux_Aper8: float = -1
FluxErr_Aper8: float = -1
Mag_Aper8: float = -1
MagErr_Aper8: float = -1
Flux_Aper9: float = -1
FluxErr_Aper9: float = -1
Mag_Aper9: float = -1
MagErr_Aper9: float = -1
Flux_Aper10: float = -1
FluxErr_Aper10: float = -1
Mag_Aper10: float = -1
MagErr_Aper10: float = -1
Flux_Aper11: float = -1
FluxErr_Aper11: float = -1
Mag_Aper11: float = -1
MagErr_Aper11: float = -1
Flux_Aper12: float = -1
FluxErr_Aper12: float = -1
Mag_Aper12: float = -1
MagErr_Aper12: float = -1
Type: int = 0
R20: float = -1
R50: float = -1
R90: float = -1
X_PSF: float = -1
Y_PSF: float = -1
RA_PSF: float = -1
DEC_PSF: float = -1
Chi2_PSF: float = -1
Flux_PSF: float = -1
FluxErr_PSF: float = -1
Mag_PSF: float = -1
MagErr_PSF: float = -1
X_Model: float = -1
Y_Model: float = -1
RA_Model: float = -1
DEC_Model: float = -1
Chi2_Model: float = -1
Flag_Model: int = 0
Flux_Model: float = -1
FluxErr_Model: float = -1
Mag_Model: float = -1
MagErr_Model: float = -1
Flux_Bulge: float = -1
FluxErr_Bulge: float = -1
Mag_Bulge: float = -1
MagErr_Bulge: float = -1
Re_Bulge: float = -1
ReErr_Bulge: float = -1
E_Bulge: float = -1
EErr_Bulge: float = -1
PA_Bulge: float = -1
PAErr_Bulge: float = -1
Flux_Disk: float = -1
FluxErr_Disk: float = -1
Mag_Disk: float = -1
MagErr_Disk: float = -1
Re_Disk: float = -1
ReErr_Disk: float = -1
E_Disk: float = -1
EErr_Disk: float = -1
PA_Disk: float = -1
PAErr_Disk: float = -1
Ratio_Disk: float = -1
RatioErr_Disk: float = -1
Spread_Model: float = -1
SpreadErr_Model: float = -1
NS8HIdx: int = 0
NS16HIdx: int = 0
NS32HIdx: int = 0
NS64HIdx: int = 0
@dataclasses.dataclass
class Level2CoCatalogRecord(BaseModel):
level2_id: int = 0
......
......@@ -69,6 +69,7 @@ class Level1Record(BaseModel):
@dataclasses.dataclass
class Level2Spectra(BaseModel):
id: int = 0
level0_id: str = ''
spectra_id : str = ""
level1_id: int=0
region: str=""
......
from astropy_healpix import HEALPix
from astropy.coordinates import ICRS
from astropy import units as u
from astropy.coordinates import SkyCoord
def get_header_value(key: str, header, default_value = None):
try:
v = header[key]
......@@ -5,4 +10,9 @@ def get_header_value(key: str, header, default_value = None):
return v.strip()
return v
except Exception as e:
return default_value
\ No newline at end of file
return default_value
def get_healpix_id(ra, dec, nside=32):
hp = HEALPix(nside=nside, order='nested', frame=ICRS())
coord = SkyCoord(ra = ra * u.deg, dec = dec * u.deg, frame='icrs')
return hp.skycoord_to_healpix(coord)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment