Skip to content

Commit

Permalink
Set covariance matrices to nulls in horizons.py so they can be loaded…
Browse files Browse the repository at this point in the history
… from parquet (#74)
  • Loading branch information
moeyensj authored Oct 4, 2023
1 parent 5107747 commit c2ac69a
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 94 deletions.
17 changes: 17 additions & 0 deletions adam_core/orbits/query/horizons.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import numpy.typing as npt
import pandas as pd
import pyarrow as pa
from astropy.time import Time
from astroquery.jplhorizons import Horizons

from ...coordinates.cartesian import CartesianCoordinates
from ...coordinates.cometary import CometaryCoordinates
from ...coordinates.covariances import CoordinateCovariances
from ...coordinates.keplerian import KeplerianCoordinates
from ...coordinates.origin import Origin
from ...coordinates.times import Times
Expand Down Expand Up @@ -281,6 +283,11 @@ def query_horizons(
vx=vectors["vx"].values,
vy=vectors["vy"].values,
vz=vectors["vz"].values,
covariance=CoordinateCovariances.from_kwargs(
values=pa.FixedSizeListArray.from_arrays(
pa.nulls(36 * len(vectors), pa.float64()), 36
)
),
origin=origin,
frame=frame,
)
Expand Down Expand Up @@ -312,6 +319,11 @@ def query_horizons(
raan=elements["Omega"].values,
ap=elements["w"].values,
M=elements["M"].values,
covariance=CoordinateCovariances.from_kwargs(
values=pa.FixedSizeListArray.from_arrays(
pa.nulls(36 * len(elements), pa.float64()), 36
)
),
origin=origin,
frame=frame,
)
Expand Down Expand Up @@ -346,6 +358,11 @@ def query_horizons(
raan=elements["Omega"].values,
ap=elements["w"].values,
tp=tp.tdb.mjd,
covariance=CoordinateCovariances.from_kwargs(
values=pa.FixedSizeListArray.from_arrays(
pa.nulls(36 * len(elements), pa.float64()), 36
)
),
origin=origin,
frame=frame,
)
Expand Down
2 changes: 1 addition & 1 deletion adam_core/utils/helpers/data/elements_ssb_ec.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
targetname,mjd_tdb,x,y,z,vx,vy,vz,a,q,Q,e,incl,Omega,w,M,nu,n,P,tp_mjd
594913 'Aylo'chaxnim (2020 AV2),59067.0,-0.3346633022022236,-0.3154666209776532,-0.07996422642394325,0.01761931036388487,-0.0196263486936723,-0.006124645953286933,0.5524469309070114,0.4603525438797309,0.6445413179342917,0.1667026855884223,16.00153601890837,5.986910320609024,192.995936607174,18.07216959735763,25.42295050360318,2.401924806571488,149.8797959932245,59059.47596363211
594913 'Aylo'chaxnim (2020 AV2),59092.0,0.2350620334641448,-0.4758803704035668,-0.1441404420966112,0.02212401555796387,0.006050247470152032,0.0009745764001468232,0.5382804121501946,0.4445937654854049,0.6319670588149844,0.1740480324939795,16.06900474417836,6.81199262933302,181.748698873032,87.28811902805471,107.0197892026938,2.497367127723423,144.1518133251689,59057.0479426682
163693 Atira (2003 CP20),57349.0,-0.8455854080363936,0.2916765145334362,0.3616281158567583,-0.004710050081368693,-0.01326552187185236,0.003723576726238835,0.736707232223351,0.4972650315602637,0.9761494328864383,0.3250167640413423,25.69477345730213,103.8022684612911,252.5060772291329,156.6369687838786,167.3168092283852,1.559742317925834,230.8073557167653,57248.57509840978
(2010 TK7),56757.0,-0.3949515874100206,-0.9046576587404982,0.189299307226249,0.01297345877482713,-0.01026341821793153,-0.004472340144324559,1.001176129604831,0.808479063569891,1.193873195639771,0.1924706955518391,20.89590474321111,96.56772675688507,45.88668183340936,80.14138406087875,102.2398069415879,0.9845312953033696,365.6562282147374,56675.59945494495
3753 Cruithne (1986 TO),57019.0,-0.4566700607212433,-0.1213889435941199,0.1589992741725308,0.004399351561255793,-0.02900161695781203,0.004900097131421712,0.9740678229586223,0.4807591782671624,1.467376467650082,0.5064417826605647,19.856568451791,126.1781399904704,43.22204533554362,7.714550559040962,26.64706377025171,1.025915188317263,350.9061997517386,57011.48032327881
Expand Down
2 changes: 1 addition & 1 deletion adam_core/utils/helpers/data/elements_ssb_eq.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
targetname,mjd_tdb,x,y,z,vx,vy,vz,a,q,Q,e,incl,Omega,w,M,nu,n,P,tp_mjd
594913 'Aylo'chaxnim (2020 AV2),59067.0,-0.3346633022022236,-0.2576270233653624,-0.1988511586351483,0.01761931036388487,-0.01557057862197088,-0.01342616596336236,0.5524469309070114,0.4603525438797309,0.6445413179342917,0.1667026855884223,39.38685629389383,2.596997289427206,196.7447502574536,18.07216959735758,25.42295050360318,2.401924806571488,149.8797959932245,59059.47596363211
594913 'Aylo'chaxnim (2020 AV2),59092.0,0.2350620334641448,-0.3792759284241518,-0.3215406103453187,0.02212401555796387,0.005163329296255171,0.003300806596611998,0.5382804121501944,0.4445937654854047,0.6319670588149842,0.1740480324939795,39.43824437084606,2.962511499532844,186.0080988867252,87.28811902805477,107.0197892026939,2.497367127723424,144.1518133251688,59057.0479426682
163693 Atira (2003 CP20),57349.0,-0.8455854080363936,0.1237605665807708,0.4478095638416953,-0.004710050081368693,-0.01365203212146848,-0.001860406709075608,0.736707232223351,0.4972650315602637,0.9761494328864383,0.3250167640413423,29.78401499574551,57.95753421534047,303.553412810831,156.6369687838786,167.3168092283852,1.559742317925834,230.8073557167653,57248.57509840978
(2010 TK7),56757.0,-0.3949515874100206,-0.9053061142562494,-0.1861734318436126,0.01297345877482713,-0.007637507367496675,-0.008185845166758271,1.001176129604831,0.808479063569891,1.193873195639771,0.1924706955518391,29.14774695381676,46.67583244305953,100.112272277414,80.14138406087875,102.2398069415879,0.9845312953033696,365.6562282147374,56675.59945494495
3753 Cruithne (1986 TO),57019.0,-0.4566700607212433,-0.1746184573567206,0.09759323319086828,0.004399351561255793,-0.02855761003052099,-0.007040429490429152,0.9740678229586222,0.4807591782671623,1.467376467650082,0.5064417826605647,19.49166012668609,55.25464403327928,117.4328010575045,7.714550559040962,26.64706377025171,1.025915188317263,350.9061997517384,57011.48032327881
Expand Down
2 changes: 1 addition & 1 deletion adam_core/utils/helpers/data/elements_sun_ec.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
targetname,mjd_tdb,x,y,z,vx,vy,vz,a,q,Q,e,incl,Omega,w,M,nu,n,P,tp_mjd
594913 'Aylo'chaxnim (2020 AV2),59067.0,-0.3290888456880441,-0.3222252917374724,-0.08003750922292563,0.01762707752320063,-0.01962193824247083,-0.00612487133649561,0.5554440667526338,0.4571551074226906,0.6537330260825771,0.1769556382239945,15.86810539792722,6.709591539982261,187.3240298152103,21.97053700969231,31.44459988945033,2.380913271825318,151.2024836268006,59057.77222288214
594913 'Aylo'chaxnim (2020 AV2),59092.0,0.2408285455011938,-0.4825255059208278,-0.144219329789287,0.0221316125545202,0.006054917160428607,0.0009743534518332266,0.5554455910158294,0.4571554446204091,0.6537357374112496,0.1769572897602119,15.86810138000258,6.709390551220379,187.324849679953,81.49254200766285,101.7902454936353,2.380903471218272,151.2031060275591,59057.77242925111
163693 Atira (2003 CP20),57349.0,-0.8492810152881867,0.2905407327682534,0.3617879858467837,-0.00471131381077333,-0.01327227480204085,0.003723615109784675,0.7410443486540733,0.5023353324478986,0.9797533648602479,0.3221251422262804,25.61890457457085,103.9169954995755,252.9436777691511,155.9960977440278,166.8926912820257,1.545033052027769,233.0047240915139,57248.033811904956
(2010 TK7),56757.0,-0.3965125476872755,-0.9026620320640499,0.1894055726688569,0.01296795225779864,-0.01026670588115361,-0.004472211963966921,0.9999463126125072,0.8093312204158842,1.19056140480913,0.1906253263723861,20.88682918608647,96.51335316631041,45.88501926997609,80.28087952740191,102.1654274639378,0.9856870459771354,365.2274841890849,56675.55337872682
3753 Cruithne (1986 TO),57019.0,-0.4594944254901928,-0.1205126025480139,0.1591359942408442,0.004395351743630334,-0.029006829120857,0.004900194759075884,0.9976736341168753,0.4840005959697306,1.51134667226402,0.5148708160478154,19.80763791688181,126.2449596560453,43.81204631897057,7.251022984718229,25.80629713626836,0.9890570233101041,363.98305812053,57011.66875133198
Expand Down
2 changes: 1 addition & 1 deletion adam_core/utils/helpers/data/elements_sun_eq.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
targetname,mjd_tdb,x,y,z,vx,vy,vz,a,q,Q,e,incl,Omega,w,M,nu,n,P,tp_mjd
594913 'Aylo'chaxnim (2020 AV2),59067.0,-0.3290888456880441,-0.2637988323275703,-0.2016068391213939,0.01762707752320063,-0.01556644245981615,-0.01342461837167812,0.5554440667526341,0.4571551074226906,0.6537330260825776,0.1769556382239945,39.23997503789563,2.894780589896767,191.5373636420385,21.97053700969221,31.44459988945028,2.380913271825316,151.2024836268008,59057.77222288214
594913 'Aylo'chaxnim (2020 AV2),59092.0,0.2408285455011938,-0.385341341339227,-0.3242562714951051,0.0221316125545202,0.005167702337065449,0.003302459541650804,0.5554455910158292,0.457155444620409,0.6537357374112495,0.1769572897602119,39.23997506833681,2.894693482070158,191.5380576422648,81.49254200766289,101.7902454936354,2.380903471218272,151.2031060275591,59057.77242925111
163693 Atira (2003 CP20),57349.0,-0.8492810152881867,0.1226549145548392,0.447504453649493,-0.00471131381077333,-0.01365824308188053,-0.001863057654225404,0.7410443486540734,0.5023353324478989,0.9797533648602481,0.3221251422262804,29.6977246947126,57.90132139075948,304.1432370938876,155.9960977440277,166.8926912820257,1.545033052027768,233.004724091514,57248.033811904956
(2010 TK7),56757.0,-0.3965125476872755,-0.9035174325435558,-0.1852821205025426,0.01296795225779864,-0.007640574726747167,-0.00818703532090557,0.999946312612507,0.809331220415884,1.19056140480913,0.1906253263723861,29.1581697702819,46.63744576771693,100.0933346808848,80.28087952740195,102.1654274639378,0.9856870459771357,365.2274841890847,56675.55337872682
3753 Cruithne (1986 TO),57019.0,-0.4594944254901928,-0.173868814286596,0.09806725985001717,0.004395351743630334,-0.02856243093066994,-0.007042413198199969,0.9976736341168753,0.4840005959697306,1.51134667226402,0.5148708160478154,19.45659575350449,55.13174958836535,118.2015226191687,7.251022984718229,25.80629713626836,0.9890570233101041,363.98305812053,57011.66875133198
Expand Down
Loading

0 comments on commit c2ac69a

Please sign in to comment.