Quickstart¶
Currently, KEPLER is being tested only for use with
IPython3.
To start for the first time use, e.g.,
In [1]: from kepler.code import Kepler as K
In [2]: k = K('xxx', 'xxxz')
KEPLER should now compile and return the Kepler object.
Note
There is also other modes, e.g., running KEPLER as a process and then interact with it, locally or remotely.
The command
In [3]: k.run()
will give you the usual Kepler shell.
In the python shell you can access all KEPLER edit variables
In [4]: k.dn
Out[4]: array([0.1 , 6.43447587, 6.43420504, ..., 0. , 0. ,0. ])
This way you can extract and plot anything, including all the ‘loadbuf’ variables from the ‘z’ and ‘vf’ commands in KEPLER. You can even modify things. This is very powerful, but, obviously, should be used with great care.
In [5]: k.parm.vinstop
Out[5]: 90000000.0
and you can assign to he values
In [6]: k.parm.vinstop *= 1.1
You can also use the usual KEPLER plots
In [7]: k.plot(3)
In contrast to the Fortran version of KEPLER based on mongo,
the run does not stop when you close the figure.
You can do a step
In [8]: k.s()
or a few
In [9]: k.s(3)
or go
In [10]: k.g()
To make KEPLER generator files, use the kepgen package.
Usually you would use kepgen.MakeRun(...); there is a handful
of examples as comments at the bottom of the kepgen.py file.
Unfortunately it is not too obvious
how to use kepgen, it was one of the first things I translated from IDL to
Python, and I am not too proud of the current state of the module …
To start a new run in the same session, you can use
In [11]: k.start('xxx', 'xxxz')
but this is not recommended as there may be side-effects.
Warning
You cannot make a new Kepler object, it will return
the previous one and complain.
There is anther way to do several runs in parallel in the same session: Use KEPLER processes.
In [12]: from kepler.process import Kepler as K
In [13]: k1 = K('xxx', 'xxxz')
At the present, this does not work as expected if you have started a local run before. (I think I now understand why and how to fix, but avoid this for now.) [it will make a copy of local kepler run, ignoring your parameters, and rerun a pointer to that copy. You will then need to use the ‘start’ method of that new object to actually start a new run, but I have seen it hang up on plotting.]
Now you can manage several runs in one python session.
In [14]: k2 = K('xxx', 'xxxz')
Note
Lines the start with a “+” are process outputs from the
process rather than the local shell objects (if you can make any
sense of this statement).