###### Calculating window based statistical features for RAW SDRR VALUES ################# window_size=50; std_dev_window_arr=[] std_dev_window_arr=pr.get_window_std_dev(RR_sec, window_size) window_number=1; # for val in std_dev_window_arr: # feature_rec.append(val) # global_vocab,index_of_features=cl.fill_global_vocab("std_window_"+str(window_number), index_of_features, global_vocab) # window_number=window_number+1; ###plot window std_dev and save fig #### # fig_std_p,plot_std_p=graphs.plot_simple(rec_name,range(len(std_dev_window_arr)), std_dev_window_arr, "window std dev for window size: %s" % window_size, "std_dev", "window std dev", "r", 0, 0,-0.1, 0.5) # fig_std_p.savefig(output_folder+"std_dev_window_"+record+".png") if "n" in record: ####plot sodp and save fig #### fig_std,plot_std_p=graphs.plot_simple(rec_name,range(len(std_dev_window_arr)), std_dev_window_arr, "Window number", "Standard Deviation", "SDW Series ", 'b',xlim_lo=0, xlim_hi=1, ylim_lo=0, ylim_hi=0.2) fig_std.savefig(output_folder+"std_dev_window_"+record+".pdf",format='pdf') if "p" in record: ####plot sodp and save fig #### fig_std,plot_std_p=graphs.plot_simple(rec_name,range(len(std_dev_window_arr)), std_dev_window_arr, "Window number", "Standard Deviation", "SDW Series ", 'r',xlim_lo=0, xlim_hi=1, ylim_lo=0, ylim_hi=0.2) fig_std.savefig(output_folder+"std_dev_window_"+record+".pdf",format='pdf') ### calculating variation in the std_dev_window_arr and save as feature var_std_dev_window_arr=np.std(std_dev_window_arr); #print("type of np.std elemnt is : " + str(type(var_std_dev_window_arr())) #print("std of std array is " +str(var_std_dev_window_arr)) #var_std_dev_window_arr=np.nan_to_num(var_std_dev_window_arr) #print "standard deviation of var_std_dev_window_arr is" +str(var_std_dev_window_arr) feature_rec.append(np.float64(var_std_dev_window_arr)); global_vocab,index_of_features=cl.fill_global_vocab("var_std_dev_window_arr", index_of_features, global_vocab)
#### calculating skewness and kurtosis ##### #skewness_global=scipy.stats.skew(RR_sec) #print("skewness: "+ str(skewness_global)) #kurtosis_global=scipy.stats.kurtosis(RR_sec, fisher='false') #print("kurtosis_globl is : " +str(kurtosis_global)) #print("answer for kurtosis test is: "+str(scipy.stats.kurtosistest(RR_sec))) ###### Calculate nn50, pnn50 and rmSSD or diff_rr_std_dev ###### std_dev_diff = np.std(delta_RR_sec) feature_rec.append(std_dev_diff) global_vocab, index_of_features = cl.fill_global_vocab( "std_dev_diff", index_of_features, global_vocab) ###### Calculating window based statistical features for RAW SDRR VALUES ################# window_size = 50 std_dev_window_arr = [] std_dev_window_arr = pr.get_window_std_dev(RR_sec, window_size) window_number = 1 # for val in std_dev_window_arr: # feature_rec.append(val) # global_vocab,index_of_features=cl.fill_global_vocab("std_window_"+str(window_number), index_of_features, global_vocab) # window_number=window_number+1; ###plot window std_dev and save fig #### fig_std_p, plot_std_p = graphs.plot_simple( rec_name, range(len(std_dev_window_arr)), std_dev_window_arr, "quo_filt window std dev for window size: %s" % window_size, "std_dev", "window std dev", "r", 0, 0, -0.1, 0.5) fig_std_p.savefig(output_folder + "std_dev_window_" + record + ".png")
global_vocab,index_of_features=cl.fill_global_vocab("std_dev_global", index_of_features, global_vocab) # print (" sdrr of RR_sec (raw) in ms is: " +str(sdrr_raw_ms)); #### calculating skewness and kurtosis ##### #skewness_global=scipy.stats.skew(RR_sec) #print("skewness: "+ str(skewness_global)) #kurtosis_global=scipy.stats.kurtosis(RR_sec, fisher='false') #print("kurtosis_globl is : " +str(kurtosis_global)) #print("answer for kurtosis test is: "+str(scipy.stats.kurtosistest(RR_sec))) ###### Calculate nn50, pnn50 and rmSSD or diff_rr_std_dev ###### std_dev_diff=np.std(delta_RR_sec); feature_rec.append(std_dev_diff); global_vocab,index_of_features=cl.fill_global_vocab("std_dev_diff", index_of_features, global_vocab) ###### Calculating window based statistical features for RAW SDRR VALUES ################# window_size=50; std_dev_window_arr=[] std_dev_window_arr=pr.get_window_std_dev(RR_sec, window_size) window_number=1; # for val in std_dev_window_arr: # feature_rec.append(val) # global_vocab,index_of_features=cl.fill_global_vocab("std_window_"+str(window_number), index_of_features, global_vocab) # window_number=window_number+1; ###plot window std_dev and save fig #### fig_std_p,plot_std_p=graphs.plot_simple(rec_name,range(len(std_dev_window_arr)), std_dev_window_arr, "quo_filt window std dev for window size: %s" % window_size, "std_dev", "window std dev", "r", 0, 0,-0.1, 0.5) fig_std_p.savefig(output_folder+"std_dev_window_"+record+".png")