Exemple #1
0
import numpy
import unittest
import gyoto
gyoto.loadPlugin('stdplug')
import gyoto_std

class TestOscilTorus(unittest.TestCase):

    def test_OscilTorus(self):
        ao=gyoto.Astrobj("OscilTorus")
        ao=gyoto_std.OscilTorus()
        r=4.
        ao.largeRadius(r)
        self.assertTrue((ao.largeRadius() == r))
        perturbkind="Vertical"
        ao.perturbKind(perturbkind)
        self.assertTrue((ao.perturbKind() == perturbkind))
Exemple #2
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Gyoto.  If not, see <http://www.gnu.org/licenses/>.

# Before loading the gyoto_std extension:
#  - gyoto must be imported;
#  - the stdplug Gyoto plug-in must be loaded. This normally happens
#    automatically, unless the user has set her environment otherwise.
import numpy
import matplotlib as ml
import matplotlib.pyplot as plt
import gyoto
gyoto.loadPlugin("stdplug")
import gyoto_std

# Simple stuff

scr = gyoto.Screen()
gg = gyoto_std.KerrBL()
scr.metric(gg)
pos = numpy.zeros(4, float)
scr.getObserverPos(pos)

# Load Scenery

a = gyoto.Factory("../doc/examples/example-moving-star.xml")
sc = a.getScenery()
sc.nThreads(8)
Exemple #3
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Gyoto.  If not, see <http://www.gnu.org/licenses/>.


# Let mpi4py initilize the MPI environment:
import mpi4py.MPI

import numpy
import matplotlib as ml
import matplotlib.pyplot as plt
import gyoto
gyoto.loadPlugin("stdplug")
import gyoto_std

a=gyoto.Factory("../doc/examples/example-moving-star.xml")
sc=a.getScenery()
sc.nThreads(1)
sc.astrobj().opticallyThin(False)

# Ray-trace scenery

# Prepare array for holding results
res=sc.screen().resolution()
intensity=numpy.zeros((res, res), dtype=float)
time=numpy.zeros((res, res), dtype=float)
distance=numpy.zeros((res, res), dtype=float)
Exemple #4
0
import gyoto
import sys
import os.path

# The name of the Gyoto plug-in that can be loaded in a given Python
# session is the same as the name of the Python executable
python_plugin = os.path.basename(sys.executable)
gyoto.loadPlugin(python_plugin)

sp=gyoto.Spectrum("Python")
sp.set("Module", "gyoto_sample_spectra")
sp.set("Class", "PowerLaw")
sp.set("Parameters", (1., 10.))
print('value: {}'.format(sp(3e8/2e-6)))
sp.set("Parameters", (2., 20.))
print('value: {}'.format(sp(3e8/2e-6)))

#BlackBody6000 does not accept any parameter:
sp=gyoto.Spectrum("Python")
sp.set("Module", "gyoto_sample_spectra")
sp.set("Class", "BlackBody6000")
print('value: {}'.format(sp(3e8/2e-6)))

sp.set("Module", "gyoto_sample_spectra")
sp.set("Class", "PowerLaw")
sp.set("Parameters", (2., 0.))
print('using Python integrate: {}'.format(sp.integrate(1., 2.)))

sp2=gyoto.Spectrum("PowerLaw")
sp2.set("Exponent", 0.)
sp2.set("Constant", 2.)