File: README.md

package info (click to toggle)
gyoto 2.0.2-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,444 kB
  • sloc: cpp: 42,330; sh: 4,512; python: 3,436; xml: 2,865; makefile: 691; ansic: 346
file content (71 lines) | stat: -rw-r--r-- 2,781 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Python plug-in for Gyoto

## Purpose

Files in this directory (plugins/python/ in the Gyoto source) allow
building a Gyoto plug-in that embeds the Python interpreter to call
Python routine from within Gyoto. This allows extending Gyoto with new
Metric, Astrobj or Spectrum classes implemented in Python.

This is different from, but complementary with, the files in the
python/ directory, which allow extending Python to call Gyoto
routines from Python.

## Building and installing

This directory is built and installed with the rest of Gyoto. See
INSTALL.Gyoto.md in the top-most directory. Make sure the right Python
interpreter is found at the "configure" step.

## Caveats

Coding your new Metric, Astrobj or Spectrum class in Python is
efficient in terms of human resources, while coding it in C++ is much
more efficient in terms of computing resources.

## Usage

It is possible to compile this plug-in for the several installations
of Python that may coexist on the system. The name of the plug-in will
be the same as the name of the python executable (e.g. python3,
python3.9...) It the rest of this text, we will assume this is
`python3'.

This plug-in is not part of the plug-ins loaded by default in
Gyoto. Several possibilities exist to load it explicitly:

* set the GYOTO_PLUGINS environment variable, not forgetting to also
  list the other desired default plugins, e.g.:
  ```export GYOTO_PLUGINS=stdplug,python3,nofail:lorene```

* use the `--plugins' option of the gyoto command-line tool, e.g.:
  ```gyoto --plugins=stdplug,python3,nofail:lorene ...```

* in Python, use ```gyoto.core.requirePlugin('python3')```

* in XML, set the plugin property:
  ```<Metric kind="Python" plugin="python3">```

The content of plugins/python/doc/examples should give enough
resources to get started. The gyoto_sample_*.py modules contain
documentation about how to code a class in Python while the test*.py
scripts give an idea of how to instantiate and use such classes using
the Python bindings. One can also directly load the provided XML files
into the stand-alone gyoto executable by using the --plugins
option. Note that multi-threading is not efficient when using a Python
metric in particular, but MPI parallelization works quite well, so the
command line could look something like:

```
mpirun -np 4 gyoto --plugins=python3,stdplug -P-1 input.xml \!output.fits
```

For more information or for information on writing new classes in C++,
please refer to Sect. 9 of the Gyoto manual, available as
doc/user_guide/GyotoManual.pdf once Gyoto has been built on your
system, or at https://gyoto.obspm.fr/GyotoManual.pdf

## Copyright

This is part of Gyoto and has the same license (GPL v3+). It is
packaged in a sub-directory as an example for packaging Gyoto plug-ins.