Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-dfs
csst-dfs-api-cluster
Commits
7eb699f1
Commit
7eb699f1
authored
Jan 04, 2023
by
Wei Shoulin
Browse files
bytes
parent
01dd1c48
Changes
1
Show whitespace changes
Inline
Side-by-side
csst_dfs_api_cluster/common/catalog.py
View file @
7eb699f1
import
grpc
import
grpc
import
pickle
from
collections
import
deque
from
collections
import
deque
import
logging
import
logging
from
csst_dfs_commons.models
import
Result
from
csst_dfs_commons.models
import
Result
...
@@ -27,7 +28,7 @@ class CatalogApi(object):
...
@@ -27,7 +28,7 @@ class CatalogApi(object):
return: csst_dfs_common.models.Result
return: csst_dfs_common.models.Result
'''
'''
try
:
try
:
records
=
deque
([]
)
datas
=
bytearray
(
)
totalCount
=
0
totalCount
=
0
for
resp
in
self
.
stub
.
Gaia3Search
(
ephem_pb2
.
EphemSearchRequest
(
for
resp
in
self
.
stub
.
Gaia3Search
(
ephem_pb2
.
EphemSearchRequest
(
ra
=
ra
,
ra
=
ra
,
...
@@ -41,10 +42,174 @@ class CatalogApi(object):
...
@@ -41,10 +42,174 @@ class CatalogApi(object):
if
resp
.
success
:
if
resp
.
success
:
# data = from_proto_model_list(Gaia3Record, resp.records)
# data = from_proto_model_list(Gaia3Record, resp.records)
data
=
resp
.
records
data
=
resp
.
records
record
s
.
extend
(
data
)
data
s
.
extend
(
data
)
totalCount
=
resp
.
totalCount
totalCount
=
resp
.
totalCount
else
:
else
:
return
Result
.
error
(
message
=
str
(
resp
.
error
.
detail
))
return
Result
.
error
(
message
=
str
(
resp
.
error
.
detail
))
return
Result
.
ok_data
(
data
=
list
(
records
)).
append
(
"totalCount"
,
totalCount
)
records
=
pickle
.
loads
(
datas
)
ret_records2
=
[]
for
r
in
records
:
rec
=
Gaia3Record
(
SolutionId
=
r
[
0
],
Designation
=
r
[
1
],
SourceId
=
r
[
2
],
RandomIndex
=
r
[
3
],
RefEpoch
=
r
[
4
],
Ra
=
r
[
5
],
RaError
=
r
[
6
],
Dec
=
r
[
7
],
DecError
=
r
[
8
],
Parallax
=
r
[
9
],
ParallaxError
=
r
[
10
],
ParallaxOverError
=
r
[
11
],
Pm
=
r
[
12
],
Pmra
=
r
[
13
],
PmraError
=
r
[
14
],
Pmdec
=
r
[
15
],
PmdecError
=
r
[
16
],
RaDecCorr
=
r
[
17
],
RaParallaxCorr
=
r
[
18
],
RaPmraCorr
=
r
[
19
],
RaPmdecCorr
=
r
[
20
],
DecParallaxCorr
=
r
[
21
],
DecPmraCorr
=
r
[
22
],
DecPmdecCorr
=
r
[
23
],
ParallaxPmraCorr
=
r
[
24
],
ParallaxPmdecCorr
=
r
[
25
],
PmraPmdecCorr
=
r
[
26
],
AstrometricNObsAl
=
r
[
27
],
AstrometricNObsAc
=
r
[
28
],
AstrometricNGoodObsAl
=
r
[
29
],
AstrometricNBadObsAl
=
r
[
30
],
AstrometricGofAl
=
r
[
31
],
AstrometricChi2Al
=
r
[
32
],
AstrometricExcessNoise
=
r
[
33
],
AstrometricExcessNoiseSig
=
r
[
34
],
AstrometricParamsSolved
=
r
[
35
],
AstrometricPrimaryFlag
=
r
[
36
],
NuEffUsedInAstrometry
=
r
[
37
],
Pseudocolour
=
r
[
38
],
PseudocolourError
=
r
[
39
],
RaPseudocolourCorr
=
r
[
40
],
DecPseudocolourCorr
=
r
[
41
],
ParallaxPseudocolourCorr
=
r
[
42
],
PmraPseudocolourCorr
=
r
[
43
],
PmdecPseudocolourCorr
=
r
[
44
],
AstrometricMatchedTransits
=
r
[
45
],
VisibilityPeriodsUsed
=
r
[
46
],
AstrometricSigma5dMax
=
r
[
47
],
MatchedTransits
=
r
[
48
],
NewMatchedTransits
=
r
[
49
],
MatchedTransitsRemoved
=
r
[
50
],
IpdGofHarmonicAmplitude
=
r
[
51
],
IpdGofHarmonicPhase
=
r
[
52
],
IpdFracMultiPeak
=
r
[
53
],
IpdFracOddWin
=
r
[
54
],
Ruwe
=
r
[
55
],
ScanDirectionStrengthK1
=
r
[
56
],
ScanDirectionStrengthK2
=
r
[
57
],
ScanDirectionStrengthK3
=
r
[
58
],
ScanDirectionStrengthK4
=
r
[
59
],
ScanDirectionMeanK1
=
r
[
60
],
ScanDirectionMeanK2
=
r
[
61
],
ScanDirectionMeanK3
=
r
[
62
],
ScanDirectionMeanK4
=
r
[
63
],
DuplicatedSource
=
r
[
64
],
PhotGNObs
=
r
[
65
],
PhotGMeanFlux
=
r
[
66
],
PhotGMeanFluxError
=
r
[
67
],
PhotGMeanFluxOverError
=
r
[
68
],
PhotGMeanMag
=
r
[
69
],
PhotBpNObs
=
r
[
70
],
PhotBpMeanFlux
=
r
[
71
],
PhotBpMeanFluxError
=
r
[
72
],
PhotBpMeanFluxOverError
=
r
[
73
],
PhotBpMeanMag
=
r
[
74
],
PhotRpNObs
=
r
[
75
],
PhotRpMeanFlux
=
r
[
76
],
PhotRpMeanFluxError
=
r
[
77
],
PhotRpMeanFluxOverError
=
r
[
78
],
PhotRpMeanMag
=
r
[
79
],
PhotBpRpExcessFactor
=
r
[
80
],
PhotBpNContaminatedTransits
=
r
[
81
],
PhotBpNBlendedTransits
=
r
[
82
],
PhotRpNContaminatedTransits
=
r
[
83
],
PhotRpNBlendedTransits
=
r
[
84
],
PhotProcMode
=
r
[
85
],
BpRp
=
r
[
86
],
BpG
=
r
[
87
],
GRp
=
r
[
88
],
RadialVelocity
=
r
[
89
],
RadialVelocityError
=
r
[
90
],
RvMethodUsed
=
r
[
91
],
RvNbTransits
=
r
[
92
],
RvNbDeblendedTransits
=
r
[
93
],
RvVisibilityPeriodsUsed
=
r
[
94
],
RvExpectedSigToNoise
=
r
[
95
],
RvRenormalisedGof
=
r
[
96
],
RvChisqPvalue
=
r
[
97
],
RvTimeDuration
=
r
[
98
],
RvAmplitudeRobust
=
r
[
99
],
RvTemplateTeff
=
r
[
100
],
RvTemplateLogg
=
r
[
101
],
RvTemplateFeH
=
r
[
102
],
RvAtmParamOrigin
=
r
[
103
],
Vbroad
=
r
[
104
],
VbroadError
=
r
[
105
],
VbroadNbTransits
=
r
[
106
],
GrvsMag
=
r
[
107
],
GrvsMagError
=
r
[
108
],
GrvsMagNbTransits
=
r
[
109
],
RvsSpecSigToNoise
=
r
[
110
],
PhotVariableFlag
=
r
[
111
],
L
=
r
[
112
],
B
=
r
[
113
],
EclLon
=
r
[
114
],
EclLat
=
r
[
115
],
InQsoCandidates
=
r
[
116
],
InGalaxyCandidates
=
r
[
117
],
NonSingleStar
=
r
[
118
],
HasXpContinuous
=
r
[
119
],
HasXpSampled
=
r
[
120
],
HasRvs
=
r
[
121
],
HasEpochPhotometry
=
r
[
122
],
HasEpochRv
=
r
[
123
],
HasMcmcGspphot
=
r
[
124
],
HasMcmcMsc
=
r
[
125
],
InAndromedaSurvey
=
r
[
126
],
ClassprobDscCombmodQuasar
=
r
[
127
],
ClassprobDscCombmodGalaxy
=
r
[
128
],
ClassprobDscCombmodStar
=
r
[
129
],
TeffGspphot
=
r
[
130
],
TeffGspphotLower
=
r
[
131
],
TeffGspphotUpper
=
r
[
132
],
LoggGspphot
=
r
[
133
],
LoggGspphotLower
=
r
[
134
],
LoggGspphotUpper
=
r
[
135
],
MhGspphot
=
r
[
136
],
MhGspphotLower
=
r
[
137
],
MhGspphotUpper
=
r
[
138
],
DistanceGspphot
=
r
[
139
],
DistanceGspphotLower
=
r
[
140
],
DistanceGspphotUpper
=
r
[
141
],
AzeroGspphot
=
r
[
142
],
AzeroGspphotLower
=
r
[
143
],
AzeroGspphotUpper
=
r
[
144
],
AgGspphot
=
r
[
145
],
AgGspphotLower
=
r
[
146
],
AgGspphotUpper
=
r
[
147
],
EbpminrpGspphot
=
r
[
148
],
EbpminrpGspphotLower
=
r
[
149
],
EbpminrpGspphotUpper
=
r
[
150
],
LibnameGspphot
=
r
[
151
],
NS8HIdx
=
r
[
152
],
NS16HIdx
=
r
[
153
],
NS32HIdx
=
r
[
154
],
NS64HIdx
=
r
[
155
],
FileIdx
=
r
[
156
])
ret_records2
.
append
(
rec
)
return
Result
.
ok_data
(
data
=
ret_records2
).
append
(
"totalCount"
,
totalCount
)
except
grpc
.
RpcError
as
e
:
except
grpc
.
RpcError
as
e
:
return
Result
.
error
(
message
=
"%s:%s"
%
(
e
.
code
().
value
,
e
.
details
()))
return
Result
.
error
(
message
=
"%s:%s"
%
(
e
.
code
().
value
,
e
.
details
()))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment