def read_qrnn(qrnn_file, test_file, inChannels, target): data = mwhsData(test_file, inChannels, target, ocean=False, test_data=True) qrnn = QRNN.load(qrnn_file) y_pre, y_prior, y0, y, y_pos_mean = S.predict(data, qrnn, \ add_noise = False) return y_pre, y_prior, y0, y, y_pos_mean
#%% read input data qrnn_path = os.path.expanduser("~/Dendrite/Projects/AWS-325GHz/MWHS/qrnn_output/all_with_flag/%s/"%(qrnn_dir)) inChannels = np.concatenate([[target], channels]) # inChannels = np.array(channels) print(qrnn_dir, channels, inChannels) qrnn_file = os.path.join(qrnn_path, "qrnn_mwhs_%s.nc"%(target)) print (qrnn_file) i183, = np.argwhere(inChannels == target)[0] data = mwhsData(test_file, inChannels, target, ocean = False, test_data = True) qrnn = QRNN.load(qrnn_file) y_pre, y_prior, y0, y, y_pos_mean, x = predict(data, qrnn, \ add_noise = False) im = (np.abs(y_pre[:, 3] - y_prior[:, i183] )< 5) # bia, std, ske, mae = S.calculate_statistics(y_prior, y0, y, y_pre[:, 3], im, i183) SI = np.abs(y_prior[:, 0] - y_prior[:, 1]) im = SI < 5.0 y_pre = y_prior[im, i183] y0 = y0[im] y = y[im]