Exemplo n.º 1
0
    target_plane = Box(Point3D(-100000, -100000, -0.000001),
                       Point3D(100000, 100000, 0.000001))
    hole = Box(Point3D(-det_xwidth / 2, -det_ywidth / 2, -0.00001),
               Point3D(det_xwidth / 2, det_ywidth / 2, 0.00001),
               parent=world,
               material=NullMaterial())
    pinhole = Subtract(target_plane,
                       hole,
                       parent=world,
                       material=AbsorbingSurface())

    analytic_value = analytic_etendue(area_detector, area_pinhole, separation,
                                      theta, phi)

    raytraced_value, raytraced_error = raytraced_etendue(
        separation, point_sampler, area_detector)

    detector.calculate_etendue(ray_count=100000)
    cherab_auto_etendue = detector.etendue

    print("Results")
    print("Analytic etendue: {:.4G}".format(analytic_value))
    print("Manual Ray-traced etendue: {:.4G} +- {:.4G}".format(
        raytraced_value, raytraced_error))
    print("Auto Ray-traced etendue: {:.4G}".format(cherab_auto_etendue))
    print("Relative error: {:.4G}".format(
        np.abs(cherab_auto_etendue - analytic_value) / cherab_auto_etendue))

    hole.parent = None
    pinhole.parent = None
Exemplo n.º 2
0
# camera - ray sampling settings
camera.spectral_rays = 1
camera.spectral_bins = 20
camera.ray_max_depth = 100
camera.ray_extinction_prob = 0.1
camera.min_wavelength = 375.0
camera.max_wavelength = 740.0


# 3. Build Scenegraph
# -------------------

world = World()

sphere.parent = world
ground.parent = world
emitter.parent = world
camera.parent = world


# 4. Observe()
# ------------

plt.ion()
camera.observe()

plt.ioff()
rgb.save("render.png")
rgb.display()
plt.show()
Exemplo n.º 3
0
# 2. Add Observer
# ---------------

# camera
camera = PinholeCamera((384, 384), transform=translate(0, 0, -80))
camera.fov = 45
camera.pixel_samples = 250
camera.pipelines[0].accumulate = False


# 3. Build Scenegraph
# -------------------

world = World()
ground.parent = world
emitterIsotropic.parent = world
emitterAnisotropic.parent = world
camera.parent = world


# 4. Observe and animate
# ----------------------

if not os.path.isdir("anim/aniso/"):
    os.makedirs("anim/aniso/")

plt.ion()
num_frames = 45
for frame in range(num_frames):
    print("Rendering frame {}:".format(frame))