parameters: (reducer)
return_statement: return geometry_properties
docstring: This extracts geometry properties from the ReductionSingleton. They are saved in the CanSAS1D format.
  
      @param reducer: a handle to the redcution singleton
      @return: a dict with geometry properties
docstring_summary: This extracts geometry properties from the ReductionSingleton. They are saved in the CanSAS1D format.
docstring_tokens: This extracts geometry properties from the ReductionSingleton . They are saved in the CanSAS1D format .
function: def get_geometry_properties(reducer):
      """
      This extracts geometry properties from the ReductionSingleton. They are saved in the CanSAS1D format.
  
      @param reducer: a handle to the redcution singleton
      @return: a dict with geometry properties
      """
      def _add_property(key, element, props):
          if element is None:
              raise RuntimeError("Could not extract value for {0}.".format(key))
          props.update({key: element})
  
      geometry_properties = {}
      geometry = reducer.get_sample().geometry
  
      # Get the shape
      shape = geometry.shape
      if shape == 'cylinder-axis-up':
          shape_to_save = "Cylinder"
      elif shape == 'cuboid':
          shape_to_save = "Flat plate"
      elif shape == 'cylinder-axis-along':
          shape_to_save = 'Disc'
      else:
          raise RuntimeError("Unknown shape {0}. Cannot extract property".format(shape))
      geometry_properties.update({"Geometry": shape_to_save})
  
      # Get the Height
      _add_property("SampleHeight", geometry.height, geometry_properties)
  
      # Get the Width
      _add_property("SampleWidth", geometry.width, geometry_properties)
  
      # Get the thickness
      _add_property("SampleThickness", geometry.thickness, geometry_properties)
      return geometry_properties
function_tokens: def get_geometry_properties ( reducer ) : def _add_property ( key , element , props ) : if element is None : raise RuntimeError ( "Could not extract value for {0}." . format ( key ) ) props . update ( { key : element } ) geometry_properties = { } geometry = reducer . get_sample ( ) . geometry # Get the shape shape = geometry . shape if shape == 'cylinder-axis-up' : shape_to_save = "Cylinder" elif shape == 'cuboid' : shape_to_save = "Flat plate" elif shape == 'cylinder-axis-along' : shape_to_save = 'Disc' else : raise RuntimeError ( "Unknown shape {0}. Cannot extract property" . format ( shape ) ) geometry_properties . update ( { "Geometry" : shape_to_save } ) # Get the Height _add_property ( "SampleHeight" , geometry . height , geometry_properties ) # Get the Width _add_property ( "SampleWidth" , geometry . width , geometry_properties ) # Get the thickness _add_property ( "SampleThickness" , geometry . thickness , geometry_properties ) return geometry_properties