def initialize_from_coefficients(cls): if np.array(cls.ccc_object).size != 10: raise Exception("Invalid coefficients (dimension must be 10)") # return Optical_element(ccc=ccc) else: cls.ccc_object = SurfaceConic.initialize_from_coefficients(cls) cls.type = "Surface conical mirror"
def initialize_as_surface_conic_paraboloid_from_focal_distances( cls, p, q, theta=0., alpha=0, infinity_location="q", focal=None, cylindrical=0, cylangle=0.0, switch_convexity=0): #print("p is %d" %(p)) oe = Optical_element(p, q, theta, alpha) oe.type = "Surface conical mirror" oe.focal = focal oe.ccc_object = SurfaceConic() if focal is None: oe.ccc_object.set_paraboloid_from_focal_distance( p, q, np.pi / 2 - theta, infinity_location) else: oe.ccc_object.set_paraboloid_from_focal_distance( p, focal, np.pi / 2 - theta, infinity_location) if cylindrical: oe.ccc_object.set_cylindrical(cylangle) if switch_convexity: oe.ccc_object.switch_convexity() return oe
def initialize_my_hyperboloid(cls, p, q, theta=0.0, alpha=0.0, wolter=None, z0=0., distance_of_focalization=0.): oe = Optical_element(p, q, theta, alpha) oe.type = "My hyperbolic mirror" a = q / np.sqrt(2) b = 1 if wolter == 1: a = abs(z0 - distance_of_focalization) / np.sqrt(2) if wolter == 2: a = abs(z0 - distance_of_focalization) / np.sqrt(2) if wolter == 1.1: a = distance_of_focalization / np.sqrt(2) print("z0=%f, distance_of_focalization=%f, a*sqrt(2)=%f" % (z0, distance_of_focalization, a * np.sqrt(2))) #b = a #print("The value of a at the beggining is: %f" %(a)) #print("The value of b at the beggining is: %f" %(b)) #oe.ccc_object = SurfaceConic(np.array([-1, -1, 1, 0, 0, 0, 0., 0., -2*z0, -z0**2-a**2.])) oe.ccc_object = SurfaceConic( np.array([-1, -1, 1, 0, 0, 0, 0., 0., -2 * z0, z0**2 - a**2.])) #oe.ccc_object = SurfaceConic(np.array([-1/a**2, -1/a**2, 1*b**2, 0, 0, 0, 0., 0., -2*z0/b**2, z0**2/b**2-1])) #print("Manual") #c2 = 1/b**2 #print(c2, -1/a**2, 1/b**2) #oe.ccc_object = SurfaceConic(np.array([-1/a**2, -1/a**2, c2, 0, 0, 0, 0., 0., -2*z0/b**2, z0**2/b**2-1])) return oe
def initialize_as_surface_conic_sphere_from_focal_distances( cls, p, q, theta=0., alpha=0., cylindrical=0, cylangle=0.0, switch_convexity=0): oe = Optical_element(p, q, theta, alpha) oe.type = "Surface conical mirror" oe.ccc_object = SurfaceConic() oe.ccc_object.set_sphere_from_focal_distances(p, q, np.pi / 2 - theta) if cylindrical: oe.ccc_object.set_cylindrical(cylangle) if switch_convexity: oe.ccc_object.switch_convexity() return oe
def initialize_as_surface_conic_from_coefficients(cls, ccc): oe = Optical_element() oe.type = "Surface conical mirror" oe.ccc_object = SurfaceConic(ccc) return oe
def initialize_as_surface_conic_plane(cls, p, q, theta=0.0, alpha=0.0): oe = Optical_element(p, q, theta, alpha) oe.type = "Surface conical mirror" oe.ccc_object = SurfaceConic(np.array([0, 0, 0, 0, 0, 0, 0, 0, -1., 0])) return oe