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-commons
Commits
603c8b34
Commit
603c8b34
authored
Jul 29, 2024
by
Wei Shoulin
Browse files
dfs_heapix_sql_condition
parent
bf6b5596
Pipeline
#6458
passed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
csst_dfs_commons/utils/fits.py
View file @
603c8b34
...
@@ -92,7 +92,7 @@ def catalog_heapix_sql_condition(ra, dec, radius, ra_col = 'ra', dec_col = 'dec'
...
@@ -92,7 +92,7 @@ def catalog_heapix_sql_condition(ra, dec, radius, ra_col = 'ra', dec_col = 'dec'
return
whereSql
return
whereSql
def
level2
_heapix_sql_condition
(
ra
,
dec
,
radius
,
ra_col
=
'ra'
,
dec_col
=
'dec'
,
nside
=
DEFAULT_NSIDE
):
def
dfs
_heapix_sql_condition
(
ra
,
dec
,
radius
,
ra_col
=
'ra'
,
dec_col
=
'dec'
,
brick_col
=
"brick_id"
,
nside
=
DEFAULT_NSIDE
):
x2
=
f
"cos(pi()*
{
dec_col
}
/180.0)*cos(pi()*
{
ra_col
}
/180.0)"
x2
=
f
"cos(pi()*
{
dec_col
}
/180.0)*cos(pi()*
{
ra_col
}
/180.0)"
y2
=
f
"cos(pi()*
{
dec_col
}
/180.0)*sin(pi()*
{
ra_col
}
/180.0)"
y2
=
f
"cos(pi()*
{
dec_col
}
/180.0)*sin(pi()*
{
ra_col
}
/180.0)"
z2
=
f
"sin(pi()*
{
dec_col
}
/180.0)"
z2
=
f
"sin(pi()*
{
dec_col
}
/180.0)"
...
@@ -104,10 +104,9 @@ def level2_heapix_sql_condition(ra, dec, radius, ra_col = 'ra', dec_col = 'dec',
...
@@ -104,10 +104,9 @@ def level2_heapix_sql_condition(ra, dec, radius, ra_col = 'ra', dec_col = 'dec',
distance
=
f
"pow((
{
x2
}
-
{
x1
}
),2)+pow((
{
y2
}
-
{
y1
}
),2)+pow((
{
z2
}
-
{
z1
}
),2)"
distance
=
f
"pow((
{
x2
}
-
{
x1
}
),2)+pow((
{
y2
}
-
{
y1
}
),2)+pow((
{
z2
}
-
{
z1
}
),2)"
heapix_ids
=
get_healpix_ids
(
ra
,
dec
,
radius
,
nside
)
heapix_ids
=
get_healpix_ids
(
ra
,
dec
,
radius
,
nside
)
nside_column
=
"brick_id"
whereZoneSql
=
"%s in (%s)"
%
\
whereZoneSql
=
"%s in (%s)"
%
\
(
nside
_col
umn
,
','
.
join
([
str
(
i
)
for
i
in
heapix_ids
]))
(
brick
_col
,
','
.
join
([
str
(
i
)
for
i
in
heapix_ids
]))
whereSql
=
f
"
{
distance
}
<= 4*pow(pi()*
{
radius
}
/180.0/2, 2) and
{
whereZoneSql
}
"
whereSql
=
f
"
{
distance
}
<= 4*pow(pi()*
{
radius
}
/180.0/2, 2) and
{
whereZoneSql
}
"
return
whereSql
return
whereSql
\ No newline at end of file
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