The code snippet calculates the initial peaks in the data based on a given threshold. It first identifies the peaks above the threshold as 'up' peaks and the peaks below the threshold as 'down' peaks. It then calculates the number of peaks for each type and assigns it to the Nt dictionary. The n_init variable is set to the initial number of peaks.

The code snippet also calculates the parameters for the Grimshaw distribution, which is used to estimate the extreme quantile of the data. It iterates over the 'up' and 'down' peaks and calls the _grimshaw function to estimate the parameters g and s of the Grimshaw distribution. It also calls the _quantile function to calculate the extreme quantile based on the estimated parameters. The calculated extreme quantile, gamma, and sigma values are stored in the extreme_quantile, gamma, and sigma dictionaries, respectively.

The code snippet also prints out the initial threshold and the number of peaks if the verbose flag is set to true.

The code snippet uses the form string to format the output of the printed information. The ltab variable is set to 20, which is the width of each column in the formatted output

# initial peaks selfpeaksup = selfinit_dataselfinit_dataselfinit_thresholdup-selfinit_thresholdup selfpeaksdown = -selfinit_dataselfinit_dataselfinit_thresholddown-selfinit_thresholddown

原文地址: https://www.cveoy.top/t/topic/hJmC 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录