Exemplo n.º 1
0
def load_camera(config, world):

    if config['machine']['name'] == "MAST-U":

        from cherab.mastu.cameras import load_camera as load_mastu_camera

        camera = load_mastu_camera(config["observer"]["camera_id"],
                                   world,
                                   stride=config["observer"]["stride"])

    else:
        raise ValueError(
            "Automatic camera loading is not supported for your machine.")

    pipelines = []

    if config["observer"]["display_progress"]:
        display_progress = True
    else:
        display_progress = False

    if config["observer"]["rgb_pipeline"]:
        rgb = RGBPipeline2D(display_unsaturated_fraction=0.96,
                            name="sRGB",
                            display_progress=display_progress,
                            display_update_time=15)
        pipelines.append(rgb)

    if config["observer"]["power_pipeline"]:
        power = PowerPipeline2D(display_unsaturated_fraction=0.96,
                                name="Unfiltered Power (W)",
                                display_progress=display_progress,
                                display_update_time=15)
        pipelines.append(power)

    if config["observer"]["radiance_pipeline"]:
        radiance = RadiancePipeline2D(display_unsaturated_fraction=0.96,
                                      name="Unfiltered Radiance (W/m^2/str)",
                                      display_progress=display_progress,
                                      display_update_time=15)
        pipelines.append(radiance)

    camera.pipelines = pipelines
    camera.pixel_samples = config["raytracing"]["pixel_samples"]

    return camera
Exemplo n.º 2
0
def load_bul_camera(camera='06Bul3',
                    shot=35050,
                    parent=None,
                    pipelines=None,
                    stride=1):

    directory = os.path.split(__file__)[0]

    if camera == '06Bul3':
        if shot >= 35050:
            camera_config = _load_camera_calibration(os.path.join(
                directory, './data/06Bul3_los.xml'),
                                                     interp_factor=30)
        else:
            camera_config = _load_camera_calibration(os.path.join(
                directory, './data/06Bul3_los_old.xml'),
                                                     interp_factor=30)

    elif camera == '06Bul':
        camera_config = _load_camera_calibration(os.path.join(
            directory, './data/06Bul_los.xml'),
                                                 interp_factor=30)

    else:
        raise ValueError("Unidentified camera - '{}'".format(camera))

    if not pipelines:
        power_unfiltered = PowerPipeline2D(display_unsaturated_fraction=0.96,
                                           name="Unfiltered Power (W)")
        power_unfiltered.display_update_time = 15
        pipelines = [power_unfiltered]

    pixels_shape, pixel_origins, pixel_directions = camera_config
    camera = VectorCamera(pixel_origins[::stride, ::stride],
                          pixel_directions[::stride, ::stride],
                          pipelines=pipelines,
                          parent=parent)
    camera.spectral_bins = 15
    camera.pixel_samples = 1

    return camera
Exemplo n.º 3
0
def load_kl1_camera(parent=None, pipelines=None):

    camera_config = load_calcam_calibration(
        '/home/mcarr/cherab/cherab_jet/cherab/jet/cameras/kl1/kl1-e4wc-sightlines.nc'
    )

    if not pipelines:
        power_unfiltered = PowerPipeline2D(display_unsaturated_fraction=0.96,
                                           name="Unfiltered Power (W)")
        power_unfiltered.display_update_time = 15
        pipelines = [power_unfiltered]

    pixels_shape, pixel_origins, pixel_directions = camera_config
    camera = VectorCamera(pixel_origins,
                          pixel_directions,
                          pipelines=pipelines,
                          parent=parent)
    camera.spectral_bins = 15
    camera.pixel_samples = 1

    return camera
Exemplo n.º 4
0
# plasma.models = [ExcitationLine(d_gamma), RecombinationLine(d_gamma)]

ciii_465 = Line(carbon, 2, ('2s1 3p1 3P4.0', '2s1 3s1 3S1.0'))
plasma.models = [ExcitationLine(ciii_465)]

