Skip to content
Snippets Groups Projects
Commit 2c8dee22 authored by unknown's avatar unknown
Browse files

Change return List to numpy array

parent aeb6d6da
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,7 @@ class Layer: ...@@ -25,7 +25,7 @@ class Layer:
phiLow = np.arctan(int(x/0.0025-1)*0.0025/self.Position) #^arctan ^round x to next upper/lower 25 mikrometer ^adjacent phiLow = np.arctan(int(x/0.0025-1)*0.0025/self.Position) #^arctan ^round x to next upper/lower 25 mikrometer ^adjacent
else: else:
return None # if the Layer is not hit, return "None" return ((None, None), (None, None)) # if the Layer is not hit, return "None"
if 0 <= y < 50: if 0 <= y < 50:
thetaHigh = np.arctan(int(y/0.0025+1)*0.0025/self.Position) thetaHigh = np.arctan(int(y/0.0025+1)*0.0025/self.Position)
...@@ -36,7 +36,7 @@ class Layer: ...@@ -36,7 +36,7 @@ class Layer:
thetaLow = np.arctan(int(y/0.0025-1)*0.0025/self.Position) thetaLow = np.arctan(int(y/0.0025-1)*0.0025/self.Position)
else: else:
return None return ((None, None), (None, None))
return ((phiHigh, phiLow), (thetaHigh, thetaLow)) return ((phiHigh, phiLow), (thetaHigh, thetaLow))
...@@ -56,9 +56,11 @@ class Detector: ...@@ -56,9 +56,11 @@ class Detector:
"""Calculate for a given angles (phi, theta) the hitted grid. """Calculate for a given angles (phi, theta) the hitted grid.
Returns the angles from source to grid edge or "None" if the Layer is not hitted""" Returns the angles from source to grid edge or "None" if the Layer is not hitted"""
result = []
for Layer in [self.Layer1, self.Layer2, self.Layer3, self.Layer4, self.Layer5]: for Layer in [self.Layer1, self.Layer2, self.Layer3, self.Layer4, self.Layer5]:
result.append(Layer.detect((phi, theta))) if Layer == self.Layer1: #First Time creat numpy array
result = np.array([Layer.detect((phi, theta))])
else: #For rest, just add
result = np.append(result, [Layer.detect((phi, theta))], axis = 0)
return result return result
\ No newline at end of file
...@@ -33,7 +33,7 @@ phi, theta: represents the angles of the particle starting from the source<br> ...@@ -33,7 +33,7 @@ phi, theta: represents the angles of the particle starting from the source<br>
phi is for the x-axis [-pi,pi]<br> phi is for the x-axis [-pi,pi]<br>
theta is for the y-axis [-pi,pi]<br><br> theta is for the y-axis [-pi,pi]<br><br>
*Return:*<br> *Return:*<br>
Returns a List of 5 Tuples, each Tuple has 2 Tuples with a higher and a lower angle bound.<br> Returns a numpy array with 5 entries, each Tuple has 2 Tuples with a higher and a lower angle bound.<br>
This means:<br> This means:<br>
e.g. returnvalue [a][b][c]<br> e.g. returnvalue [a][b][c]<br>
a – [0,4] select Layer<br> a – [0,4] select Layer<br>
...@@ -41,7 +41,7 @@ b ...@@ -41,7 +41,7 @@ b
c – 0 is the upper bound, 1 the lower bound<br><br> c – 0 is the upper bound, 1 the lower bound<br><br>
If a Layer is not hit, the Tuple is “None”<br> If a Layer is not hit, the Tuple is “None”<br>
e.g. returnvalue [a] is “None”<br> e.g. returnvalue [a] is “((None, None)( None, None))<br>
...@@ -80,6 +80,6 @@ This means:<br> ...@@ -80,6 +80,6 @@ This means:<br>
e.g. returnvalue [a][b]<br> e.g. returnvalue [a][b]<br>
a – 0 is phi, 1 is theta<br> a – 0 is phi, 1 is theta<br>
b – 0 is the upper bound, 1 the lower bound<br><br> b – 0 is the upper bound, 1 the lower bound<br><br>
If this Layer is not hit, the Tuple is “None”<br> If this Layer is not hit, the Tuple is “((None, None)( None, None))<br>
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment