parameters: (self, query_params)
docstring: Given a tag and single run, return an array of compressed histograms.
docstring_summary: Given a tag and single run, return an array of compressed histograms.
docstring_tokens: Given a tag and single run return an array of compressed histograms .
function: def _serve_compressed_histograms(self, query_params):
      """Given a tag and single run, return an array of compressed histograms."""
      tag = query_params.get('tag')
      run = query_params.get('run')
      compressed_histograms = self._multiplexer.CompressedHistograms(run, tag)
      if query_params.get('format') == _OutputFormat.CSV:
        string_io = StringIO()
        writer = csv.writer(string_io)
  
        # Build the headers; we have two columns for timing and two columns for
        # each compressed histogram bucket.
        headers = ['Wall time', 'Step']
        if compressed_histograms:
          bucket_count = len(compressed_histograms[0].compressed_histogram_values)
          for i in xrange(bucket_count):
            headers += ['Edge %d basis points' % i, 'Edge %d value' % i]
        writer.writerow(headers)
  
        for compressed_histogram in compressed_histograms:
          row = [compressed_histogram.wall_time, compressed_histogram.step]
          for value in compressed_histogram.compressed_histogram_values:
            row += [value.rank_in_bps, value.value]
          writer.writerow(row)
        self.respond(string_io.getvalue(), 'text/csv')
      else:
        self.respond(compressed_histograms, 'application/json')
function_tokens: def _serve_compressed_histograms ( self , query_params ) : tag = query_params . get ( 'tag' ) run = query_params . get ( 'run' ) compressed_histograms = self . _multiplexer . CompressedHistograms ( run , tag ) if query_params . get ( 'format' ) == _OutputFormat . CSV : string_io = StringIO ( ) writer = csv . writer ( string_io ) # Build the headers; we have two columns for timing and two columns for # each compressed histogram bucket. headers = [ 'Wall time' , 'Step' ] if compressed_histograms : bucket_count = len ( compressed_histograms [ 0 ] . compressed_histogram_values ) for i in xrange ( bucket_count ) : headers += [ 'Edge %d basis points' % i , 'Edge %d value' % i ] writer . writerow ( headers ) for compressed_histogram in compressed_histograms : row = [ compressed_histogram . wall_time , compressed_histogram . step ] for value in compressed_histogram . compressed_histogram_values : row += [ value . rank_in_bps , value . value ] writer . writerow ( row ) self . respond ( string_io . getvalue ( ) , 'text/csv' ) else : self . respond ( compressed_histograms , 'application/json' )