parameters: (self)
return_statement: return script
docstring: Generate reduction script
docstring_summary: Generate reduction script
docstring_tokens: Generate reduction script
function: def to_script(self):
          """
              Generate reduction script
          """
  
          script = "%s()\n" % self.instrument_name
  
          if self.sample_detector_distance != 0:
              script += "SetSampleDetectorDistance(%g)\n" % self.sample_detector_distance
          if self.detector_offset != 0:
              script += "SetSampleDetectorOffset(%g)\n" % self.detector_offset
          if self.wavelength != 0:
              script += "SetWavelength(%g, %g)\n" % (self.wavelength,
                                                     self.wavelength_spread)
  
          if self.solid_angle_corr:
              script += "SolidAngle(detector_tubes=True)\n"
          else:
              script += "NoSolidAngle()\n"
  
          if self.dark_current_corr:
              if len(str(self.dark_current_data).strip()) == 0:
                  raise RuntimeError(
                      "Dark current subtraction was selected but no sensitivity data file was entered.")
              script += "DarkCurrent(\"%s\")\n" % self.dark_current_data
  
          script += self._normalization_options()
  
          if self.calculate_scale:
              scaling_params = ""
              if self.manual_beam_diam:
                  scaling_params += ", beamstop_diameter=%g" % self.scaling_beam_diam
  
              script += "SetDirectBeamAbsoluteScale(\"%s\", attenuator_trans=%g%s)\n" % \
                  (self.scaling_direct_file, self.scaling_att_trans, scaling_params)
          else:
              script += "SetAbsoluteScale(%g)\n" % self.scaling_factor
  
          # Q binning
          script += "AzimuthalAverage(n_bins=%g, n_subpix=%g, log_binning=%s" % (
              self.n_q_bins, self.n_sub_pix, str(self.log_binning))
          if self.align_log_with_decades:
              script += ", align_log_with_decades=%s" % str(
                  self.align_log_with_decades)
          if self.error_weighting:
              script += ", error_weighting=%s" % str(self.error_weighting)
          script += ")\n"
  
          # If we align we decades, use more points for I(qx,qy)
          n_xy_bins = self.n_q_bins
          if self.log_binning and self.align_log_with_decades:
              n_xy_bins = int(3 * self.n_q_bins)
          script += "IQxQy(nbins=%g)\n" % n_xy_bins
  
          if self.n_wedges > 0:
              script += "SetWedges(number_of_wedges=%g, wedge_angle=%g, wedge_offset=%g)\n" % (
                  self.n_wedges, self.wedge_angle, self.wedge_offset)
  
          # Mask
          #   Detector plane
          if self.masked_side is not None:
              script += "MaskDetectorSide('%s')\n" % str(self.masked_side)
          #   Edges
          if self.top != 0 or self.bottom != 0 or self.left != 0 or self.right != 0:
              script += "Mask(nx_low=%d, nx_high=%d, ny_low=%d, ny_high=%d)\n" % (
                  self.left, self.right, self.bottom, self.top)
          #   Rectangles
          for item in self.shapes:
              script += "MaskRectangle(x_min=%g, x_max=%g, y_min=%g, y_max=%g)\n" % (
                  item.x_min, item.x_max, item.y_min, item.y_max)
          #   Detector IDs
          if len(self.detector_ids) > 0 and self.use_mask_file:
              script += "MaskDetectors(%s)\n" % str(self.detector_ids)
          # Output directory
          if not self.use_data_directory:
              script += "OutputPath(\"%s\")\n" % self.output_directory
  
          return script
function_tokens: def to_script ( self ) : script = "%s()\n" % self . instrument_name if self . sample_detector_distance != 0 : script += "SetSampleDetectorDistance(%g)\n" % self . sample_detector_distance if self . detector_offset != 0 : script += "SetSampleDetectorOffset(%g)\n" % self . detector_offset if self . wavelength != 0 : script += "SetWavelength(%g, %g)\n" % ( self . wavelength , self . wavelength_spread ) if self . solid_angle_corr : script += "SolidAngle(detector_tubes=True)\n" else : script += "NoSolidAngle()\n" if self . dark_current_corr : if len ( str ( self . dark_current_data ) . strip ( ) ) == 0 : raise RuntimeError ( "Dark current subtraction was selected but no sensitivity data file was entered." ) script += "DarkCurrent(\"%s\")\n" % self . dark_current_data script += self . _normalization_options ( ) if self . calculate_scale : scaling_params = "" if self . manual_beam_diam : scaling_params += ", beamstop_diameter=%g" % self . scaling_beam_diam script += "SetDirectBeamAbsoluteScale(\"%s\", attenuator_trans=%g%s)\n" % ( self . scaling_direct_file , self . scaling_att_trans , scaling_params ) else : script += "SetAbsoluteScale(%g)\n" % self . scaling_factor # Q binning script += "AzimuthalAverage(n_bins=%g, n_subpix=%g, log_binning=%s" % ( self . n_q_bins , self . n_sub_pix , str ( self . log_binning ) ) if self . align_log_with_decades : script += ", align_log_with_decades=%s" % str ( self . align_log_with_decades ) if self . error_weighting : script += ", error_weighting=%s" % str ( self . error_weighting ) script += ")\n" # If we align we decades, use more points for I(qx,qy) n_xy_bins = self . n_q_bins if self . log_binning and self . align_log_with_decades : n_xy_bins = int ( 3 * self . n_q_bins ) script += "IQxQy(nbins=%g)\n" % n_xy_bins if self . n_wedges > 0 : script += "SetWedges(number_of_wedges=%g, wedge_angle=%g, wedge_offset=%g)\n" % ( self . n_wedges , self . wedge_angle , self . wedge_offset ) # Mask #   Detector plane if self . masked_side is not None : script += "MaskDetectorSide('%s')\n" % str ( self . masked_side ) #   Edges if self . top != 0 or self . bottom != 0 or self . left != 0 or self . right != 0 : script += "Mask(nx_low=%d, nx_high=%d, ny_low=%d, ny_high=%d)\n" % ( self . left , self . right , self . bottom , self . top ) #   Rectangles for item in self . shapes : script += "MaskRectangle(x_min=%g, x_max=%g, y_min=%g, y_max=%g)\n" % ( item . x_min , item . x_max , item . y_min , item . y_max ) #   Detector IDs if len ( self . detector_ids ) > 0 and self . use_mask_file : script += "MaskDetectors(%s)\n" % str ( self . detector_ids ) # Output directory if not self . use_data_directory : script += "OutputPath(\"%s\")\n" % self . output_directory return script