parameters: (self, iteration=None, **kwargs)
docstring: Calculates data as specified with "type" for the plot from
          transition_radiation_visualizer.py.
  
          Parameters
          ----------
          iteration : (unsigned) int
              The iteration at which to read the data.
          kwargs: dictionary with further keyword arguments, valid are:
              species: string
                  short name of the particle species, e.g. 'e' for electrons
                  (defined in ``speciesDefinition.param``)
              iteration: int
                  number of the iteration
              time: float
                  simulation time.
                  Only one of 'iteration' or 'time' should be passed!
              type: string
                  name of figure type. valid figure types are:
                      'spectrum' - (default) plots transition radiation spectrum
                          at angles theta and phi over the frequency omega
                      'sliceovertheta' - shows angular distribution of
                      transition radiation
                          at a fixed angle phi and frequency omega
                      'sliceoverphi' - shows angular distribution of
                      transition radiation
                          at a fixed angle theta and frequency omega
                      'heatmap' - shows angular distribution as heatmap over
                      both observation angles
              phi: int
                  index of polar angle for a fixed value
              theta: int
                  index of azimuth angle for a fixed value
              omega: int
                  index of frequency for a fixed value, pointless in a spectrum
  
          Returns
          -------
          A tuple of the x and y values for the plot as one dimensional arrays
          for normal figures
          (not heatmaps) and as colormeshes for heatmaps.
docstring_summary: Calculates data as specified with "type" for the plot from
          transition_radiation_visualizer.py.
docstring_tokens: Calculates data as specified with type for the plot from transition_radiation_visualizer . py .
function: def get_data(self, iteration=None, **kwargs):
          """
          Calculates data as specified with "type" for the plot from
          transition_radiation_visualizer.py.
  
          Parameters
          ----------
          iteration : (unsigned) int
              The iteration at which to read the data.
          kwargs: dictionary with further keyword arguments, valid are:
              species: string
                  short name of the particle species, e.g. 'e' for electrons
                  (defined in ``speciesDefinition.param``)
              iteration: int
                  number of the iteration
              time: float
                  simulation time.
                  Only one of 'iteration' or 'time' should be passed!
              type: string
                  name of figure type. valid figure types are:
                      'spectrum' - (default) plots transition radiation spectrum
                          at angles theta and phi over the frequency omega
                      'sliceovertheta' - shows angular distribution of
                      transition radiation
                          at a fixed angle phi and frequency omega
                      'sliceoverphi' - shows angular distribution of
                      transition radiation
                          at a fixed angle theta and frequency omega
                      'heatmap' - shows angular distribution as heatmap over
                      both observation angles
              phi: int
                  index of polar angle for a fixed value
              theta: int
                  index of azimuth angle for a fixed value
              omega: int
                  index of frequency for a fixed value, pointless in a spectrum
  
          Returns
          -------
          A tuple of the x and y values for the plot as one dimensional arrays
          for normal figures
          (not heatmaps) and as colormeshes for heatmaps.
          """
          if iteration is None:
              raise ValueError("Can't return data for an unknown iteration!")
          if self.data is None:
              self.data = self._get_for_iteration(kwargs["species"], iteration,
                                                  **kwargs)
  
          # Specify plot type
          type = kwargs["type"]
  
          # Load fixed values for observation angles from arguments, if given
          theta = kwargs["theta"]
          phi = kwargs["phi"]
          omega = kwargs["omega"]
  
          # Cast parameters to int and check for legitimacy
          if theta is not None:
              theta = int(theta)
              if theta < 0 or theta >= len(self.thetas):
                  raise ValueError("Invalid index for Theta!")
          if phi is not None:
              phi = int(phi)
              if phi < 0 or phi >= len(self.phis):
                  raise ValueError("Invalid index for Phi!")
          if omega is not None:
              omega = int(omega)
              if omega < 0 or omega >= len(self.omegas):
                  raise ValueError("Invalid index for Omega!")
  
          if type == "spectrum":
              # find phi and theta with maximum intensity if they are not
              # given as parameters
              if theta is None and phi is None:
                  maxIndex = np.argmax(self.data[:, :], 0)
                  theta = int(np.floor(maxIndex[0] / len(self.phis)))
                  phi = maxIndex[0] % len(self.phis)
              elif theta is None and phi is not None:
                  theta = np.argmax(self.data[phi::len(self.phis), :], 0)[0]
              elif theta is not None and phi is None:
                  phi = np.argmax(self.data[
                                  theta * len(self.phis):(theta + 1) * len(
                                      self.phis):, :], 0)[0]
  
              print("Spectrum is plotted at phi={:.2e} and theta={:.2e}".format(
                  self.phis[phi], self.thetas[theta]))
              return self.omegas, self.data[theta * len(self.phis) + phi, :]
          elif type == "sliceovertheta":
              # find phi and omega with maximum intensity if they are not
              # given as parameters
              if omega is None and phi is None:
                  maxIndex = np.argmax(self.data[:, :], 0)
                  phi = maxIndex[0] % len(self.phis)
                  omega = 0
              if omega is not None and phi is None:
                  maxIndex = np.argmax(self.data[:, omega])
                  phi = maxIndex % len(self.phis)
              if omega is None and phi is not None:
                  omega = 0
  
              print("Angular intensity distribution is sliced at phi={:.2e} "
                    "with omega={:.2e}.".format(self.phis[phi],
                                                self.omegas[omega]))
              return self.thetas, self.data[phi::len(self.phis), omega]
          elif type == "sliceoverphi":
              # find theta and omega with maximum intensity if they are not
              # given as parameters
              if theta is None and omega is None:
                  maxIndex = np.argmax(self.data[:, :], 0)
                  theta = int(np.floor(maxIndex[0] / len(self.phis)))
                  omega = 0
              if theta is not None and omega is None:
                  omega = 0
              if theta is None and omega is not None:
                  maxIndex = np.argmax(self.data[:, omega])
                  theta = int(np.floor(maxIndex / len(self.phis)))
  
              print("Angular intensity distribution is sliced at theta={:.2e} "
                    "with omega={:.2e}.".format(self.thetas[theta],
                                                self.omegas[omega]))
              return self.phis, self.data[
                                theta * len(self.phis):(theta + 1) * len(
                                    self.phis), omega]
          elif type == "heatmap":
              # find omega with maximum intensity if it is not given as parameter
              if omega is None:
                  omega = 0
              # meshgrids for visualization
              theta_mesh, phi_mesh = np.meshgrid(self.thetas, self.phis)
  
              print("Heatmap is for omega={:.2e}.".format(self.omegas[omega]))
              return theta_mesh, phi_mesh, self.data[::, omega].reshape(
                  (len(self.thetas), len(self.phis))).transpose()
          else:
              raise ValueError("Illegal type of figure!")
