parameters: (self)
docstring: Performs STEM acquire. In our case we just fetch an image of the use if
          there is one
          :returns: The 2D tiff generate by the scan along with its meta data.
docstring_summary: Performs STEM acquire. In our case we just fetch an image of the use if
          there is one
          :returns: The 2D tiff generate by the scan along with its meta data.
docstring_tokens: Performs STEM acquire . In our case we just fetch an image of the use if there is one : returns : The 2D tiff generate by the scan along with its meta data .
function: def stem_acquire(self):
          """
          Performs STEM acquire. In our case we just fetch an image of the use if
          there is one
          :returns: The 2D tiff generate by the scan along with its meta data.
          """
          file = self._monitor.get()
  
          # We currently don't have a new image
          if file is None:
              return None
  
          with open(file, 'rb') as fp:
              image_data = None
              (mimetype, _) = mimetypes.guess_type(file)
  
              metadata = {}
              if self._filename_regex_groups is not None:
                  metadata.update(self._extract_filename_metadata(file))
  
              if mimetype in _extractors:
                  extractor = _extractors[mimetype]
                  (extracted_metadata, image_data) = extractor(fp)
                  metadata.update(extracted_metadata)
  
              if image_data is None:
                  fp.seek(0)
                  image_data = fp.read()
  
              return (metadata, image_data)
function_tokens: def stem_acquire ( self ) : file = self . _monitor . get ( ) # We currently don't have a new image if file is None : return None with open ( file , 'rb' ) as fp : image_data = None ( mimetype , _ ) = mimetypes . guess_type ( file ) metadata = { } if self . _filename_regex_groups is not None : metadata . update ( self . _extract_filename_metadata ( file ) ) if mimetype in _extractors : extractor = _extractors [ mimetype ] ( extracted_metadata , image_data ) = extractor ( fp ) metadata . update ( extracted_metadata ) if image_data is None : fp . seek ( 0 ) image_data = fp . read ( ) return ( metadata , image_data )