######################################
# Options

# Sphere origin
orig = [0, 0, 0]
# Gridding, number of pixels in slice
nPhi = 50
# Detector filename
fname = "AllDetector_1_LED.bin"
# Axis of the slice
sliceAx = 'y'
# Detector width, anlge that the detector sees. [deg]
detAng = 5.0
######################################

df = ft.loadDetectorData(fname)

gp = dt.convertToSlice(df, nPhi=nPhi, detAng=detAng)


fig = plt.figure()
ax = fig.add_subplot(111)
# Sum pixels
gg = gp['radPower']
gg.plot()

plt.xlabel('Angle on slice, deg. (Axis %s)' % sliceAx)
plt.ylabel('W/sr')
plt.legend()
plt.show(block=True)
Exemplo n.º 2
0
    def _tracerProcessEnded(self, lines):
        # Check if process ended correctly
        # TODO! raise APIError (temporarily commented out for testing)
        if "########## Tracing done ################" in lines:
            logger.info("Tracing successful!")
        else:
            for line in lines:
                logger.debug(line)
            print(lines)
            logger.info("Tracing was not successful!")
            raise APIError.APIError("Tracing was not successful!")

        # Read absorption data
        (points, absorb) = vtkS.readAbsorptionData(self._absorptionFilePath)
        # print(points)
        # print(absorb)

        # Get field
        key = (FieldID.FID_Thermal_absorption_volume, self._curTStep)
        print(self.fields)
        f = self.fields[key]

        # Convert point data to field mesh
        if self._convertPointData:
            if meshS.FASTisAvailable():
                meshS.convertPointDataToMeshFAST(
                    pointdataVTKfile=self._absorptionFilePath,
                    field=f, inplace=True)
            else:
                meshS.convertPointDataToMesh(points, absorb, f, inplace=True)

        # Read line data (if needed): (TODO: not tested)
        # (pts, wv, offs) = vtkS.readLineData("ray_paths.vtp")

        # Read photometric data from overall detector
        df = ft.loadDetectorData('AllDetector_1_LED.bin')
        data = dt.convertToSphere(df)

        # Set data to properties
        # Spectrum
        key = (PropertyID.PID_LEDSpectrum, objID.OBJ_LED,
               self._curTStep)
        p = self.properties[key]
        p.value['wavelengths'] = data['wavelengths']
        p.value['intensities'] = data['intensities']

        # Color x
        key = (PropertyID.PID_LEDColor_x, objID.OBJ_LED,
               self._curTStep)
        p = self.properties[key]
        p.value = data['color_x']

        # Color y
        key = (PropertyID.PID_LEDColor_y, objID.OBJ_LED,
               self._curTStep)
        p = self.properties[key]
        p.value = data['color_y']

        # CCT
        key = (PropertyID.PID_LEDCCT, objID.OBJ_LED,
               self._curTStep)
        p = self.properties[key]
        p.value = data['CCT']

        # RadPower
        key = (PropertyID.PID_LEDRadiantPower, objID.OBJ_LED,
               self._curTStep)
        p = self.properties[key]
        p.value = data['radPower']
Exemplo n.º 3
0
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import os
import io
import pyraytracer.fileTools as ft


# Set axes equal
axesEqual = False

# Create figure
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
fpath = "AllDetector_1_LED.bin"

df = ft.loadDetectorData(fpath)


# plot
plt.plot(df['x'], df['y'], df['z'], 'x')

# Equalize axes (approximately, maybe)
if axesEqual:
    axLim = ax.get_w_lims()
    MAX = np.max(axLim)
    for direction in (-1, 1):
        for point in np.diag(direction * MAX * np.array([1, 1, 1])):
            ax.plot([point[0]], [point[1]], [np.abs(point[2])], 'w')


plt.show()
Exemplo n.º 4
0
    def _tracerProcessEnded(self, lines):
        # Check if process ended correctly
        # TODO! raise APIError (temporarily commented out for testing)
        if "########## Tracing done ################" in lines:
            logger.info("Tracing successful!")
        else:
            for line in lines:
                logger.debug(line)
            print(lines)
            logger.info("Tracing was not successful!")
            raise APIError.APIError("Tracing was not successful!")

        # Read absorption data
        (points, absorb) = vtkS.readAbsorptionData(self._absorptionFilePath)
        # print(points)
        # print(absorb)

        # Get field
        key = (FieldID.FID_Thermal_absorption_volume, self._curTStep)
        print(self.fields)
        f = self.fields[key]

        # Convert point data to field mesh
        if self._convertPointData:
            if meshS.FASTisAvailable():
                meshS.convertPointDataToMeshFAST(
                    pointdataVTKfile=self._absorptionFilePath,
                    field=f,
                    inplace=True)
            else:
                meshS.convertPointDataToMesh(points, absorb, f, inplace=True)

        # Read line data (if needed): (TODO: not tested)
        # (pts, wv, offs) = vtkS.readLineData("ray_paths.vtp")

        # Read photometric data from overall detector
        df = ft.loadDetectorData('AllDetector_1_LED.bin')
        data = dt.convertToSphere(df)

        # Set data to properties
        # Spectrum
        key = (PropertyID.PID_LEDSpectrum, objID.OBJ_LED, self._curTStep)
        p = self.properties[key]
        p.value['wavelengths'] = data['wavelengths']
        p.value['intensities'] = data['intensities']

        # Color x
        key = (PropertyID.PID_LEDColor_x, objID.OBJ_LED, self._curTStep)
        p = self.properties[key]
        p.value = data['color_x']

        # Color y
        key = (PropertyID.PID_LEDColor_y, objID.OBJ_LED, self._curTStep)
        p = self.properties[key]
        p.value = data['color_y']

        # CCT
        key = (PropertyID.PID_LEDCCT, objID.OBJ_LED, self._curTStep)
        p = self.properties[key]
        p.value = data['CCT']

        # RadPower
        key = (PropertyID.PID_LEDRadiantPower, objID.OBJ_LED, self._curTStep)
        p = self.properties[key]
        p.value = data['radPower']