Difference between GetAllDetectorData() and GetAllDetectorDataSafe()

  • 4 April 2023
  • 1 reply
  • 134 views

Userlevel 4
Badge +2

GetAllDetectorData() and GetAllDetectorDataSafe() are both methods that can be used to retrieve detector data for a specified detector object. 

  1. The main difference between the two methods is that GetAllDetectorDataSafe() returns a two-dimensional array of double values double[,] that contains all the detector data for the detector object, while GetAllDetectorData() returns a boolean value that indicates whether the detector data was retrieved successfully, and one-dimensional array double[] .
  2. GetAllDetectorDataSafe() does not require the input of numPixels and detectorData, whereas GetAllDetectorData() requires these parameters in addition to (detector) ObjectNumber and Data(type).

Check the examples to use the two methods: 

For python: 

TheNCE = TheSystem.NCE
DetObj = 4
obj = TheSystem.NCE.GetObjectAt(DetObj);
numXPixels = obj.ObjectData.NumberXPixels;
numYPixels = obj.ObjectData.NumberYPixels;

DetRectangleData_FluxArea = TheSystem.NCE.GetAllDetectorDataSafe(4, 1)
for x in range(numXPixels):
for y in range(numYPixels):
print(DetRectangleData_FluxArea[x,y])

numPixels=numXPixels*numYPixels
detectorData=np.zeros(numPixels, dtype=np.float64)
bool_value, detectorData= TheNCE.GetAllDetectorData(DetObj, 1, numPixels,detectorData)
for i in range(numPixels):
print(detectorData[i])

For matlab: 

TheNCE = TheSystem.NCE;

DetObj = 4;
obj = TheSystem.NCE.GetObjectAt(DetObj);
numXPixels = obj.ObjectData.NumberXPixels;
numYPixels = obj.ObjectData.NumberYPixels;

DetRectangleData_FluxArea = TheSystem.NCE.GetAllDetectorDataSafe(4, 1);
for x = 1:numXPixels
for y = 1:numYPixels
disp(DetRectangleData_FluxArea(x,y));
end
end

numPixels=numXPixels*numYPixels;
detectorData=NET.createArray('System.Double', TheNCE.GetDetectorSize(4));
bool_value=TheSystem.NCE.GetAllDetectorData(DetObj, 1,TheNCE.GetDetectorSize(4),detectorData);
for i = 1:numPixels
disp(detectorData(i));
end

 

In matlab, the retrieved data from GetAllDetectorData() need to be rearranged from 1D array to a matrix, detectorData = flipud(rot90(reshape(data.double, rows, cols)));

and here is a simple example to show the transform:

 


1 reply

Userlevel 4
Badge +2

If the detector pattern is not symmetric or the X/Y pixels are not the same, use (in Matlab):

[~, rows, cols] = TheNCE.GetDetectorDimensions(4);

detectorData = flipud(rot90(reshape(data.double, cols, rows)));

% Create new figure figure;

figure;

surf(detectorData);

axis([1 cols 1 rows]);

view(2);

xlabel('X pixel');

ylabel('Y pixel');

title('Incoherent Illuminance [lm/cm^2]');

colorbar;

Reply