def pearsonrMccEner(rep_num, h5_path_regx, intercept=1, floor_mcc=0.35, ceil_mcc=0.65): """ read the hdf5 file and calculate the pearsonr correlation coefficient between mcc and energy """ track = loadTrack(rep_num, h5_path_regx) if intercept == 1: intercepted_track = interceptTrack(floor_mcc, ceil_mcc, track) track = intercepted_track ener, mcc = [], [] for i in track: ener.append(i[1]) mcc.append(i[2]) if 10000 in mcc: # drop the mcc with CMCC_INVALID_VAL print "CMCC_INVALID_VAL found in", rep_num return np.nan, np.nan else: return pearsonr(mcc, ener)