original_docstring: Processes a frame.  Only Housekeeping frames will be examined;
          other frames will simply be counted.  All frames are passed
          through unmodified.  The index_info will be stored along with
          a description of the frame's data; see the .process_file
          function.
  
          
docstring: Processes a frame.  Only Housekeeping frames will be examined;
  other frames will simply be counted.  All frames are passed
  through unmodified.  The index_info will be stored along with
  a description of the frame's data; see the .process_file
  function.
docstring_tokens: Processes a frame . Only Housekeeping frames will be examined ; other frames will simply be counted . All frames are passed through unmodified . The index_info will be stored along with a description of the frame ' s data ; see the . process_file function .
code: def Process(self, f, index_info=None):
          """Processes a frame.  Only Housekeeping frames will be examined;
          other frames will simply be counted.  All frames are passed
          through unmodified.  The index_info will be stored along with
          a description of the frame's data; see the .process_file
          function.
  
          """
          self.counter += 1
          if index_info is None:
              index_info = {'counter': self.counter}
  
          f = self.translator(f)
          assert(len(f) == 1)
          f = f[0]
  
          if f.type == core.G3FrameType.EndProcessing:
              return [f]
  
          if f.type != core.G3FrameType.Housekeeping:
              return [f]
  
          vers = f.get('hkagg_version', 0)
          assert(vers == 2)
  
          if f['hkagg_type'] == so3g.HKFrameType.session:
              session_id = f['session_id']
              if self.session_id is not None:
                  if self.session_id != session_id:
                      self.flush()  # Note that this sets self.session_id=None.
              if self.session_id is None:
                  core.log_info('New HK Session id = %i, timestamp = %i' %
                                (session_id, f['start_time']), unit='HKScanner')
                  self.session_id = session_id
  
          elif f['hkagg_type'] == so3g.HKFrameType.status:
              # If a provider has disappeared, flush its information into a
              # FieldGroup.
              prov_cands = [_HKProvider.from_g3(p) for p in f['providers']]
              to_flush = list(self.providers.keys())  # prov_ids...
              for p in prov_cands:
                  if p.prov_id in to_flush:
                      to_flush.remove(p.prov_id) # no, don't.
                  else:
                      self.providers[p.prov_id] = p
              for prov_id in to_flush:
                  self.flush([prov_id])
  
          elif f['hkagg_type'] == so3g.HKFrameType.data:
              # Data frame -- merge info for this provider.
              prov = self.providers[f['prov_id']]
              representatives = prov.blocks.keys()
  
              for bidx, (bname, b) in enumerate(zip(f['block_names'], f['blocks'])):
                  assert(isinstance(b, core.G3TimesampleMap))
                  if bname not in prov.blocks:
                      prov.blocks[bname] = {'fields': list(b.keys()),
                                            'start': b.times[0].time / core.G3Units.seconds,
                                            'index_info': []}
                  # To ensure that the last sample is actually included
                  # in the semi-open intervals we use to track frames,
                  # the "end" time has to be after the final sample.
                  prov.blocks[bname]['end'] = b.times[-1].time / core.G3Units.seconds + SPAN_BUFFER_SECONDS
                  ii = {'block_index': bidx,
                        'timestamp': b.times[0].time,
                        'count': len(b.times)}
                  ii.update(index_info)
                  prov.blocks[bname]['index_info'].append(ii)
                  
          else:
              core.log_warn('Weird hkagg_type: %i' % f['hkagg_type'],
                            unit='HKScanner')
          return [f]
code_tokens: def Process ( self , f , index_info = None ) : self . counter += 1 if index_info is None : index_info = { 'counter' : self . counter } f = self . translator ( f ) assert ( len ( f ) == 1 ) f = f [ 0 ] if f . type == core . G3FrameType . EndProcessing : return [ f ] if f . type != core . G3FrameType . Housekeeping : return [ f ] vers = f . get ( 'hkagg_version' , 0 ) assert ( vers == 2 ) if f [ 'hkagg_type' ] == so3g . HKFrameType . session : session_id = f [ 'session_id' ] if self . session_id is not None : if self . session_id != session_id : self . flush ( ) if self . session_id is None : core . log_info ( 'New HK Session id = %i, timestamp = %i' % ( session_id , f [ 'start_time' ] ) , unit = 'HKScanner' ) self . session_id = session_id elif f [ 'hkagg_type' ] == so3g . HKFrameType . status : prov_cands = [ _HKProvider . from_g3 ( p ) for p in f [ 'providers' ] ] to_flush = list ( self . providers . keys ( ) ) for p in prov_cands : if p . prov_id in to_flush : to_flush . remove ( p . prov_id ) else : self . providers [ p . prov_id ] = p for prov_id in to_flush : self . flush ( [ prov_id ] ) elif f [ 'hkagg_type' ] == so3g . HKFrameType . data : prov = self . providers [ f [ 'prov_id' ] ] representatives = prov . blocks . keys ( ) for bidx , ( bname , b ) in enumerate ( zip ( f [ 'block_names' ] , f [ 'blocks' ] ) ) : assert ( isinstance ( b , core . G3TimesampleMap ) ) if bname not in prov . blocks : prov . blocks [ bname ] = { 'fields' : list ( b . keys ( ) ) , 'start' : b . times [ 0 ] . time / core . G3Units . seconds , 'index_info' : [ ] } prov . blocks [ bname ] [ 'end' ] = b . times [ - 1 ] . time / core . G3Units . seconds + SPAN_BUFFER_SECONDS ii = { 'block_index' : bidx , 'timestamp' : b . times [ 0 ] . time , 'count' : len ( b . times ) } ii . update ( index_info ) prov . blocks [ bname ] [ 'index_info' ] . append ( ii ) else : core . log_warn ( 'Weird hkagg_type: %i' % f [ 'hkagg_type' ] , unit = 'HKScanner' ) return [ f ]
short_docstring: Processes a frame.
short_docstring_tokens: Processes a frame .
comment: """Processes a frame.  Only Housekeeping frames will be examined;
          other frames will simply be counted.  All frames are passed
          through unmodified.  The index_info will be stored along with
          a description of the frame's data; see the .process_file
          function.
  
          """$SEP$# Note that this sets self.session_id=None.$SEP$# If a provider has disappeared, flush its information into a$SEP$# FieldGroup.$SEP$# prov_ids...$SEP$# no, don't.$SEP$# Data frame -- merge info for this provider.$SEP$# To ensure that the last sample is actually included$SEP$# in the semi-open intervals we use to track frames,$SEP$# the "end" time has to be after the final sample.