Exemplo n.º 1
0
    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_spherecial_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.throw = self.throw + 1
        return photon
Exemplo n.º 2
0
 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_spherecial_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.throw = self.throw + 1 
     return photon
Exemplo n.º 3
0
    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
Exemplo n.º 4
0
 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