Exemplo n.º 1
0
def read_qrnn(file, inChannels, target):

    data = iciData(test_file, inChannels, target, batch_size=batchSize)

    qrnn = QRNN.load(file)
    y_pre, y_prior, y0, y, y_pos_mean = S.predict(data, qrnn, add_noise=True)

    return y_pre, y_prior, y0, y, y_pos_mean
Exemplo n.º 2
0
def read_qrnn(file, inChannels, target):

    data = iciData(test_file, inChannels, target, batch_size=batchSize)

    # read QRNN
    #    file = 'qrnn_ici_%s_%s_%s_single.nc'%(depth, width, target)
    #    print (file)
    qrnn = QRNN.load(file)
    y_pre, y_prior, y0, y, y_pos_mean = S.predict(data, qrnn, add_noise=True)

    return y_pre, y_prior, y0, y, y_pos_mean
Exemplo n.º 3
0
inChannels = np.array(['I1V', 'I2V', 'I3V', 'I5V' , 'I6V', 'I7V', 'I8V', 'I9V', 'I10V', 'I11V'])
#inChannels = np.array(['I1V', 'I2V', 'I3V', 'MWI-15', 'MWI-16', 'I5V', 'I6V', 'I7V', 'I8V', 'I9V', 'I10V', 'I11V', 'I11H'])
inChannels = np.array([target, 'I5V' , 'I6V', 'I7V', 'I8V', 'I9V', 'I10V', 'I11V'])
i183, = np.argwhere(inChannels == target)[0]

binstep = 0.5
bins = np.arange(-20, 15, binstep)
iq = np.argwhere(quantiles == 0.5)[0,0]

#%% Uncertainty plot
plt.rcParams.update({'font.size': 26})
inChannels = np.array([target, 'I5V' , 'I6V', 'I7V', 'I8V', 'I9V', 'I10V', 'I11V'])
i183, = np.argwhere(inChannels == target)[0]
data = iciData("TB_ICI_test.nc", 
               inChannels, target, 
               batch_size = batchSize)  

file = 'qrnn_ici_%s_%s_%s_single.nc'%(depth, width, target)
print (file)
qrnn = QRNN.load(file)

y_pre, y_prior, y0, y, y_pos_mean = S.predict(data, qrnn, add_noise = True)
fig, ax = plt.subplots(1, 1, figsize = [8, 8])
x = np.arange(-3, 4, 1)
ii = 0
y_all = []
randomList = random.sample(range(0, 24000), 1500)
for i in randomList:
    ii +=1
#for i in ind:
Exemplo n.º 4
0
    test_file = "TB_ICI_test.nc"

    binstep = 0.5
    bins = np.arange(-20, 20, binstep)
    iq = np.argwhere(quantiles == 0.5)[0, 0]

    #%% Plot error of best estimate for all ICI channels

    fig, ax = plt.subplots(1, 1, figsize=[10, 10], sharex=True)
    fig1, ax1 = plt.subplots(1, 1, figsize=[10, 10], sharex=True)
    plt.subplots_adjust(wspace=0.001)
    for i, target in enumerate(targets):
        inChannels = np.array(
            [target, 'I5V', 'I6V', 'I7V', 'I8V', 'I9V', 'I10V', 'I11V'])
        #    inChannels = np.array(['I1V', 'I2V','I3V', 'I5V' , 'I6V', 'I7V', 'I8V', 'I9V', 'I10V', 'I11V'])
        data = iciData(test_file, inChannels, target, batch_size=batchSize)

        i183, = np.argwhere(inChannels == target)[0]

        # read QRNN
        file = 'qrnn_ici_%s_%s_%s_single.nc' % (depth, width, target)
        #    file = 'qrnn_ici_%s_%s_%s.nc'%(depth, width, target)
        print(file)
        qrnn = QRNN.load(file)
        y_pre, y_prior, y0, y, y_pos_mean, x = predict(data,
                                                       qrnn,
                                                       add_noise=True)

        im = np.abs(y_pre[:, iq] - y_prior[:, i183]) < 5.0
        hist_noise, hist_pre, hist_prior, hist_pos_mean, hist_pos_mean_5, hist_filter  = \
            S.calculate_all_histogram(y, y0, y_pre, y_prior, iq, bins, im, i183)