def extract_number_oscillations(osc_dyn, index = <NUM_LIT:0>, amplitude_threshold = <NUM_LIT:1.0>):
number_oscillations = <NUM_LIT:0>;<EOL>waiting_differential = False;<EOL>threshold_passed = False;<EOL>high_level_trigger = True if (osc_dyn[<NUM_LIT:0>][index] > amplitude_threshold) else False;<EOL>for values in osc_dyn:<EOL><INDENT>if ( (values[index] >= amplitude_threshold) and (high_level_trigger is False) ):<EOL><INDENT>high_level_trigger = True;<EOL>threshold_passed = True;<EOL><DEDENT>elif ( (values[index] < amplitude_threshold) and (high_level_trigger is True) ):<EOL><INDENT>high_level_trigger = False;<EOL>threshold_passed = True;<EOL><DEDENT>if (threshold_passed is True):<EOL><INDENT>threshold_passed = False;<EOL>if (waiting_differential is True and high_level_trigger is False):<EOL><INDENT>number_oscillations += <NUM_LIT:1>;<EOL>waiting_differential = False;<EOL><DEDENT>else:<EOL><INDENT>waiting_differential = True;<EOL><DEDENT><DEDENT><DEDENT>return number_oscillations<EOL>
!
    @brief Extracts number of oscillations of specified oscillator.

    @param[in] osc_dyn (list): Dynamic of oscillators.
    @param[in] index (uint): Index of oscillator in dynamic.
    @param[in] amplitude_threshold (double): Amplitude threshold when oscillation is taken into account, for example,
                when oscillator amplitude is greater than threshold then oscillation is incremented.

    @return (uint) Number of oscillations of specified oscillator.