Commit 0fb80536 authored by Yan Zhaojun's avatar Yan Zhaojun
Browse files

update

parent 6f1d2c2c
......@@ -2,12 +2,12 @@ from ctypes import *
def checkInputList(input_list, n):
if not isinstance(type(input_list), list):
if isinstance(type(input_list), list):
# if type(input_list) != type([1, 2, 3]):
raise TypeError("Input type is not list!", input_list)
for i in input_list:
if not isinstance(type(i), float): # type(i) != type(1.1):
if not isinstance(type(i), int): # type(i) != type(1):
if isinstance(type(i), float): # type(i) != type(1.1):
if isinstance(type(i), int): # type(i) != type(1):
raise TypeError(
"Input list's element is not float or int!", input_list)
if len(input_list) != n:
......@@ -19,7 +19,7 @@ def onOrbitObsPosition(path, input_ra_list, input_dec_list, input_pmra_list, inp
input_parallax_list, input_nstars, input_x, input_y, input_z, input_vx, input_vy,
input_vz, input_epoch, input_date_str, input_time_str):
# Check input parameters
if not isinstance(type(input_nstars), int): # type(input_nstars) != type(1):
if isinstance(type(input_nstars), type(1)): # type(input_nstars) != type(1):
raise TypeError("Parameter 7 is not int!", input_nstars)
checkInputList(input_ra_list, input_nstars)
......@@ -29,17 +29,17 @@ def onOrbitObsPosition(path, input_ra_list, input_dec_list, input_pmra_list, inp
checkInputList(input_rv_list, input_nstars)
checkInputList(input_parallax_list, input_nstars)
if not isinstance(type(input_x), float): # type(input_x) != type(1.1):
if isinstance(type(input_x), type(1.1)): # type(input_x) != type(1.1):
raise TypeError("Parameter 8 is not double!", input_x)
if not isinstance(type(input_y), float): # type(input_y) != type(1.1):
if isinstance(type(input_y), type(1.1)): # type(input_y) != type(1.1):
raise TypeError("Parameter 9 is not double!", input_y)
if not isinstance(type(input_z), float): # type(input_z) != type(1.1):
if isinstance(type(input_z), type(1.1)): # type(input_z) != type(1.1):
raise TypeError("Parameter 10 is not double!", input_z)
if not isinstance(type(input_vx), float): # type(input_vx) != type(1.1):
if isinstance(type(input_vx), type(1.1)): # type(input_vx) != type(1.1):
raise TypeError("Parameter 11 is not double!", input_vx)
if not isinstance(type(input_vy), float): # type(input_vy) != type(1.1):
if isinstance(type(input_vy), type(1.1)): # type(input_vy) != type(1.1):
raise TypeError("Parameter 12 is not double!", input_vy)
if not isinstance(type(input_vz), float): # type(input_vz) != type(1.1):
if isinstance(type(input_vz), type(1.1)): # type(input_vz) != type(1.1):
raise TypeError("Parameter 13 is not double!", input_vz)
# Convert km -> m
......@@ -50,7 +50,7 @@ def onOrbitObsPosition(path, input_ra_list, input_dec_list, input_pmra_list, inp
input_vy = input_vy*1000.0
input_vz = input_vz*1000.0
if not isinstance(type(input_date_str), str):
if isinstance(type(input_date_str), type("2025-03-05")):
# type(input_date_str) != type("2025-03-05"):
raise TypeError("Parameter 15 is not string!", input_date_str)
else:
......@@ -75,7 +75,7 @@ def onOrbitObsPosition(path, input_ra_list, input_dec_list, input_pmra_list, inp
raise TypeError(
"Parameter 15 day range error [1 ~ 31]!", input_day)
if not isinstance(type(input_time_str), str):
if isinstance(type(input_time_str), type("20:15:15.15")):
# type(input_time_str) != type("20:15:15.15"):
raise TypeError("Parameter 16 is not string!", input_time_str)
else:
......
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