function_tokens: def get_data ( self , iteration = None , * * kwargs ) : if iteration is None : raise ValueError ( "Can't return data for an unknown iteration!" ) if self . data is None : self . data = self . _get_for_iteration ( kwargs [ "species" ] , iteration , * * kwargs ) # Specify plot type type = kwargs [ "type" ] # Load fixed values for observation angles from arguments, if given theta = kwargs [ "theta" ] phi = kwargs [ "phi" ] omega = kwargs [ "omega" ] # Cast parameters to int and check for legitimacy if theta is not None : theta = int ( theta ) if theta < 0 or theta >= len ( self . thetas ) : raise ValueError ( "Invalid index for Theta!" ) if phi is not None : phi = int ( phi ) if phi < 0 or phi >= len ( self . phis ) : raise ValueError ( "Invalid index for Phi!" ) if omega is not None : omega = int ( omega ) if omega < 0 or omega >= len ( self . omegas ) : raise ValueError ( "Invalid index for Omega!" ) if type == "spectrum" : # find phi and theta with maximum intensity if they are not # given as parameters if theta is None and phi is None : maxIndex = np . argmax ( self . data [ : , : ] , 0 ) theta = int ( np . floor ( maxIndex [ 0 ] / len ( self . phis ) ) ) phi = maxIndex [ 0 ] % len ( self . phis ) elif theta is None and phi is not None : theta = np . argmax ( self . data [ phi : : len ( self . phis ) , : ] , 0 ) [ 0 ] elif theta is not None and phi is None : phi = np . argmax ( self . data [ theta * len ( self . phis ) : ( theta + 1 ) * len ( self . phis ) : , : ] , 0 ) [ 0 ] print ( "Spectrum is plotted at phi={:.2e} and theta={:.2e}" . format ( self . phis [ phi ] , self . thetas [ theta ] ) ) return self . omegas , self . data [ theta * len ( self . phis ) + phi , : ] elif type == "sliceovertheta" : # find phi and omega with maximum intensity if they are not # given as parameters if omega is None and phi is None : maxIndex = np . argmax ( self . data [ : , : ] , 0 ) phi = maxIndex [ 0 ] % len ( self . phis ) omega = 0 if omega is not None and phi is None : maxIndex = np . argmax ( self . data [ : , omega ] ) phi = maxIndex % len ( self . phis ) if omega is None and phi is not None : omega = 0 print ( "Angular intensity distribution is sliced at phi={:.2e} " "with omega={:.2e}." . format ( self . phis [ phi ] , self . omegas [ omega ] ) ) return self . thetas , self . data [ phi : : len ( self . phis ) , omega ] elif type == "sliceoverphi" : # find theta and omega with maximum intensity if they are not # given as parameters if theta is None and omega is None : maxIndex = np . argmax ( self . data [ : , : ] , 0 ) theta = int ( np . floor ( maxIndex [ 0 ] / len ( self . phis ) ) ) omega = 0 if theta is not None and omega is None : omega = 0 if theta is None and omega is not None : maxIndex = np . argmax ( self . data [ : , omega ] ) theta = int ( np . floor ( maxIndex / len ( self . phis ) ) ) print ( "Angular intensity distribution is sliced at theta={:.2e} " "with omega={:.2e}." . format ( self . thetas [ theta ] , self . omegas [ omega ] ) ) return self . phis , self . data [ theta * len ( self . phis ) : ( theta + 1 ) * len ( self . phis ) , omega ] elif type == "heatmap" : # find omega with maximum intensity if it is not given as parameter if omega is None : omega = 0 # meshgrids for visualization theta_mesh , phi_mesh = np . meshgrid ( self . thetas , self . phis ) print ( "Heatmap is for omega={:.2e}." . format ( self . omegas [ omega ] ) ) return theta_mesh , phi_mesh , self . data [ : : , omega ] . reshape ( ( len ( self . thetas ) , len ( self . phis ) ) ) . transpose ( ) else : raise ValueError ( "Illegal type of figure!" )