code: def percentile(self, percentile):
          
          rows, columns = self.shape
          out = numpy.zeros(rows)
          # Loop over frequencies
          for i in range(rows):
              # Calculate cumulative sum for array
              cumsumvals = numpy.cumsum(self.value[i, :])
  
              # Find value nearest requested percentile
              abs_cumsumvals_minus_percentile = numpy.abs(cumsumvals -
                                                          percentile)
              minindex = abs_cumsumvals_minus_percentile.argmin()
              val = self.bins[minindex]
              out[i] = val
  
          name = '%s %s%% percentile' % (self.name, percentile)
          return FrequencySeries(out, epoch=self.epoch, channel=self.channel,
                                 frequencies=self.bins[:-1], name=name)
docs: Calculate a given spectral percentile for this `SpectralVariance`
  
          Parameters
          ----------
          percentile : `float`
              percentile (0 - 100) of the bins to compute
  
          Returns
          -------
          spectrum : `~gwpy.frequencyseries.FrequencySeries`
              the given percentile `FrequencySeries` calculated from this
              `SpectralVaraicence`