Skip to content
Snippets Groups Projects
Commit dd211099 authored by FROGE Ewen's avatar FROGE Ewen
Browse files

Upload New File

parent 73306a53
No related branches found
No related tags found
No related merge requests found
import numpy as np
import itertools
from tqdm import tqdm
from CalcInnovation import create_database,prediction_neighbors
# Params
Nreal = 10
N = 2**16 # total number of point
# Path to data
path = '/users2/local/e22froge/codes/Julia_Innovation/DataSignals/uspa_mob15_1.dat'
with open(path, 'rb') as fid:
signal = np.fromfile(fid, dtype='>f')
data = np.reshape(signal, (-1, N))
data = data[49:, :]
# Extended execution for all parameter combinations
overlapping_options = [False]
random_options = [False]
weighting_options = [True]
normalizing_options = [True]
p_options = [3, 5, 10, 15, 20, 30, 50, 75, 100, 200]
Nbibpow_options = [20]
for Nbibpow, p, overlapping, random, weighting, normalizing in itertools.product(
Nbibpow_options, p_options, overlapping_options, random_options, weighting_options, normalizing_options):
print(f"Running for combination: p={p}, Overlapping={overlapping}, Random={random}, Weighting={weighting}, Normalizing={normalizing}")
# Data processing and prediction for each combination
Bib = np.reshape(data, -1)
Bib = Bib[0:2**Nbibpow]
Bib = (Bib - np.mean(Bib)) / np.std(Bib)
db = create_database(Bib, p, overlapping=overlapping)
vals = np.zeros((Nreal, N))
velocity = np.zeros((Nreal, N))
for i in tqdm(range(Nreal)):
real = 100 + 1 + 2 * i
velocity[i, :] = (data[real, :] - np.mean(data[real, :])) / np.std(data[real, :])
vals[i, :] = prediction_neighbors(velocity[i, :], db, k, weighting=weighting, random=random, normalize=normalizing)
innov = velocity[:, :-1] - vals[:, :-1]
# Parameters dictionary
params = {
'Signal': 'Modane',
'overlapping': overlapping,
'random': random,
'weighting': weighting,
'normalizing': normalizing,
'p': p,
'k': k,
'Nreal': Nreal,
'N': N,
'Nbibpow': Nbibpow
}
# Saving the results
filename = f"Innov_results_Modane_N216_p{p}_k{k}_Overlap{overlapping}_Random{random}_Weight{weighting}_Norm{normalizing}_Nbibpow{Nbibpow}.npz"
np.savez('/users2/local/e22froge/codes/Julia_Innovation/DataInnovation/' + filename, V=velocity[:, :-1], Innov=innov, params=params)
print(f"Results saved to {filename}")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment