Python notebooks and on-line execution

Hi,

Been updating a bit of examples for the Python notebooks, and just would like to highlight to possibilities with Binder, an on-line service for interactive execution of notebooks. Now it also support custom packages, so orekit can be executed online with it.

Have a go at
[Examples(Binder)
EDIT: Updated to use latest commit.

The notebooks are under the folder examples.

I think this could be a quite interesting way to have interactive examples.

Regards / Petrus

Hi @petrus.hyvonen

Thank you very much for doing this. What you’ve done looks really good. I think we have to put a reference to your new tutorials on the Orekit website. Do you agree if we put an access link to these Python Jupyter tutorials on the Orekit website?

I really like the interactive tutorials with Jupiter notebook. I don’t know if it is possible to use Java with Blinder … I have seen a phrase in the documentation that seems to say that this is possible:

“if a language is not “officially” supported by a build pack, it can often be installed with a postBuild script. This will run arbitrary bash commands, and can be used to download / install a language.”

If we can use Java in Blinder, it can be an interesting improvement to replace the old Java tutorials on the Orekit’s Maven site by more user-friendly interactive examples.

Thank you again.
Bryan

1 Like

Hi,

Yes it is also possible to run java or similar like groovy in notebooks. One needs to use a different “Kernel” that is selectable in the user interface and the setting is stored with the notebook.

I haven’t digged much into Java kernels but think that beakerX or scijava are likely candidates.

EDIT: BeakerX is the successor of SciJava.

Some examples using binder is available at:
https://hub.gke.mybinder.org/user/twosigma-beakerx-c2lpbc8s/notebooks/StartHere.ipynb

1 Like

Hi,

I think it would be great to have a binder link on the webpage to be able to try it out quickly.

But I would ask someone in the team to review the notebooks, if they are clear, if they are correct and if there are better ways to do things? I have referenced the main orekit documentation as I have reused significant parts from there, please let me know if you think the credits are ok?

I have added a few more notebooks

Regards
/Petrus

Hi,

Using Binder is a great idea. These are a lot of notebook tutorials, great work Petrus! However some of the new notebooks return a 400 bad request error when I try to access them, for instance https://gitlab.orekit.org/orekit-labs/python-wrapper/-/blob/master/examples/Track%20Corridor.ipynb

I am working on some tutorials for measurement generation, IOD and Batch Least Squares OD, which are more generic and more modular than the big, monolithic laser OD notebook. When I am finally happy with these notebooks, do you think it is worth adding them to https://gitlab.orekit.org/orekit-labs/python-wrapper ?

Hi,

Ah, renamed the files now, Gitlab preview somehow don’t like filename with spaces in…

It would be great with more examples, and OD would be a good addition.

I am considering if we should have a separate repo for python examples, the wrapper one is a bit mix of everything right now. Examples are not neccessary tied to versions of the wrapper etc.

Regards
/P

Hi all,

@yzokras it is a great idea to add these examples to the Python wrapper examples!

I tried using ijava once with Orekit and it worked quite well.
I tried beakerX too because it seems more “professional” but I found it hard to use because in Java it seems to “forget” all the variables from cell to cell. But maybe it was just a configuration option that I missed.

Maybe we could:

  1. Create another Gitlab project: Orekit Python Tutorials, just like the Orekit Tutorials one;
  2. Or put the Python examples inside the Orekit Tutorials project. In src/main/python with input files in src/main/resources/python.
    My ultimate “dream” would be to have, for each example, a Java and a Python implementation in mirror directories, using the same input files in the resources directory. But that is a lot of work…
    Note that this solution can raise several issues:
    • We’ll have to wait for the release of the version of the wrapper before we can release the tutorials (although the wrapper release is usually very fast);
    • We use Maven for the tutorials’ release with Jar packaging, signed files etc. I don’t know how it will work with a mixed Java/Python code;
    • I’m not sure if with a directory tree like this we can package the Python examples so that a user could do something like: conda install orekit-tutorials to get all the tutorials in one go.
    • Other issues I haven’t thought of…

Regards,
Maxime

Hi Maxime!

I would as a first step go for option 1, a separate gitlab project. I would think it is an advantage to have it separated from the release cycle and more “dynamic” and quickly be able to add examples based on questions in the forum etc. We could consider to select some of it to go as a part of a “reviewed” set.

On 2, I fully agree on the dual implementation, it would be very educative to have java and python examples side by side. To some degree there already are such examples but not 1:1.

The conda install fully is doable using a separate channel. For v8 I have the orekit-doc available, using conda install -c petrush orekit-doc

Regards,
/Petrus

Seems like if I create a project on the GitLab it is created under my user. Maybe such project “Orekit Python Tutorials” should be under OrekitLabs similar like the wrapper?

Orekit Labs is an option yes.

But I’m starting to wonder if the “Python Wrapper” should not move from the “Orekit Labs” to the “Orekit Official” repository. It’s not a “lab” anymore, far from it… in fact there may be more users of Python than Java :wink:
Well maybe it’s off topic and too complicated for now.

I think you need some kind of access write on the Gitlab forge itself to add a new project.
@luc did it a few months ago for the Java tutorials but I don’t know how.
@sdinot could you help us on this one ?