Ejemplo n.º 1
0
    def set_noise(self,
                  noise=None,
                  noise_spread=None,
                  noise_variation_n=None,
                  noise_filename=None,
                  noise_dataset=None):
        r"""
        Set detector noise type and parameters (this method is called during initialisation)

        Kwargs:
          :noise (str): Noise added to the predicted intensities  (default ``None``)
            
            *Choose one of the following options:*

            ======================= ==================================================================
            ``noise``               Noise model
            ======================= ==================================================================
            ``None``                No noise
            ``'poisson'``           Poisson noise (*shot noise*)
            ``'normal'``            Normal (*Gaussian*) noise 
            ``'uniform'``           Uniformly distributed values within spread limits
            ``'normal_poisson'``    Normal (*Gaussian*) noise on top of Poisson noise (*shot noise*)
            ``'file'``              Noise data from file
            ``'file_poisson'``      Noise data from file on top of Poisson noise (*shot noise*)
            ======================= ==================================================================

          :noise_spread (float): Width (full width at half maximum) of the Gaussian or uniform noise distribution  (default ``None``) 

            .. note:: The argument ``noise_spread`` takes only effect in combination with ``noise='normal'``, ``'uniform'`` or ``'normal_poisson'``

          :noise_filename (str): Location of the HDF5 file that contains the noise data  (default ``None``)

          :noise_dataset (str):  HDF5 dataset (in the file specified by the argument ``noise_filename``) that contains the noise data  (default ``None``)

            .. note:: The arguments ``noise_filename`` and ``noise_dataset`` takes effect only in combination with ``noise='file'`` or ``'file_poisson'``
        """
        if noise in ["file", "file_poisson"]:
            self._noise_filename = noise_filename
            self._noise_dataset = noise_dataset
            self._noise = Variation(
                "poisson" if noise == "file_poisson" else None,
                noise_spread,
                noise_variation_n,
                number_of_dimensions=1)
        else:
            self._noise_filename = None
            self._noise_dataset = None
            self._noise = Variation(noise,
                                    noise_spread,
                                    noise_variation_n,
                                    number_of_dimensions=1)
Ejemplo n.º 2
0
    def set_pulse_energy_variation(self,
                                   pulse_energy_variation=None,
                                   pulse_energy_spread=None,
                                   pulse_energy_variation_n=None):
        """
        Set variation of the pulse energy

        Kwargs:
          :pulse_energy_variation (str): Statistical variation of the pulse energy (default ``None``)

            *Choose one of the following options:*

              - ``\'normal\'`` - random normal (Gaussian) distribution

              - ``\'uniform\'`` - random uniform distribution

              - ``\'range\'`` - equispaced pulse energies around ``pulse_energy``

              - ``None`` - no variation of the pulse energy
      
          :pulse_energy_spread (float): Statistical spread of the pulse energy in unit Joule (default ``None``)
      
          :pulse_energy_variation_n (int): Number of samples within the specified range

            .. note:: The argument ``pulse_energy_variation_n`` takes effect only in combination with ``pulse_energy_variation=\'range\'``
        """
        self._pulse_energy_variation = Variation(pulse_energy_variation,
                                                 pulse_energy_spread,
                                                 pulse_energy_variation_n,
                                                 number_of_dimensions=1)
Ejemplo n.º 3
0
    def set_flattening_variation(self, flattening_variation, flattening_spread,
                                 flattening_variation_n):
        """
        Set the variation scheme of the flattening parameter
        
        Args:
          :flattening_variation (str): Variation of the particle flattening

            *Choose one of the following options:*
              
              - ``None`` - No variation

              - ``\'normal\'`` - Normal (*Gaussian*) variation

              - ``\'uniform\'`` - Uniformly distributed flattenings

              - ``\'range\'`` - Equidistant sequence of particle-flattening samples within the spread limits. ``flattening_variation_n`` defines the number of samples within the range

          :flattening_spread (float): Statistical spread of the parameter

          :flattening_variation_n (int): Number of particle-flattening samples within the specified range

            .. note:: The argument ``flattening_variation_n`` takes effect only if ``flattening_variation=\'range\'``
        """
        self._flattening_variation = Variation(flattening_variation,
                                               flattening_spread,
                                               flattening_variation_n)
Ejemplo n.º 4
0
    def set_diameter_variation(self, diameter_variation, diameter_spread, diameter_variation_n):
        r"""
        Set the variation scheme of the particle diameter
        
        Args:
          :diameter_variation (str): Variation of the particle diameter

            *Choose one of the following options:*

            ====================== ============================================================================================
            ``diameter_variation`` Type of variation
            ====================== ============================================================================================
            ``None``               No diameter variation
            ``'normal'``           Normal (*Gaussian*) variation
            ``'uniform'``          Uniformly distributed diameters within spread limits
            ``'range'``            Equidistant sequence of ``diameter_variation_n`` diameter samples within ``diameter_spread``
            ====================== ============================================================================================

          :diameter_spread (float): Statistical spread

          :diameter_variation_n (int): Number of particle-diameter samples within the specified range

            .. note:: The argument ``diameter_variation_n`` takes effect only if ``diameter_variation='range'``
        """
        self._diameter_variation = Variation(diameter_variation, diameter_spread, diameter_variation_n)       
Ejemplo n.º 5
0
    def set_position_variation(self, position_variation, position_spread, position_variation_n):
        r"""
        Set position variation scheme

        Args:
          :position_variation (str): Statistical variation of the particle position (default ``None``)

            *Choose one of the following options:*
        
            ====================== ============================================================================================
            ``position_variation`` Type of variation
            ====================== ============================================================================================
            ``None``               No positional variation
            ``'normal'``           Normal (*Gaussian*) variation
            ``'uniform'``          Uniformly distributed positions within spread limits
            ``'range'``            Equidistant sequence of ``position_variation_n`` position samples within ``position_spread``
            ====================== ============================================================================================

          :position_spread (float): Statistical spread of the particle position

          :position_variation_n (int): Number of position samples within the specified range in each dimension

            .. note:: The argument ``position_variation_n`` takes effect only in combination with ``position_variation='range'``
        """
        self._position_variation = Variation(position_variation,position_spread,position_variation_n,number_of_dimensions=3)
Ejemplo n.º 6
0
    def set_center_variation(self, center_variation=None, center_spread_x=None, center_spread_y=None, center_variation_n=None):
        """
        Set the variation of the beam center position (this method is called during initialisation)
        
        Kwargs:
          :center_variation(str): Variation of the beam center position (default ``None``)

            *Choose one of the following options:*
            
            ===================== ==============================================
            ``center_variation``  Variation model
            ===================== ==============================================
            ``None``              No variation
            ``'normal'``          Normal (*Gaussian*) random distribution
            ``'uniform'``         Uniform random distribution
            ``'range'``           Equispaced grid around mean center position
            ===================== ==============================================

          :center_spread_x (float): Width of the distribution of center position in *x* [pixel] (default ``None``)
    
          :center_spread_y (float): Width of the distribution of center position in *y* [pixel] (default ``None``)
    
            .. note:: The arguments ``center_spread_y`` and ``center_spread_x`` take effect only in combination with ``center_variation='normal'``, ``'uniform'`` or ``'range'``

          :center_variation_n (int): Number of samples within the specified range (default ``None``)

            .. note:: The argument ``center_variation_n`` takes effect only in combination with ``center_variation='range'``
        """

        
        self._center_variation = Variation(center_variation, [center_spread_x,center_spread_y], center_variation_n, number_of_dimensions=2)