code: def sigmasq_series(htilde, psd=None, low_frequency_cutoff=None,
              high_frequency_cutoff=None):
      
      htilde = make_frequency_series(htilde)
      N = (len(htilde)-1) * 2
      norm = 4.0 * htilde.delta_f
      kmin, kmax = get_cutoff_indices(low_frequency_cutoff,
                                     high_frequency_cutoff, htilde.delta_f, N)
  
      sigma_vec = FrequencySeries(zeros(len(htilde), dtype=real_same_precision_as(htilde)),
                                  delta_f = htilde.delta_f, copy=False)
  
      mag = htilde.squared_norm()
  
      if psd is not None:
          mag /= psd
  
      sigma_vec[kmin:kmax] = mag[kmin:kmax].cumsum()
  
      return sigma_vec*norm
docs: Return a cumulative sigmasq frequency series.
  
      Return a frequency series containing the accumulated power in the input
      up to that frequency.
  
      Parameters
      ----------
      htilde : TimeSeries or FrequencySeries
          The input vector
      psd : {None, FrequencySeries}, optional
          The psd used to weight the accumulated power.
      low_frequency_cutoff : {None, float}, optional
          The frequency to begin accumulating power. If None, start at the beginning
          of the vector.
      high_frequency_cutoff : {None, float}, optional
          The frequency to stop considering accumulated power. If None, continue
          until the end of the input vector.
  
      Returns
      -------
      Frequency Series: FrequencySeries
          A frequency series containing the cumulative sigmasq.