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
|
import gyoto.core
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.core.requirePlugin(python_plugin)
sp=gyoto.core.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.core.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.core.Spectrum("PowerLaw")
sp2.set("Exponent", 0.)
sp2.set("Constant", 2.)
print('using Gyoto generic integrator: {}'.format(sp2.integrate(1., 2.)))
sp.set("Module", "gyoto_sample_spectra")
sp.set("Class", "PowerLaw")
sp.set("Parameters", (2., 1.))
print('using Python integrate: {}'.format(sp.integrate(1., 2.)))
sp2=gyoto.core.Spectrum("PowerLaw")
sp2.set("Exponent", 1.)
sp2.set("Constant", 2.)
print('using Gyoto generic integrator: {}'.format(sp2.integrate(1., 2.)))
sp.set("Module", "gyoto_sample_spectra")
sp.set("Class", "PowerLaw")
sp.set("Parameters", (5., -1.))
print('using Python integrate: {}'.format(sp.integrate(1., 2.)))
sp2=gyoto.core.Spectrum("PowerLaw")
sp2.set("Exponent", -1.)
sp2.set("Constant", 5.)
print('using Gyoto generic integrator: {}'.format(sp2.integrate(1., 2.)))
gg=gyoto.core.Metric("Python")
gg.set("Module", "gyoto_sample_metrics")
gg.set("Class", "Minkowski")
|