Skip to content

Commit

Permalink
update a few things (wgs-72->84, and float64 precision)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sceki committed Dec 10, 2023
1 parent 78c48e3 commit e84b1ac
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 14 deletions.
2 changes: 2 additions & 0 deletions dsgp4/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
from .sgp4_batched import sgp4_batched
from . import tle
from .tle import TLE
import torch
torch.set_default_dtype(torch.float64)
2 changes: 0 additions & 2 deletions dsgp4/initl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

from . import util

torch.set_default_dtype(torch.float64)

def initl(
xke, j2,
ecco, epoch, inclo, no,
Expand Down
1 change: 0 additions & 1 deletion dsgp4/newton_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from .sgp4init import sgp4init
from . import util
from .tle import TLE
#torch.set_default_dtype(torch.float64)

def initial_guess(tle_0, time_mjd, target_state=None):
"""
Expand Down
2 changes: 1 addition & 1 deletion dsgp4/sgp4.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy
import torch
#torch.set_default_dtype(torch.float64)
torch.set_default_dtype(torch.float64)

#@torch.jit.script
def sgp4(satellite, tsince):
Expand Down
1 change: 0 additions & 1 deletion dsgp4/sgp4init.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import torch
from .initl import initl
from .sgp4 import sgp4
#torch.set_default_dtype(torch.float64)

def sgp4init(
whichconst, opsmode, satn, epoch,
Expand Down
7 changes: 2 additions & 5 deletions dsgp4/tle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
import torch

from . import util

from sgp4.earth_gravity import wgs84
#torch.set_default_dtype(torch.float64)

MU_EARTH = wgs84.mu*1e9
_, MU_EARTH, _, _, _, _, _, _=util.get_gravity_constants('wgs-84')
MU_EARTH = MU_EARTH*1e9

# This function is from python-sgp4 released under MIT License, (c) 2012–2016 Brandon Rhodes
def compute_checksum(line):
Expand Down
2 changes: 0 additions & 2 deletions dsgp4/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import numpy as np
import torch

#torch.set_default_dtype(torch.float64)

def get_gravity_constants(gravity_constant_name):
if gravity_constant_name == 'wgs-72old':
mu = 398600.79964 # in km3 / s2
Expand Down
4 changes: 2 additions & 2 deletions tests/test_differentiability.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_velocity(self):
data.append(lines[i+1])
data.append(lines[i+2])
tles.append(dsgp4.tle.TLE(data))
whichconst=dsgp4.util.get_gravity_constants("wgs-72")
whichconst=dsgp4.util.get_gravity_constants("wgs-84")
#I filter out deep space and error cases:
tles_filtered=[]
for idx, tle_satellite in enumerate(tles):
Expand Down Expand Up @@ -98,7 +98,7 @@ def test_input_gradients(self):
data.append(lines[i+1])
data.append(lines[i+2])
tles.append(dsgp4.tle.TLE(data))
whichconst=dsgp4.util.get_gravity_constants("wgs-72")
whichconst=dsgp4.util.get_gravity_constants("wgs-84")
#I filter out deep space and error cases:
tles_filtered=[]
for idx, tle_satellite in enumerate(tles):
Expand Down

0 comments on commit e84b1ac

Please sign in to comment.