parameters: (self, out_file=None)
docstring: Print the current options.
          
          This method prints the options in the same format as they are read,
          allowing options to be written to a file and re-used.
  
          Args:
              out_file: A file object (optional). If supplied, options will be
                  written to this file, otherwise they will be printed to
                  sys.stdout.
  
          Raises:
              ValueError: If there is a problem printing the options.
docstring_summary: Print the current options.
          
          This method prints the options in the same format as they are read,
          allowing options to be written to a file and re-used.
docstring_tokens: Print the current options . This method prints the options in the same format as they are read allowing options to be written to a file and re - used .
function: def print_options(self, out_file=None):
          """
          Print the current options.
          
          This method prints the options in the same format as they are read,
          allowing options to be written to a file and re-used.
  
          Args:
              out_file: A file object (optional). If supplied, options will be
                  written to this file, otherwise they will be printed to
                  sys.stdout.
  
          Raises:
              ValueError: If there is a problem printing the options.
          """
          out_file.write("# Options file for relion_it.py\n\n")
          seen_start = False
          option_names = [key for key in dir(self) if (not (key.startswith('__') and key.endswith('__'))
                                                       and not callable(getattr(self, key)))]
  
          # Parse the source code for this class, and write out all comments along with option lines containing new values
          for line in inspect.getsourcelines(RelionItOptions)[0]:
              line = line.strip()
              if not seen_start:
                  if line != "### General parameters":
                      # Ignore lines until this one
                      continue
                  seen_start = True
              if line == "### End of options":
                  # Stop here
                  break
              if line.startswith('#') or len(line) == 0:
                  # Print comments or blank lines as-is
                  out_file.write(line + "\n");
              else:
                  # Assume all other lines define an option name and value. Replace with new value.
                  equals_index = line.find('=')
                  if equals_index > 0:
                      option_name = line[:equals_index].strip()
                      if option_name in option_names:
                          out_file.write('{} = {}\n'.format(option_name, repr(getattr(self, option_name))))
                          option_names.remove(option_name)
                      else:
                          # This error should not occur. If it does, there is probably a programming error.
                          raise ValueError("Unrecognised option name '{}'".format(option_name))
          if len(option_names) > 0:
              # This error should not occur. If it does, there is probably a programming error.
              raise ValueError("Some options were not written to the output file: {}".format(option_names))
function_tokens: def print_options ( self , out_file = None ) : out_file . write ( "# Options file for relion_it.py\n\n" ) seen_start = False option_names = [ key for key in dir ( self ) if ( not ( key . startswith ( '__' ) and key . endswith ( '__' ) ) and not callable ( getattr ( self , key ) ) ) ] # Parse the source code for this class, and write out all comments along with option lines containing new values for line in inspect . getsourcelines ( RelionItOptions ) [ 0 ] : line = line . strip ( ) if not seen_start : if line != "### General parameters" : # Ignore lines until this one continue seen_start = True if line == "### End of options" : # Stop here break if line . startswith ( '#' ) or len ( line ) == 0 : # Print comments or blank lines as-is out_file . write ( line + "\n" ) else : # Assume all other lines define an option name and value. Replace with new value. equals_index = line . find ( '=' ) if equals_index > 0 : option_name = line [ : equals_index ] . strip ( ) if option_name in option_names : out_file . write ( '{} = {}\n' . format ( option_name , repr ( getattr ( self , option_name ) ) ) ) option_names . remove ( option_name ) else : # This error should not occur. If it does, there is probably a programming error. raise ValueError ( "Unrecognised option name '{}'" . format ( option_name ) ) if len ( option_names ) > 0 : # This error should not occur. If it does, there is probably a programming error. raise ValueError ( "Some options were not written to the output file: {}" . format ( option_names ) )