Commit fd301219 authored by Petrus Hyvönen's avatar Petrus Hyvönen
Browse files

Update preparing for 7.1 release version

parent d3ff5980
This diff is collapsed.
{
"metadata": {
"name": "",
"signature": "sha256:aacb18b7dc0a16b68f6bb2c8b830331f6433a8d1cf81eef28b99cb7162290d07"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
"cells": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Orekit in Python - The basics"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Orekit is an open-source library for a number of space related calculations such as:\n",
"\n",
"* Orbit Propagation\n",
"* Coordinate system transformations\n",
"* Time systems\n",
"\n",
"The orekit webpage can be accessed at http://www.orekit.org.\n",
"\n"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"The java - pyhon bridge"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The orekit library is written in java. For interactive work a bridge to Python has been made, which will be used in this tutorial."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The orekit java library has been wrapped using the open source JCC tool, that enables interaction with java objects from the Python ecosystem. Python has quick and high quality routines for plotting and a easily read code.\n",
"\n",
"<embed src=\"files/images/integration.svg\" type=\"image/svg+xml\" />"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Initiating orekit in python"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Orekit needs to be initiated before used, partly setting up the Python - both the Java gateway and partly setting up access to the data needed for different orekit functions, such as the shape of the earth, leap time seconds etc."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First we need to intitilize the iPython notebook, that we want to use the inline pylab functionality and how large defalt plots should be. This is not orekit specific."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%pylab inline\n",
"figsize(15,15)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Populating the interactive namespace from numpy and matplotlib\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To start up the orekit JVM:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import orekit\n",
"vm = orekit.initVM()\n",
"print 'Java version:',vm.java_version"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Java version: 1.7.0_45\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The orekit library needs a data file with various information on time and earth rotation parameters. This file, called orekit-data.zip is loaded from current dir. A basic version of this file can be downloaded from the orekit [webpage](https://www.orekit.org/forge/projects/orekit/files).\n",
"\n",
"This routine is commonly used in the notebooks, so a python specific function is created for this, setup_orekit_curdir()"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from orekit.pyhelpers import setup_orekit_curdir\n",
"setup_orekit_curdir()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we are set up to import and use objects from the orekit library."
"cell_type": "markdown",
"metadata": {},
"source": [
"# Orekit in Python - The basics"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Orekit is an open-source library for a number of space related calculations such as:\n",
"\n",
"* Orbit Propagation\n",
"* Coordinate system transformations\n",
"* Time systems\n",
"\n",
"The orekit webpage can be accessed at http://www.orekit.org.\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## The java - pyhon bridge"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The orekit library is written in java. For interactive work a bridge to Python has been made, which will be used in this tutorial."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The orekit java library has been wrapped using the open source JCC tool, that enables interaction with java objects from the Python ecosystem. Python has quick and high quality routines for plotting and a easily read code.\n",
"\n",
"<embed src=\"files/images/integration.svg\" type=\"image/svg+xml\" />"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Initiating orekit in python"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Orekit needs to be initiated before used, partly setting up the Python - both the Java gateway and partly setting up access to the data needed for different orekit functions, such as the shape of the earth, leap time seconds etc."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First we need to intitilize the iPython notebook, that we want to use the inline pylab functionality and how large defalt plots should be. This is not orekit specific."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Populating the interactive namespace from numpy and matplotlib\n"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from org.orekit.utils import Constants"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print Constants.WGS84_EARTH_EQUATORIAL_RADIUS"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"6378137.0\n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"SI base units are used in the library, such as seconds, meter, m/s"
}
],
"source": [
"%pylab inline\n",
"figsize(15,15)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To start up the orekit JVM:"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Java version: 1.8.0_25\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"*Petrus Hyv\u00f6nen, SSC, 2014*"
}
],
"source": [
"import orekit\n",
"vm = orekit.initVM()\n",
"print 'Java version:',vm.java_version"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The orekit library needs a data file with various information on time and earth rotation parameters. This file, called orekit-data.zip is loaded from current dir. A basic version of this file can be downloaded from the orekit [webpage](https://www.orekit.org/forge/projects/orekit/files).\n",
"\n",
"This routine is commonly used in the notebooks, so a python specific function is created for this, setup_orekit_curdir()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from orekit.pyhelpers import setup_orekit_curdir\n",
"setup_orekit_curdir()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we are set up to import and use objects from the orekit library."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from org.orekit.utils import Constants"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"6378137.0\n"
]
}
],
"metadata": {}
"source": [
"print Constants.WGS84_EARTH_EQUATORIAL_RADIUS"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"SI base units are used in the library, such as seconds, meter, m/s"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"*Petrus Hyvönen, SSC, 2014*"
]
}
]
}
\ No newline at end of file
],
"metadata": {
"hide_input": false,
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.11"
},
"toc": {
"toc_cell": false,
"toc_number_sections": true,
"toc_threshold": 4,
"toc_window_display": true
}
},
"nbformat": 4,
"nbformat_minor": 0
}
This diff is collapsed.
......@@ -89,7 +89,7 @@ public class PythonAbstractDetector<T extends EventDetector> extends AbstractDet
/** {@inheritDoc} */
@Override
public native T create(double newMaxCheck, double newThreshold, int newMaxIter,
EventHandler<T> newHandler);
EventHandler<? super T> newHandler);
}
Changelog python orekit package
2016-02-07 Version 7.1 Build 0
- Updated to orekit 7.1 release version
2016-01-29 version 7.1dev Build 3
- Updated to apache common math 3.6 final
- orekit 7.1dev version from repository
2015-10-05 Version 7.1dev Build 1
- Updated to apache common math 3.6
- Orekit 7.1dev version from repository
......
......@@ -6,9 +6,9 @@ set
"%PYTHON%" -m jcc ^
--use_full_names ^
--python orekit ^
--version 7.1.dev ^
--jar %RECIPE_DIR%\orekit-7.1-SNAPSHOT.jar ^
--jar %RECIPE_DIR%\commons-math3-3.6-SNAPSHOT.jar ^
--version 7.1 ^
--jar %RECIPE_DIR%\orekit-7.1.jar ^
--jar %RECIPE_DIR%\commons-math3-3.6.jar ^
--package java.io ^
--package java.util ^
--package java.text ^
......
......@@ -6,9 +6,9 @@
$PYTHON -m jcc \
--use_full_names \
--python orekit \
--version 7.1.dev \
--jar $RECIPE_DIR/orekit-7.1-SNAPSHOT.jar \
--jar $RECIPE_DIR/commons-math3-3.6-SNAPSHOT.jar \
--version 7.1 \
--jar $RECIPE_DIR/orekit-7.1.jar \
--jar $RECIPE_DIR/commons-math3-3.6.jar \
--package java.io \
--package java.util \
--package java.text \
......
package:
name: orekit
version: '7.1.dev0'
version: '7.1'
build:
# entry_points:
......@@ -14,11 +14,12 @@ build:
# If this is a new build for the same version, increment the build
# number. If you do not include this key, it defaults to 0.
number: 2
number: 0
# Builds:
# 1 - orekit 7.1dev0 version from git 2015-10-05
# 2 - orekit 7.1dev0 version from git 2015-12-17
# 3 - orekit 7.1dev0 version from git 2015-12-29
# 0 - orekit 7.1 release version of orekit 2016-02-07
#has_prefix_files:
# Lib/site-packages/orekit/__init__.py
......@@ -53,6 +54,7 @@ test:
- test/AbstractDetectorTest.py
- test/EventDetectorTest.py
- test/SmallManeuverAnalyticalModelTest.py
- test/GroundFieldOfViewDetectorTest.py
commands:
......@@ -67,6 +69,7 @@ test:
- python AbstractDetectorTest.py
- python EventDetectorTest.py
- python SmallManeuverAnalyticalModelTest.py
- python GroundFieldOfViewDetectorTest.py
# You can also put a file called run_test.py in the recipe that will be run
# at test time.
......
......@@ -28,19 +28,19 @@ orekit.initVM()
from orekit.pyhelpers import setup_orekit_curdir
setup_orekit_curdir()
from org.orekit.bodies import GeodeticPoint;
from org.orekit.bodies import OneAxisEllipsoid;
from org.orekit.frames import TopocentricFrame;
from org.orekit.orbits import KeplerianOrbit;
from org.orekit.frames import FramesFactory;
from org.orekit.orbits import PositionAngle;
from org.orekit.propagation.analytical import KeplerianPropagator;
from org.orekit.propagation.events.handlers import EventHandler;
from org.orekit.bodies import GeodeticPoint
from org.orekit.bodies import OneAxisEllipsoid
from org.orekit.frames import TopocentricFrame
from org.orekit.orbits import KeplerianOrbit
from org.orekit.frames import FramesFactory
from org.orekit.orbits import PositionAngle
from org.orekit.propagation.analytical import KeplerianPropagator
from org.orekit.propagation.events.handlers import EventHandler
from org.orekit.python import PythonEventHandler
from org.orekit.time import AbsoluteDate;
from org.orekit.time import TimeScalesFactory;
from org.orekit.utils import Constants;
from org.orekit.utils import IERSConventions;
from org.orekit.time import AbsoluteDate
from org.orekit.time import TimeScalesFactory
from org.orekit.utils import Constants
from org.orekit.utils import IERSConventions
from org.orekit.propagation.events import ElevationDetector
import unittest
import sys
......@@ -50,41 +50,41 @@ import math
class Visibility(PythonEventHandler): # implements EventHandler<ElevationDetector> {
def __init__(self):
self._visiNb = 0;
self._visiNb = 0
super(Visibility, self).__init__()
def getVisiNb(self):
return self._visiNb;
return self._visiNb
def eventOccurred(self, s, ed, increasing):
self._visiNb += 1
return EventHandler.Action.CONTINUE;
return EventHandler.Action.CONTINUE
#
def resetState(self, detector, oldState):
return oldState;
return oldState
class BackAndForthDetectorTest(unittest.TestCase):
def testBackAndForth(self):
utc = TimeScalesFactory.getUTC();
date0 = AbsoluteDate(2006, 12, 27, 12, 0, 0.0, utc);
date1 = AbsoluteDate(2006, 12, 27, 22, 50, 0.0, utc);
date2 = AbsoluteDate(2006, 12, 27, 22, 58, 0.0, utc);
utc = TimeScalesFactory.getUTC()
date0 = AbsoluteDate(2006, 12, 27, 12, 0, 0.0, utc)
date1 = AbsoluteDate(2006, 12, 27, 22, 50, 0.0, utc)
date2 = AbsoluteDate(2006, 12, 27, 22, 58, 0.0, utc)
# Orbit
a = 7274000.;
e = 0.00127;
i = math.radians(90.);
w = math.radians(0.);
raan = math.radians(12.5);
lM = math.radians(60.);
a = 7274000.0
e = 0.00127
i = math.radians(90.)
w = math.radians(0.)
raan = math.radians(12.5)
lM = math.radians(60.)
iniOrb = KeplerianOrbit(a, e, i, w, raan, lM,
PositionAngle.MEAN,
FramesFactory.getEME2000(), date0,
Constants.WGS84_EARTH_MU);
Constants.WGS84_EARTH_MU)
# Propagator
propagator = KeplerianPropagator(iniOrb);
propagator = KeplerianPropagator(iniOrb)
# Station
stationPosition = GeodeticPoint(math.radians(0.), math.radians(100.), 110.);
......@@ -92,19 +92,19 @@ class BackAndForthDetectorTest(unittest.TestCase):
Constants.WGS84_EARTH_FLATTENING,
FramesFactory.getITRF(IERSConventions.IERS_2010, True));
stationFrame = TopocentricFrame(earth, stationPosition, "");
stationFrame = TopocentricFrame(earth, stationPosition, "")
# Detector
visi = Visibility() #.of_(ElevationDetector);
det = ElevationDetector(stationFrame).withConstantElevation(math.radians(10.0)).withHandler(visi)
propagator.addEventDetector(det);
propagator.addEventDetector(det)
# Forward propagation (AOS + LOS)
propagator.propagate(date1);
propagator.propagate(date2);
propagator.propagate(date1)
propagator.propagate(date2)
# Backward propagation (AOS + LOS)
propagator.propagate(date1);
propagator.propagate(date0);
propagator.propagate(date1)
propagator.propagate(date0)
self.assertEquals(4, visi.getVisiNb())
......
# -*- coding: utf-8 -*-
"""
/* Copyright 2002-2016 CS Syst��mes d'Information
* Licensed to CS Syst��mes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with