Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
Orekit Python Wrapper
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
Container registry
Model registry
Operate
Environments
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 Labs
Orekit Python Wrapper
Commits
28aec2fa
Commit
28aec2fa
authored
10 years ago
by
Petrus Hyvönen
Browse files
Options
Downloads
Patches
Plain Diff
Added Example of plain python usage of orekit through a translated NodeDetectorTest
parent
8fdce066
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/NodeDetectorTest.py
+105
-0
105 additions, 0 deletions
examples/NodeDetectorTest.py
with
105 additions
and
0 deletions
examples/NodeDetectorTest.py
0 → 100644
+
105
−
0
View file @
28aec2fa
"""
This is a Python translation of the java NodeDetectorTest.java that is part of the orekit test suite.
/* Copyright 2002-2013 CS mes d
'
Information (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.
*/
Modifications and translation to python by Petrus Hyvonen, SSC 2014
"""
import
orekit
orekit
.
initVM
()
from
orekit
import
JArray_double
from
orekit.pyhelpers
import
setup_orekit_curdir
from
math
import
radians
from
org.orekit.propagation.events
import
EventsLogger
from
org.orekit.propagation.events
import
NodeDetector
from
org.apache.commons.math3.ode.nonstiff
import
DormandPrince853Integrator
;
from
org.orekit.frames
import
FramesFactory
;
from
org.orekit.orbits
import
KeplerianOrbit
;
from
org.orekit.orbits
import
PositionAngle
;
from
org.orekit.propagation
import
SpacecraftState
;
from
org.orekit.propagation.events.handlers
import
ContinueOnEvent
;
from
org.orekit.propagation.numerical
import
NumericalPropagator
;
from
org.orekit.time
import
AbsoluteDate
;
from
org.orekit.time
import
TimeScalesFactory
;
from
org.orekit.utils
import
Constants
;
setup_orekit_curdir
()
# orekit-data.zip shall be in current dir
# Floats are needed to be specific in the orekit interface
a
=
800000.0
+
Constants
.
WGS84_EARTH_EQUATORIAL_RADIUS
;
e
=
0.0001
;
i
=
radians
(
98.0
);
w
=
-
90.0
;
raan
=
0.0
;
v
=
0.0
;
inertialFrame
=
FramesFactory
.
getEME2000
();
initialDate
=
AbsoluteDate
(
2014
,
01
,
01
,
0
,
0
,
0.0
,
TimeScalesFactory
.
getUTC
());
finalDate
=
initialDate
.
shiftedBy
(
5000.0
);
initialOrbit
=
KeplerianOrbit
(
a
,
e
,
i
,
w
,
raan
,
v
,
PositionAngle
.
TRUE
,
inertialFrame
,
initialDate
,
Constants
.
WGS84_EARTH_MU
);
initialState
=
SpacecraftState
(
initialOrbit
,
1000.0
);
tol
=
NumericalPropagator
.
tolerances
(
10.0
,
initialOrbit
,
initialOrbit
.
getType
());
# Double array of doubles needs to be retyped to work
integrator
=
DormandPrince853Integrator
(
0.001
,
1000.0
,
JArray_double
.
cast_
(
tol
[
0
]),
JArray_double
.
cast_
(
tol
[
1
]))
propagator
=
NumericalPropagator
(
integrator
);
propagator
.
setInitialState
(
initialState
);
# Define 2 instances of NodeDetector:
rawDetector
=
NodeDetector
(
1e-6
,
initialState
.
getOrbit
(),
initialState
.
getFrame
()).
withHandler
(
ContinueOnEvent
().
of_
(
NodeDetector
))
# Converted withHandler(ContinueOnEvent<NodeDetector>());
logger1
=
EventsLogger
();
node1
=
logger1
.
monitorDetector
(
rawDetector
);
logger2
=
EventsLogger
();
node2
=
logger2
.
monitorDetector
(
rawDetector
);
propagator
.
addEventDetector
(
node1
);
propagator
.
addEventDetector
(
node2
);
# First propagation
propagator
.
setEphemerisMode
();
propagator
.
propagate
(
finalDate
);
assert
2
==
logger1
.
getLoggedEvents
().
size
()
assert
2
==
logger2
.
getLoggedEvents
().
size
();
logger1
.
clearLoggedEvents
();
logger2
.
clearLoggedEvents
();
postpro
=
propagator
.
getGeneratedEphemeris
();
# Post-processing
postpro
.
addEventDetector
(
node1
);
postpro
.
addEventDetector
(
node2
);
postpro
.
propagate
(
finalDate
);
assert
2
==
logger1
.
getLoggedEvents
().
size
()
assert
2
==
logger2
.
getLoggedEvents
().
size
()
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