File: test.py

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 (56 lines) | stat: -rw-r--r-- 1,782 bytes parent folder | download | duplicates (6)
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")