pydynpeak.core

pydynpeak.core.detect_peaks(series, params)
Returns

  • - subseries for selected interval

  • - ipi, t-high, t-low, median values

  • - peak detection parameters used

  • - detected peaks for the selected interval

pydynpeak.core.dynpeak_batch_compute(lh, params)

original function signature: function dynpeak_batch_compute(k,win)

Parameters
  • lh – Pandas series that contains signal values and time values as index. (contained in win)

  • params – detection parameters. (contained in win)

Returns

  • - subseries for selected interval

  • - detected peaks for the selected interval

  • - alpha value used for peak detection

Note

Parts related to user interface are removed from the original function.

pydynpeak.core.dynpeak_smooth_ipi(ipi, nord, w=None)

function f=dynpeak_smooth_IPI(IPI,nord,w)

pydynpeak.core.fake_randn()
pydynpeak.core.fieldnames(inst)
pydynpeak.core.interactive_lhpeaks(lh, params)
Parameters
  • lh (pandas.Series) – series that contains signal values and time values as index. (sig and Ts)

  • params – detection parameters. (peakpar)

Note

original function signature: function interactive_lhpeaks(sig,t,p) Ts: signal sampling time (in minutes),or vector of sample dates sig: signal peakind: vector of peaks indices.

Note

Parts related to user interface and interaction are removed from the original function. - In scilab code, after call to lhpeaks, dynpeak_init_graph is called. - figures dynpeak object is updated with parameters necessry for interaction - event handler is set - dynpeak_update_graph is called

pydynpeak.core.lhpeaks(sig, t, p=None)

function peakind = lhpeaks(sig,t, p) //LHPEAK: LH peak detection //peakind: indexes of detected peaks // //sig : sampled LH signal //t : vector of sample dates or time step //p : optionnal parameter struct // //Glossary————————————————————— // - The height of a peak is the difference of the signal value at the // peak location and the minimal signal value // - The magnitude of a peak // - The relative magnitude of a peak //Method—————————————————————– // lhpeaks uses a multiple pass method to estimates the peak locations.

// The first pass tries to sequentially find peaks that have great // heights within a user specified time range consistent with the // maximal frequency (see firstPeaks).

// The second pass removes peaks whose height is small in comparison with // the median of the detected pulse heights: For each pulse, if, for a // given pulse, the ratio between its own height and the median height // is less than a threshold parameter (globalreltol), the pulse is // removed (see delGlobalRelSmallPeaks)

// The third pass removes the peaks which are not sufficiently high with // respect to the magnitude of the peaks immediately on the left and on the // right. More precisely if M is the peak magnitude, Ml and Mr the magnitude // of the left and right peaks, ml the minimum value of the signal in // the left interpeak interval and mr the minimum value of the signal in // the rigth inter peak interval, if // (M-Ml)*(M-Mr)<(Ml-min(ml,mr))*(Mr-min(ml,mr))*localreltol the peak is // rejected. See delLocalRelSmallPeaks.

// The fourth pass looks for local maxima located between two consecutive // peaks. These local maxima are considered to be peaks if they fullfill // third pass criterion. See recoverMissedPeaks

// The fifth pass removes peaks whose height is too small with respect to the // minimum signal value in the left and right inter peak intervals. // More precisely if h is the peak height, ml the minimum value of the // signal in the left interpeak interval and mr the minimum value of the // signal in the rigth inter peak interval, if // (h-ml)*(h-mr)<localabstol^2 the peak is rejected. See // delLocalAbsSmallPeaks

// The sixth pass removes peaks which are formed by only 3 points : the // peaks for which the immediately preceding and following samples are // local minima of the time series. See delThreePointPeaks. //

// Finally the algorithm may optionnaly take advantage of the uncertainty on // the signal values to make the inter peak interval length evolve more // regularily. The previous steps have set for each found peak a // property which indicates if a given peak is detected for all the // uncertainty range or not. The alternatePeakPositions which searchs // the peaks that are almost flat with respect to uncertainty. // lhpeaks_refine computes the “optimal” peaks locations over all // possible choices of peak presence or absence and possible peak // displacements.

//Revision history:—————————————————— // Jan 2011: Initial version (Qinghua ZHANG, INRIA) // Feb 2011: (Qinghua ZHANG, INRIA) // - three point peaks detection included // July 2012: (Serge Steer, INRIA) // - argument checking added // - a struct used to handle parameters // - modified to managed non regularily discretized signals. // - IPI regularity optimisation based on data uncertainty // Reference:———————————————————— // “DynPeak : An algorithm for pulse detection and frequency analysis in // hormonal time series”, Alexandre VIDALI, Qinghua ZHANG, Claire // MEDIGUE, Stéphane FABRE, Frédérique CLEMENT, Dec 2011

pydynpeak.core.lhpeaks_check_options(p, ns, fname)
pydynpeak.core.lhpeaks_default_params()
pydynpeak.core.make_struct(*args, **kwargs)
pydynpeak.core.noised_sampled_lh(t, lh, tstep, r, f, cv, fake_randn=None)

//T : theoritical LHp signal observation dates (sampled with high frequency) //LH : theoritical LHp signal //tstep : sampling time in number of minutes //r : date of the first sample in min //f : standard deviation of the error on the measure date //CV : function which computes the measurement uncertainty for a given // LH level

pydynpeak.core.show_sampling_effect(mspike, pspike, r, f, b)

Original function signature: function ShowSamplingEffect(Mspike,Pspike,r,f,b) //Mspike : a character string that contains an expression which computes the // spike amplitude as a function of time given in minutes // (example: “15-t*8.7e-3”)

//Pspike : a character string that contains an expression which computes the // spike periode as a function of time given in minutes // (example: “100-t/30”) //r : initial time (in minute of the first sample) //f : sampling time variability //b : uncertainty on the measured sampled signa values.

Parameters
  • mspike – a character string that contains an expression which computes the spike amplitude as a function of time given in minutes (example: “15-t*8.7e-3”)

  • pspike – a character string that contains an expression which computes the spike periode as a function of time given in minutes (example: “100-t/30”)

  • r – initial time (in minute of the first sample) (first sample date)

  • f – sampling time variability (uncertainty on sample data)

  • b – uncertainty on the measured sampled signal values. (uncertainty on LH measure)

Note

Parts related to user interface and interaction are removed from the original function.

pydynpeak.core.theoretical_lh(time_s, amplitude, period, k_hl, alpha)

// T : observation time instants // LHp : computed measured LH level at the requested time instants. // Amplitude : pituitary gland LH spike amplitude // Period : pituitary gland LH spike period // k_hl : stiffness coefficient (log(2)/tau_hl, where tau_hl is the spike half-life) // Alpha : represents the instantaneous LH clearance rate from the blood.