Beispiel #1
0
                   K2=0.,
                   R=0,
                   T=1,
                   N=1.,
                   Ref='G2')

# The beam
beam1 = gbeam.userGaussianBeam(Wx=.1 * cm,
                               Wy=.1 * cm,
                               Theta=90. * deg,
                               Phi=0.,
                               WDistx=0.,
                               WDisty=0.)

# Create simulation object:
simu = sim.Simulation(FName='vignale')

# Load the initial data of the simulation
simu.InBeams = [beam1]
simu.OptList = [mirror1, bd1, bd2]
simu.Order = 0
simu.Threshold = .5 * mW

# run the simulation
simu.run()
simu.writeOut()

if __name__ == "__main__":
    print(simu)
    print(simu.BeamTreeList[0].beamList())
Beispiel #2
0
'''Test the rendering module. This is not portable *at all*.'''

import sys

THEIAPATH = '/home/dev0/theia'  # path to access modules of theia
FREECADPATH = '/usr/lib/freecad/lib'  # and freecad
sys.path.insert(0, THEIAPATH)
sys.path.append(FREECADPATH)

import theia
from theia.helpers import settings
from theia.running import simulation
# initialize globals
dic = {
    'info': True,
    'warning': True,
    'text': True,
    'cad': True,
    'fname': 'test_plain',
    'fclib': FREECADPATH,
    'antiClip': True,
    'short': False
}

settings.init(dic)

#simulation
simu = simulation.Simulation(dic['fname'])
simu.load()
simu.writeCAD()
Beispiel #3
0
                     ARt=.90,
                     Ref='M1')

# Here are some beams which all depart from the focus of the semi-spherical
# mirror
beams = []
for i in range(-3, 3):
    for j in range(-3, 3):
        beams.append(
            gbeam.userGaussianBeam(Wx=0.001,
                                   Wy=0.001,
                                   Theta=np.pi / 2. + i * np.pi / 7.,
                                   Phi=j * np.pi / 7.,
                                   X=0.5))
# Create simulation object:
simu = sim.Simulation(FName='sphere')
simu.LName = 'An Important Property of Spherical Mirrors'

# Load the initial data of the simulation
simu.InBeams = beams
simu.OptList = [mirror1]
simu.Order = 0
simu.Threshold = .5 * W

# run the simulation
simu.run()

# observe that all the reflected beams point to infinity
if __name__ == "__main__":
    print "Direction of reflected beams:"
    for k in range(len(simu.BeamTreeList)):
Beispiel #4
0
# initialize globals
dic = {
    'info': True,
    'warning': True,
    'text': True,
    'cad': True,
    'fname': 'test_simulation',
    'fclib': FREECADPATH,
    'antiClip': True,
    'short': False
}

settings.init(dic)

# Create simulation object:
simu = simulation.Simulation(FName='test_simulation')


# test functions
@tools.timer
def loader():
    simu.load()


@tools.timer
def runner():
    simu.run()


@tools.timer
def writeOut():
Beispiel #5
0
# initialize globals (necessary to use theia in library form)
dic = {
    'info': False,
    'warning': True,
    'text': True,
    'cad': True,
    'fname': 'optimization',
    'fclib': '/usr/lib/freecad/lib',
    'antiClip': True,
    'short': False
}
settings.init(dic)

#simulation object
simu = simulation.Simulation(FName='optimization')
simu.LName = 'Optimizing with theia!'
simu.Order = 0
simu.Threshold = 0.5 * mW

#optics, the first L1 lens doesn't move
L1 = thinlens.ThinLens(X=0 * cm,
                       Y=0.,
                       Z=0.,
                       Focal=20. * cm,
                       Diameter=3. * cm,
                       Phi=180. * deg,
                       Ref='L1')

bm = beam.userGaussianBeam(1. * mm,
                           1. * mm,
Beispiel #6
0
                     Ref='M2',
                     N=1.5)

#Input beam
beam1 = gbeam.userGaussianBeam(Wx=.5 * cm,
                               Wy=.5 * cm,
                               WDistx=0,
                               WDisty=0,
                               Ref='ORI')

# parameters
threshold = -1 * W
order = 1
inBeams = [beam1]
optList = [mirror1, mirror2]

# Create simulation object:
simu = sim.Simulation(FName='telescope')
simu.OptList = optList
simu.InBeams = inBeams
simu.Order = order
simu.Threshold = threshold

# Run simulation. Output of this simulation is intended to be compared
# to the output of the telescope.f90 optocad simulation
simu.run()

if __name__ == "__main__":
    print(simu)
    print(simu.BeamTreeList[0].beamList())