# Select from available Cameras
# camera_config = load_calcam_calibration('/home/mcarr/mastu/cameras/mug_bulletb_midplane.nc')
# camera_config = load_calcam_calibration('/home/mcarr/mastu/cameras/mug_divcam_isp.nc')
camera_config = load_calcam_calibration(
    '/home/mcarr/mastu/cameras/mug_divcam_sxd.nc')

# RGB pipeline for visualisation
rgb = RGBPipeline2D(display_unsaturated_fraction=0.96, name="sRGB")

# Get the power and raw spectral data for scientific use.
power_unfiltered = PowerPipeline2D(display_unsaturated_fraction=0.96,
                                   name="Unfiltered Power (W)")
power_unfiltered.display_update_time = 15
# spectral = SpectralPowerPipeline2D()

# Setup camera for interactive use...
plt.ion()
pixels_shape, pixel_origins, pixel_directions = camera_config
camera = VectorCamera(pixel_origins,
                      pixel_directions,
                      pipelines=[rgb, power_unfiltered],
                      parent=world)
# camera.render_engine = SerialEngine()
camera.spectral_bins = 15
camera.pixel_samples = 1
camera.observe()
plt.ioff()
Exemplo n.º 5
0
          parent=world,
          transform=translate(0.4, -1 + 1e-6, 0.4)*rotate(30, 0, 0),
          material=schott("N-BK7"))

sphere = Sphere(0.4,
                parent=world,
                transform=translate(-0.4, -0.6 + 1e-6, -0.4)*rotate(0, 0, 0),
                material=schott("N-BK7"))


filter_red = InterpolatedSF([100, 650, 660, 670, 680, 800], [0, 0, 1, 1, 0, 0])
filter_green = InterpolatedSF([100, 530, 540, 550, 560, 800], [0, 0, 1, 1, 0, 0])
filter_blue = InterpolatedSF([100, 480, 490, 500, 510, 800], [0, 0, 1, 1, 0, 0])

# create and setup the camera
power_unfiltered = PowerPipeline2D(display_unsaturated_fraction=0.96, name="Unfiltered")
power_unfiltered.display_update_time = 15

power_green = PowerPipeline2D(filter=filter_green, display_unsaturated_fraction=0.96, name="Green Filter")
power_green.display_update_time = 15

power_red = PowerPipeline2D(filter=filter_red, display_unsaturated_fraction=0.96, name="Red Filter")
power_red.display_update_time = 15

rgb = RGBPipeline2D(display_unsaturated_fraction=0.96, name="sRGB")

bayer = BayerPipeline2D(filter_red, filter_green, filter_blue, display_unsaturated_fraction=0.96, name="Bayer Filter")
bayer.display_update_time = 15

pipelines = [rgb, power_unfiltered, power_green, power_red, bayer]
Exemplo n.º 6
0
plt.colorbar()
plt.axis('equal')
plt.xlabel('r axis')
plt.ylabel('z axis')
plt.title("Neutral Density profile in r-z plane")

plt.figure()
xrange = np.linspace(0, 4, 200)
yrange = np.linspace(-2, 2, 200)
d_alpha_rz_intensity = np.zeros((200, 200))
direction = Vector3D(0, 1, 0)
for i, x in enumerate(xrange):
    for j, y in enumerate(yrange):
        emission = d_alpha_excit.emission(Point3D(x, 0.0, y), direction, Spectrum(650, 660, 1))
        d_alpha_rz_intensity[j, i] = emission.total()
plt.imshow(d_alpha_rz_intensity, extent=[0, 4, -2, 2], origin='lower')
plt.colorbar()
plt.xlabel('r axis')
plt.ylabel('z axis')
plt.title("D-alpha emission in R-Z")


camera = PinholeCamera((256, 256), pipelines=[PowerPipeline2D()], parent=world)
camera.transform = translate(2.5, -4.5, 0)*rotate_basis(Vector3D(0, 1, 0), Vector3D(0, 0, 1))
camera.pixel_samples = 1

plt.ion()
camera.observe()
plt.ioff()
plt.show()