parameters: (self, data_file=None)
return_statement: return script
docstring: Generate reduction script
              @param execute: if true, the script will be executed
docstring_summary: Generate reduction script
docstring_tokens: Generate reduction script
function: def to_script(self, data_file=None):
          """
              Generate reduction script
              @param execute: if true, the script will be executed
          """
          script = ""
  
          # Sample thickness
          if not self.sample_thickness == 1.0:
              script += "DivideByThickness(%g)\n" % self.sample_thickness
  
          if not self.calculate_transmission:
              script += "SetTransmission(%g, %g)\n" % (self.transmission, self.transmission_spread)
          else:
              script += str(self.calculation_method)
  
          script += "ThetaDependentTransmission(%s)\n" % str(self.theta_dependent)
          if self.dark_current is not None and len(str(self.dark_current))>0:
              script += "TransmissionDarkCurrent(\"%s\")\n" % str(self.dark_current)
  
          # Data files
          if len(self.data_files)==0:
              raise RuntimeError("Trying to generate reduction script without a data file.")
  
          if data_file is None:
              data_file_list = self.get_data_file_list()
              parts = os.path.split(str(data_file_list[0]).strip())
              if len(parts[0])>0:
                  script += "DataPath(\"%s\")\n" % parts[0]
              else:
                  script += "#Note: Data path was not found at script generation, will try at run time.\n"
  
              if self.separate_jobs is False:
                  script += "AppendDataFile([\"%s\"])\n" % '\",\"'.join(data_file_list)
              else:
                  for f in data_file_list:
                      script += "AppendDataFile([\"%s\"])\n" % f
          else:
              parts = os.path.split(str(data_file).strip())
              if len(parts[0])>0:
                  script += "DataPath(\"%s\")\n" % parts[0]
              else:
                  script += "#Note: Data path was not found at script generation, will try at run time.\n"
              script += "AppendDataFile([\"%s\"])\n" % str(data_file)
  
          return script
function_tokens: def to_script ( self , data_file = None ) : script = "" # Sample thickness if not self . sample_thickness == 1.0 : script += "DivideByThickness(%g)\n" % self . sample_thickness if not self . calculate_transmission : script += "SetTransmission(%g, %g)\n" % ( self . transmission , self . transmission_spread ) else : script += str ( self . calculation_method ) script += "ThetaDependentTransmission(%s)\n" % str ( self . theta_dependent ) if self . dark_current is not None and len ( str ( self . dark_current ) ) > 0 : script += "TransmissionDarkCurrent(\"%s\")\n" % str ( self . dark_current ) # Data files if len ( self . data_files ) == 0 : raise RuntimeError ( "Trying to generate reduction script without a data file." ) if data_file is None : data_file_list = self . get_data_file_list ( ) parts = os . path . split ( str ( data_file_list [ 0 ] ) . strip ( ) ) if len ( parts [ 0 ] ) > 0 : script += "DataPath(\"%s\")\n" % parts [ 0 ] else : script += "#Note: Data path was not found at script generation, will try at run time.\n" if self . separate_jobs is False : script += "AppendDataFile([\"%s\"])\n" % '\",\"' . join ( data_file_list ) else : for f in data_file_list : script += "AppendDataFile([\"%s\"])\n" % f else : parts = os . path . split ( str ( data_file ) . strip ( ) ) if len ( parts [ 0 ] ) > 0 : script += "DataPath(\"%s\")\n" % parts [ 0 ] else : script += "#Note: Data path was not found at script generation, will try at run time.\n" script += "AppendDataFile([\"%s\"])\n" % str ( data_file ) return script