From 606de4d205ba9885bfe668e63ae2291041752a28 Mon Sep 17 00:00:00 2001 From: "Acciarini, Giacomo (PG/R - Maths & Physics)" Date: Fri, 11 Oct 2024 10:47:09 +0200 Subject: [PATCH] initl unused variable minor fix --- dsgp4/initl.py | 3 +-- dsgp4/sgp4init.py | 4 ++-- dsgp4/sgp4init_batch.py | 9 ++++----- tests/test_initl.py | 6 +++--- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/dsgp4/initl.py b/dsgp4/initl.py index ec3d147..14175a7 100644 --- a/dsgp4/initl.py +++ b/dsgp4/initl.py @@ -6,8 +6,8 @@ def initl( xke, j2, ecco, epoch, inclo, no, - method, opsmode, + method='n', ): x2o3 = torch.tensor(2.0 / 3.0); @@ -34,7 +34,6 @@ def initl( ainv = 1.0 / ao; posq = po * po; rp = ao * (1.0 - ecco); - method = 'n'; if opsmode == 'a': # gst time diff --git a/dsgp4/sgp4init.py b/dsgp4/sgp4init.py index 907748c..4d06759 100644 --- a/dsgp4/sgp4init.py +++ b/dsgp4/sgp4init.py @@ -101,8 +101,8 @@ def sgp4init( cosio2,eccsq, omeosq, posq, rp, rteosq,sinio , satellite._gsto, ) = initl( - satellite._xke, satellite._j2, satellite._ecco, epoch, satellite._inclo, satellite._no_kozai, satellite._method, - satellite._operationmode + satellite._xke, satellite._j2, satellite._ecco, epoch, satellite._inclo, satellite._no_kozai, + satellite._operationmode, satellite._method ) satellite._a = torch.pow( satellite._no_unkozai*satellite._tumin , (-2.0/3.0) ) satellite._alta = satellite._a*(1.0 + satellite._ecco) - 1.0 diff --git a/dsgp4/sgp4init_batch.py b/dsgp4/sgp4init_batch.py index cf46536..8ed2893 100644 --- a/dsgp4/sgp4init_batch.py +++ b/dsgp4/sgp4init_batch.py @@ -6,8 +6,7 @@ def initl_batch( xke, j2, ecco, epoch, inclo, no, - method, - opsmode, batch_size + opsmode, batch_size, method='n', ): x2o3 = torch.full((batch_size,),2.0 / 3.0); @@ -34,7 +33,7 @@ def initl_batch( ainv = 1.0 / ao; posq = po * po; rp = ao * (1.0 - ecco); - method = ['n']*batch_size; + method = [method]*batch_size; if opsmode == 'a': # gst time @@ -161,8 +160,8 @@ def sgp4init_batch( cosio2,eccsq, omeosq, posq, rp, rteosq,sinio , satellite_batch._gsto, ) = initl_batch( - satellite_batch._xke, satellite_batch._j2, satellite_batch._ecco, epoch, satellite_batch._inclo, satellite_batch._no_kozai, satellite_batch._method, - satellite_batch._operationmode,batch_size + satellite_batch._xke, satellite_batch._j2, satellite_batch._ecco, epoch, satellite_batch._inclo, satellite_batch._no_kozai, + satellite_batch._operationmode, batch_size, satellite_batch._method ) satellite_batch._a = torch.pow( satellite_batch._no_unkozai*satellite_batch._tumin , (-2.0/3.0) ) satellite_batch._alta = satellite_batch._a*(1.0 + satellite_batch._ecco) - 1.0 diff --git a/tests/test_initl.py b/tests/test_initl.py index 50728b2..8978673 100644 --- a/tests/test_initl.py +++ b/tests/test_initl.py @@ -53,8 +53,8 @@ def test_initl(self): tle_sat_cosio2, tle_sat_eccsq, tle_sat_omeosq, tle_sat_posq, tle_sat_rp, tle_sat_rteosq, tle_sat_sinio , tle_sat_gsto, ) = dsgp4.initl( - xke, j2, tle_sat._ecco, (tle_sat._jdsatepoch+tle_sat._jdsatepochF)-2433281.5, tle_sat._inclo, tle_sat._no_kozai, 'n', - 'i' + xke, j2, tle_sat._ecco, (tle_sat._jdsatepoch+tle_sat._jdsatepochF)-2433281.5, tle_sat._inclo, tle_sat._no_kozai, + 'i', 'n' ); self.assertAlmostEqual(satrec_no_unkozai, float(tle_sat_no_unkozai)) self.assertTrue(satrec_method==tle_sat_method) @@ -80,7 +80,7 @@ def test_coverage(self): tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2=whichconst satrec_tumin, satrec_mu, satrec_radiusearthkm, satrec_xke, satrec_j2, satrec_j3, satrec_j4, satrec_j3oj2=sgp4.earth_gravity.wgs84 #I run the opsmode=='a' - dsgp4.initl(xke, j2, tle._ecco, (tle._jdsatepoch+tle._jdsatepochF)-2433281.5, tle._inclo, tle._no_kozai, 'n', 'a') + dsgp4.initl(xke, j2, tle._ecco, (tle._jdsatepoch+tle._jdsatepochF)-2433281.5, tle._inclo, tle._no_kozai, 'a', 'n') file=""" 0 COSMOS 2251 DEB