Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
orekit_jpype
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Orekit
orekit_jpype
Commits
35d0e1c9
Commit
35d0e1c9
authored
1 year ago
by
Petrus Hyvönen
Browse files
Options
Downloads
Patches
Plain Diff
Add EphemerisEventsTest class and LeastSquaresTleGenerationAlgorithmTest class
parent
e57c60fe
No related branches found
No related tags found
1 merge request
!5
Additional tests
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/EphemerisEventsTest.py
+0
-1
0 additions, 1 deletion
test/EphemerisEventsTest.py
test/LeastSquaresTleGenerationAlgorithmTest.py
+92
-0
92 additions, 0 deletions
test/LeastSquaresTleGenerationAlgorithmTest.py
with
92 additions
and
1 deletion
test/EphemerisEventsTest.py
+
0
−
1
View file @
35d0e1c9
...
...
@@ -49,7 +49,6 @@ from java.util import ArrayList
@JImplements
(
EventHandler
)
class
myContinueOnEvent
(
object
):
def
__init__
(
self
,
outer_instance
,
orb_type
)
->
None
:
self
.
outer_instance
=
outer_instance
self
.
orb_type
=
orb_type
...
...
This diff is collapsed.
Click to expand it.
test/LeastSquaresTleGenerationAlgorithmTest.py
0 → 100644
+
92
−
0
View file @
35d0e1c9
"""
original copyright:
/* Copyright 2002-2024 CS GROUP
* Licensed to CS GROUP (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the
"
License
"
); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an
"
AS IS
"
BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Python version translated from Java by Petrus Hyvönen and copilot, 2024
"""
import
unittest
import
jpype
from
orekit_jpype
import
initVM
initVM
()
from
orekit_jpype.pyhelpers
import
setup_orekit_curdir
setup_orekit_curdir
(
"
resources
"
)
# all orekit imports needs to come after the JVM is initialized
from
org.orekit.propagation
import
Propagator
,
SpacecraftState
from
org.orekit.propagation.analytical.tle
import
TLE
,
TLEPropagator
from
org.orekit.propagation.analytical.tle.generation
import
LeastSquaresTleGenerationAlgorithm
class
LeastSquaresTleGenerationAlgorithmTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
geoTLE
=
TLE
(
"
1 27508U 02040A 12021.25695307 -.00000113 00000-0 10000-3 0 7326
"
,
"
2 27508 0.0571 356.7800 0005033 344.4621 218.7816 1.00271798 34501
"
)
self
.
leoTLE
=
TLE
(
"
1 31135U 07013A 11003.00000000 .00000816 00000+0 47577-4 0 11
"
,
"
2 31135 2.4656 183.9084 0021119 236.4164 60.4567 15.10546832 15
"
)
def
testConversionLeo
(
self
):
self
.
checkConversion
(
self
.
leoTLE
,
1.0e-12
,
3.755238453429068E-9
)
def
testConversionGeo
(
self
):
self
.
checkConversion
(
self
.
geoTLE
,
1.0e-12
,
3.135996497102161E-9
)
def
checkConversion
(
self
,
tle
,
threshold
,
rms
):
p
=
TLEPropagator
.
selectExtrapolator
(
tle
)
converter
=
LeastSquaresTleGenerationAlgorithm
()
converted
=
converter
.
generate
(
p
.
getInitialState
(),
tle
)
self
.
assertEqual
(
tle
.
getSatelliteNumber
(),
converted
.
getSatelliteNumber
())
self
.
assertEqual
(
tle
.
getClassification
(),
converted
.
getClassification
())
self
.
assertEqual
(
tle
.
getLaunchYear
(),
converted
.
getLaunchYear
())
self
.
assertEqual
(
tle
.
getLaunchNumber
(),
converted
.
getLaunchNumber
())
self
.
assertEqual
(
tle
.
getLaunchPiece
(),
converted
.
getLaunchPiece
())
self
.
assertEqual
(
tle
.
getElementNumber
(),
converted
.
getElementNumber
())
self
.
assertEqual
(
tle
.
getRevolutionNumberAtEpoch
(),
converted
.
getRevolutionNumberAtEpoch
())
self
.
assertAlmostEqual
(
tle
.
getMeanMotion
(),
converted
.
getMeanMotion
(),
delta
=
threshold
*
tle
.
getMeanMotion
())
self
.
assertAlmostEqual
(
tle
.
getE
(),
converted
.
getE
(),
delta
=
threshold
*
tle
.
getE
())
self
.
assertAlmostEqual
(
tle
.
getI
(),
converted
.
getI
(),
delta
=
threshold
*
tle
.
getI
())
self
.
assertAlmostEqual
(
tle
.
getPerigeeArgument
(),
converted
.
getPerigeeArgument
(),
delta
=
threshold
*
tle
.
getPerigeeArgument
())
self
.
assertAlmostEqual
(
tle
.
getRaan
(),
converted
.
getRaan
(),
delta
=
threshold
*
tle
.
getRaan
())
self
.
assertAlmostEqual
(
tle
.
getMeanAnomaly
(),
converted
.
getMeanAnomaly
(),
delta
=
threshold
*
tle
.
getMeanAnomaly
())
self
.
assertAlmostEqual
(
converter
.
getRms
(),
rms
,
delta
=
threshold
)
def
testIssue864
(
self
):
tleISS
=
TLE
(
"
1 25544U 98067A 21035.14486477 .00001026 00000-0 26816-4 0 9998
"
,
"
2 25544 51.6455 280.7636 0002243 335.6496 186.1723 15.48938788267977
"
)
propagator
=
TLEPropagator
.
selectExtrapolator
(
tleISS
)
state
=
propagator
.
propagate
(
tleISS
.
getDate
())
# TODO Check that these lambda functions are really working
tleISS
.
getParametersDrivers
().
forEach
(
lambda
driver
:
driver
.
setSelected
(
True
))
rebuilt
=
LeastSquaresTleGenerationAlgorithm
().
generate
(
state
,
tleISS
)
rebuilt
.
getParametersDrivers
().
forEach
(
lambda
driver
:
self
.
assertTrue
(
driver
.
isSelected
()))
if
__name__
==
'
__main__
'
:
unittest
.
main
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment