Package theia :: Package optics :: Module mirror
[hide private]
[frames] | no frames]

Source Code for Module theia.optics.mirror

  1  '''Defines the Mirror class for theia.''' 
  2   
  3  # Provides: 
  4  #   class Mirror 
  5  #       __init__ 
  6  #       lines 
  7   
  8  import numpy as np 
  9  from ..helpers import geometry, settings 
 10  from ..helpers.units import deg, cm, pi 
 11  from .optic import Optic 
 12   
13 -class Mirror(Optic):
14 ''' 15 16 Mirror class. 17 18 This class represents semi reflective mirrors composed of two faces (HR, AR) 19 and with a wedge angle. These are the objects with which the beams will 20 interact during the ray tracing. Please see the documentation for details 21 on the geometric construction of these mirrors. 22 23 Actions: 24 * T on HR: + 1 25 * R on HR: 0 26 * T on AR: 0 27 * R on AR: + 1 28 29 *=== Additional attributes with respect to the Optic class ===* 30 31 None 32 33 *=== Name ===* 34 35 Mirror 36 37 **Note**: the curvature of any surface is positive for a concave surface 38 (coating inside the sphere). 39 Thus kurv*HRNorm/|kurv| always points to the center 40 of the sphere of the surface, as is the convention for the lineSurfInter of 41 geometry module. Same for AR. 42 43 ******* HRK > 0 and ARK > 0 ******* HRK > 0 and ARK < 0 44 ***** ******** and |ARK| > |HRK| 45 H***A H*********A 46 ***** ******** 47 ******* ******* 48 49 ''' 50 51 Name = "Mirror"
52 - def __init__(self, Wedge = 0., Alpha = 0., X = 0., Y = 0., Z = 0., 53 Theta = pi/2., Phi = 0., Diameter = 10.e-2, 54 HRr = .99, HRt = .01, ARr = .1, ARt = .9, 55 HRK = 0.01, ARK = 0, Thickness = 2.e-2, 56 N = 1.4585, KeepI = False, Ref = None):
57 '''Mirror initializer. 58 59 Parameters are the attributes. 60 61 Returns a mirror. 62 63 ''' 64 # actions 65 TonHR = 1 66 RonHR = 0 67 TonAR = 0 68 RonAR = 1 69 70 # Initialize input data 71 N = float(N) 72 Wedge = float(Wedge) 73 Alpha = float(Alpha) 74 Theta = float(Theta) 75 Phi = float(Phi) 76 Diameter = float(Diameter) 77 Thickness = float(Thickness) 78 HRK = float(HRK) 79 ARK = float(ARK) 80 HRt = float(HRt) 81 HRr = float(HRr) 82 ARt = float(ARt) 83 ARr = float(ARr) 84 85 #prepare for mother initializer 86 HRNorm = np.array([np.sin(Theta)*np.cos(Phi), 87 np.sin(Theta) * np.sin(Phi), 88 np.cos(Theta)], dtype = np.float64) 89 90 HRCenter = np.array([X, Y, Z], dtype = np.float64) 91 92 #Calculate ARCenter and ARNorm with wedge and alpha and thickness: 93 ARCenter = HRCenter\ 94 - (Thickness + .5 * np.tan(Wedge) * Diameter) * HRNorm 95 96 a,b = geometry.basis(HRNorm) 97 ARNorm = -np.cos(Wedge) * HRNorm\ 98 + np.sin(Wedge) * (np.cos(Alpha) * a\ 99 + np.sin(Alpha) * b) 100 101 super(Mirror, self).__init__(ARCenter = ARCenter, ARNorm = ARNorm, 102 N = N, HRK = HRK, ARK = ARK, ARr = ARr, ARt = ARt, HRr = HRr, HRt = HRt, 103 KeepI = KeepI, HRCenter = HRCenter, HRNorm = HRNorm, 104 Thickness = Thickness, Diameter = Diameter, 105 Wedge = Wedge, Alpha = Alpha, 106 TonHR = TonHR, RonHR = RonHR, TonAR = TonAR, RonAR = RonAR, 107 Ref = Ref) 108 109 #Warnings for console output 110 if settings.warning: 111 self.geoCheck("mirror")
112
113 - def lines(self):
114 '''Returns the list of lines necessary to print the object.''' 115 sph = geometry.rectToSph(self.HRNorm) 116 117 return ["Mirror: %s {" %str(self.Ref), 118 "Thick: %scm" %str(self.Thick/cm), 119 "Diameter: %scm" %str(self.Dia/cm) , 120 "Wedge: %sdeg" %str(self.Wedge/deg) , 121 "Alpha: %sdeg" %str(self.Alpha/deg), 122 "HRCenter: %s" %str(self.HRCenter), 123 "HRNorm: (%s, %s)deg" % (str(sph[0]/deg), str(sph[1]/deg)), 124 "Index: %s" %str(self.N), 125 "HRKurv, ARKurv: %s, %s" % (str(self.HRK), str(self.ARK)), 126 "HRr, HRt, ARr, ARt: %s, %s, %s, %s" \ 127 % (str(self.HRr), str(self.HRt), str(self.ARr), str(self.ARt)), 128 "}"]
129