def photon(self): photon = Photon() photon.source = self.source_id photon.position = np.array(self.position) photon.direction = np.array(self.direction) photon.active = True photon.wavelength = self.wavelength # If use_polarisation is set generate a random polarisation vector of the photon if self.use_random_polarisation: # Randomise rotation angle around xy-plane, the transform from +z to the direction of the photon vec = random_spherical_vector() vec[2] = 0. vec = norm(vec) r = rotation_matrix_from_vector_alignment(self.direction, [0., 0., 1.]) photon.polarisation = transform_direction(vec, r) else: photon.polarisation = None photon.id = self.throw self.log.debug('Emitted photon (pid: ' + str(self.throw) + ')') self.throw += 1 return photon
def photon(self): photon = Photon() photon.source = self.source_id photon.position = np.array(self.position) photon.direction = np.array(self.direction) photon.active = True photon.wavelength = self.wavelength # If use_polarisation is set generate a random polarisation vector of the photon if self.use_random_polarisation: # Randomise rotation angle around xy-plane, the transform from +z to the direction of the photon vec = random_spherical_vector() vec[2] = 0. vec = norm(vec) r = rotation_matrix_from_vector_alignment(self.direction, [0., 0., 1.]) photon.polarisation = transform_direction(vec, r) else: photon.polarisation = None photon.id = self.throw self.log.debug('Emitted photon (pid: ' + str(self.throw)+')') self.throw += 1 return photon
def add_step(self, position=None, direction=None, polarization=None, wavelength=None, active=False, container=None, on_surface_object=None): photon = Photon(wavelength=wavelength, position=position, direction=direction, active=active) photon.polarisation = polarization if str(container) not in self.known_obj: self.known_obj.append(str(container)) photon.container = str(container) if str(on_surface_object) not in self.known_obj: self.known_obj.append(str(on_surface_object)) photon.on_surface_object = str(on_surface_object) self.steps.append(photon)
def photon(self): photon = Photon() photon.source = self.source_id photon.position = np.array(self.position) photon.direction = np.array(self.direction) photon.active = True photon.wavelength = self.wavelength photon.polarisation = self.polarisation photon.id = self.throw self.log.debug('Emitted photon (pid: ' + str(self.throw) + ')') self.throw += 1 return photon
def photon(self): photon = Photon() photon.source = self.source_id photon.position = np.array(self.position) photon.direction = np.array(self.direction) photon.active = True photon.wavelength = self.wavelength photon.polarisation = self.polarisation photon.id = self.throw self.throw = self.throw + 1 return photon
def photon(self): photon = Photon() photon.source = self.source_id photon.position = np.array(self.position) photon.direction = np.array(self.direction) photon.active = True photon.wavelength = self.wavelength photon.polarisation = self.polarisation photon.id = self.throw self.log.debug('Emitted photon (pid: ' + str(self.throw)+')') self.throw += 1 return photon