Пример #1
0
import config as c
import numpy as np
from pathlib import Path
import matplotlib.pyplot as plt
import data.data_helpers as data_helpers
import data.prepare_data as prepare_data
import evaluate
from evaluate import compute_calibration,sample_posterior
import time
import torch

#compute_calibration = evaluate.compute_calibration
#sample_posterior = evaluate.sample_posterior
x_all, y_all, ana_all = data_helpers.concatenate_test_set(c.evaluation_samples)

def show_error_correlations(x=x_all,y=y_all,load=False):

    #plot error co2 against: xco2, "albedo_o2","albedo_sco2","albedo_wco2", "tcwv" 4
    #and: "year","xco2_apriori","altitude","psurf","t700","longitude","latitude" 7
    #"snr_wco2","snr_sco2","snr_o2a","aod_bc","aod_dust","aod_ice","aod_oc","aod_seasalt","aod_sulfate","aod_total","aod_water"

    params=prepare_data.x_to_params(x)
    spectra=prepare_data.y_to_spectra(y)

    post = sample_posterior(y)
    diff = torch.mean(torch.FloatTensor(post), dim = 1)-x
    #post_params =prepare_data.x_to_params(post)
    _,_,uncert_intervals,_, post_params = compute_calibration(x,y,load=load)
    uncert_error_co2=uncert_intervals[68,:,c.co2_pos]/2
    diff = np.mean(post_params, axis = 1) - params
    diff_co2 = diff [:, 0]
Пример #2
0
    1000)  #concatenate_test_set(1000)#400)#20)#400)
print(torch.max(y_all), torch.min(y_all))
print(torch.max(y_all[:, -params_in_spectrum:], dim=0),
      torch.min(y_all[:, -params_in_spectrum:], dim=0))
print(torch.max(y_all[:, :prepare_data.spec_length]),
      torch.min(y_all[:, :prepare_data.spec_length]))
print(
    torch.max(y_all[:, prepare_data.spec_length:2 * prepare_data.spec_length]),
    torch.min(y_all[:, prepare_data.spec_length:2 * prepare_data.spec_length]))
print(
    torch.max(y_all[:, 2 * prepare_data.spec_length:3 *
                    prepare_data.spec_length]),
    torch.min(y_all[:, 2 * prepare_data.spec_length:3 *
                    prepare_data.spec_length]))

x_all, y_all, ana_all = data_helpers.concatenate_test_set(
    1000)  #concatenate_test_set(1000)#400)#20)#400)
print(torch.max(y_all), torch.min(y_all))
#assert 0

#x=prepare_data.x
#params=prepare_data.params
#spectra = prepare_data.spectra
#params_in_spectrum = prepare_data.number_external_params #5 or 18
#params_names = prepare_data.params_names#list(prepare_data.namedict.keys())
#spec_length = prepare_data.spec_length


def show_param_hists(parameters,
                     n_parameters=n_parameters,
                     offset=0,
                     name="",