Ejemplo n.º 1
0
    # differences are minor, but lets keep using Pythons function
    # my_savitzky_pred = rc.savitzky_golay(y, window_size=Sav_win_size, order=sav_order)

    savitzky_pred = scipy.signal.savgol_filter(y, window_length= Sav_win_size, polyorder=sav_order)

    #############################################
    ###
    ###             find peaks
    ###
    #############################################
    #################################################################################
    #
    #    savitzky
    #

    savitzky_max_min = rc.my_peakdetect(y_axis=savitzky_pred, x_axis=X, delta=delt);

    savitzky_max =  savitzky_max_min[0];
    savitzky_min =  savitzky_max_min[1];

    savitzky_max = rc.separate_x_and_y(m_list = savitzky_max);
    savitzky_min = rc.separate_x_and_y(m_list = savitzky_min);

    savitzky_max_DoYs_series = pd.Series(savitzky_max[0]);
    savitzky_max_series = pd.Series(savitzky_max[1]);

    savitzky_min_DoYs_series = pd.Series(savitzky_min[0]);
    savitzky_min_series = pd.Series(savitzky_min[1]);


    savitzky_max_df = pd.DataFrame({ 
        SG_pred_93 = scipy.signal.savgol_filter(y, window_length= 9, polyorder=3)

       
        # preds_df = pd.DataFrame(data = {'SG 31':SG_pred_31, 'SG 32':SG_pred_32, 
        #                                 'SG 51':SG_pred_51, 'SG 52':SG_pred_52, 'SG 53':SG_pred_53, 
        #                                 'SG 71':SG_pred_71, 'SG 72':SG_pred_72, 'SG 73':SG_pred_73, 
        #                                 'SG 91':SG_pred_91, 'SG 92':SG_pred_92, 'SG 93':SG_pred_93}, 
        #                         index = X)
        # df2.set_index(keys = ['a'], drop=True,  inplace=True)
        #############################################
        ###
        ###             find peaks
        ###
        #############################################

        SG_max_min_31 = rc.my_peakdetect(y_axis=SG_pred_31, x_axis=X, delta=delt);
        SG_max_31 =  SG_max_min_31[0]; SG_min_31 =  SG_max_min_31[1];
        SG_max_31 = rc.separate_x_and_y(m_list = SG_max_31);
        SG_min_31 = rc.separate_x_and_y(m_list = SG_min_31);
        SG_max_DoYs_series_31 = pd.Series(SG_max_31[0]);
        SG_max_series_31 = pd.Series(SG_max_31[1]);
        SG_min_DoYs_series_31 = pd.Series(SG_min_31[0]);
        SG_min_series_31 = pd.Series(SG_min_31[1]);


        SG_max_min_32 = rc.my_peakdetect(y_axis=SG_pred_32, x_axis=X, delta=delt);
        SG_max_32 =  SG_max_min_32[0]; SG_min_32 =  SG_max_min_32[1];
        SG_max_32 = rc.separate_x_and_y(m_list = SG_max_32);
        SG_min_32 = rc.separate_x_and_y(m_list = SG_min_32);
        SG_max_DoYs_series_32 = pd.Series(SG_max_32[0]);
        SG_max_series_32 = pd.Series(SG_max_32[1]);