[Debian-astro-commits] [gyoto] 160/221: Python: add some doc; examplify ray-tracing with Spectrum
Thibaut Jean-Claude Paumard
thibaut at moszumanska.debian.org
Fri May 22 20:52:43 UTC 2015
This is an automated email from the git hooks/post-receive script.
thibaut pushed a commit to branch master
in repository gyoto.
commit 478041e13458fa968d0cb964ce071dce44052c81
Author: Thibaut Paumard <paumard at users.sourceforge.net>
Date: Thu Dec 18 22:04:30 2014 +0100
Python: add some doc; examplify ray-tracing with Spectrum
---
python/example.py | 20 ++++++++++++++++++++
python/gyoto.i | 36 +++++++++++++++++++++---------------
python/header.py | 3 +++
3 files changed, 44 insertions(+), 15 deletions(-)
diff --git a/python/example.py b/python/example.py
index 53536f0..94e1ef5 100644
--- a/python/example.py
+++ b/python/example.py
@@ -83,3 +83,23 @@ plt.imshow(time)
plt.show()
plt.imshow(distance)
plt.show()
+
+# Another Scenery, with spectrum
+
+sc=gyoto.Factory("../doc/examples/example-polish-doughnut.xml").getScenery()
+res=sc.screen().resolution()
+ns=sc.screen().spectrometer().nSamples()
+spectrum=numpy.zeros((ns, res, res), dtype=float)
+
+ii=gyoto.Range(1, res, 1)
+jj=gyoto.Range(1, res, 1)
+grid=gyoto.Grid(ii, jj)
+
+aop=gyoto.Properties()
+aop.Spectrum(spectrum)
+aop.offset=res*res
+
+sc.rayTrace(grid, aop)
+
+plt.imshow(spectrum[1,:,:])
+plt.show()
diff --git a/python/gyoto.i b/python/gyoto.i
index 2de550d..ab5b987 100644
--- a/python/gyoto.i
+++ b/python/gyoto.i
@@ -1,4 +1,5 @@
-%module gyoto
+%module(docstring="The General relativitY Orbit Tracer of paris Observatory") gyoto
+%feature("autodoc", "1");
%define GYOTO_SWIGIMPORTED
%enddef
@@ -104,25 +105,30 @@ GyotoSmPtrClass(Photon)
GyotoSmPtrClassGeneric(Astrobj)
-%define _PAccessor(member, setter)
+%define _PAccessor2(member, setter)
void setter(double *IN_ARRAY2, int DIM1, int DIM2) {
$self->member = IN_ARRAY2;
}
%enddef
+%define _PAccessor3(member, setter)
+void setter(double *IN_ARRAY3, int DIM1, int DIM2, int DIM3) {
+ $self->member = IN_ARRAY3;
+ }
+%enddef
%extend Gyoto::Astrobj::Properties{
- _PAccessor(intensity, Intensity)
- _PAccessor(binspectrum, BinSpectrum)
- _PAccessor(distance, MinDistance)
- _PAccessor(first_dmin, FirstDistMin)
- _PAccessor(impactcoords, ImpactCoords)
- _PAccessor(redshift, Redshift)
- _PAccessor(spectrum, Spectrum)
- _PAccessor(time, EmissionTime)
- _PAccessor(user1, User1)
- _PAccessor(user2, User2)
- _PAccessor(user3, User3)
- _PAccessor(user4, User4)
- _PAccessor(user5, User5)
+ _PAccessor2(intensity, Intensity)
+ _PAccessor3(binspectrum, BinSpectrum)
+ _PAccessor2(distance, MinDistance)
+ _PAccessor2(first_dmin, FirstDistMin)
+ _PAccessor3(impactcoords, ImpactCoords)
+ _PAccessor2(redshift, Redshift)
+ _PAccessor3(spectrum, Spectrum)
+ _PAccessor2(time, EmissionTime)
+ _PAccessor2(user1, User1)
+ _PAccessor2(user2, User2)
+ _PAccessor2(user3, User3)
+ _PAccessor2(user4, User4)
+ _PAccessor2(user5, User5)
};
GyotoSmPtrClassGeneric(Metric)
diff --git a/python/header.py b/python/header.py
index b0a3a1c..4e787cc 100644
--- a/python/header.py
+++ b/python/header.py
@@ -1,3 +1,6 @@
+"""
+The General relativitY Orbit Tracer of paris Observatory
+"""
# This is necessary at least on Linux to let the libgyoto symbols be
# visible from the libgyoto-stdplug (and other plug-ins) symbols.
import sys, ctypes
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/gyoto.git
More information about the Debian-astro-commits
mailing list