Commit 907aeaca authored by Wei Shoulin's avatar Wei Shoulin
Browse files

PI

parent 13703726
Pipeline #3218 passed with stage
......@@ -8,6 +8,7 @@ from ..common.utils import *
from csst_dfs_commons.models import Result
from csst_dfs_commons.models.ifs import Level1Record
from csst_dfs_commons.models.common import from_dict_list
from csst_dfs_commons.models.models import constants
from csst_dfs_commons.utils.fits import get_header_value, get_healpix_id, get_healpix_ids
log = logging.getLogger('csst')
......@@ -18,7 +19,7 @@ class Level1DataApi(object):
self.db = DBClient()
def make_sql_heapix(self, ra, dec, radius, ra_column, dec_column, hpix_column):
arcDec = (PI / 180) * dec
arcDec = (constants.PI / 180) * dec
whereSql = f"abs((180./pi()) * ACOS(SIN(pi() * {dec_column}/180) * SIN({arcDec}) + COS(pi() * {dec_column}/180) * COS({arcDec}) * COS((pi()/180) * ({ra_column} - {ra})))) < {radius}"
heapix_ids = get_healpix_ids(ra, dec, radius, 128)
......@@ -140,7 +141,7 @@ class Level1DataApi(object):
)
self.db.end()
return Result.ok_data()
except Exception as e:
log.error(e)
return Result.error(message=str(e))
......
......@@ -126,7 +126,7 @@ class Level2DataApi(object):
)
self.db.end()
return Result.ok_data()
except Exception as e:
log.error(e)
return Result.error(message=str(e))
......
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