示例#1
0
from raysect.optical import World
from raysect.core.math.sampler import TargettedHemisphereSampler, RectangleSampler3D
from raysect.core import Ray as CoreRay
from raysect.optical.material import NullMaterial

from cherab.jet.machine import import_jet_mesh
from cherab.jet.bolometry import load_kb1_camera

R_2_PI = 1 / (2 * np.pi)

world = World()

kb1 = load_kb1_camera(parent=world)

# JET vessel forms the KB1 aperture, so need to load this too
import_jet_mesh(world)


# We don't want to include ray hits with the bottom of the vessel in the
# etendue calculation. So we need to modify BolometerFoil.calculate_etendue
# for this special case
def calculate_etendue(self, ray_count=10000, batches=10):
    target = self.slit.target

    world = self.slit.root
    detector_transform = self.to_root()

    # generate bounding sphere and convert to local coordinate system
    sphere = target.bounding_sphere()
    spheres = [(sphere.centre.transform(self.to_local()), sphere.radius, 1.0)]
    # instance targetted pixel sampler
import time
import numpy as np
from raysect.primitive import import_obj
from raysect.optical import World
from raysect.optical.material import AbsorbingSurface
from raysect.core.workflow import MulticoreEngine

from cherab.jet.machine import import_jet_mesh
from cherab.jet.machine.cad_files import KB5V, KB5H
from cherab.jet.bolometry import load_kb5_camera, load_kb5_voxel_grid

world = World()
inversion_grid = load_kb5_voxel_grid(parent=world, name="KB5 inversion grid")
import_jet_mesh(world, override_material=AbsorbingSurface())
kb5v_collimator_mesh = import_obj(KB5V[0][0],
                                  scaling=0.001,
                                  parent=world,
                                  material=AbsorbingSurface())
kb5h_collimator_mesh = import_obj(KB5H[0][0],
                                  scaling=0.001,
                                  parent=world,
                                  material=AbsorbingSurface())

# Calculate KB5V camera sensitivities
kb5v = load_kb5_camera('KB5V', parent=world)
sensitivity_matrix = np.zeros((len(kb5v), inversion_grid.count))
for i, detector in enumerate(kb5v):
    detector.render_engine = MulticoreEngine(10)
    start_time = time.time()
    sensitivities = detector.calculate_sensitivity(inversion_grid,
                                                   ray_count=10000)