Skip to content
Snippets Groups Projects
Commit 42c57a5f authored by Edoardo Pasetto's avatar Edoardo Pasetto
Browse files

Upload New File

parent 0248ba05
Branches
No related tags found
No related merge requests found
import numpy as np
import os
import library as lib
from pathlib import Path
CURRENT_DIR = Path(__file__).parent
#mu and sigmas refer to the underlying normal distribution, not the distribution itself
wl_array=[412.5,442.5,490,510,560,620,665,681.25]
n_samples=650
C_mu=-0.86
X_mu=-1.21
Y_mu=-1.75
C_sigma=0.3
X_sigma=0.3
Y_sigma=0.3
corr_CX=0.8
corr_CY=0.8
##########################################à
mu=np.array([C_mu,X_mu,Y_mu])
cov=np.zeros((len(mu),len(mu)))
cov[0,0]=C_sigma
cov[1,1]=X_sigma
cov[2,2]=Y_sigma
cov_CX=corr_CX*C_sigma*X_sigma
cov_CY=corr_CY*C_sigma*Y_sigma
#######################################
cov[0,1]=cov_CX
cov[1,0]=cov_CX
cov[0,2]=cov_CY
cov[2,0]=cov_CY
###################################
generator=np.random.default_rng()
samples=generator.multivariate_normal(mean=mu,cov=cov,size=n_samples)
oap=np.power(10,samples)
#%%
################################
R=np.zeros((oap.shape[0],len(wl_array)))
for i in range(R.shape[0]):
C,X,Y=oap[i,:]
R[i,:]=lib.get_reflectance_vector(wl_array, C, X, Y)
C_array=oap[:,0]
save_path=CURRENT_DIR / 'generated_dataset'
os.makedirs(save_path, exist_ok=True)
np.save(save_path / 'target.npy',C_array)
np.save(save_path / 'input.npy',R)
np.save(save_path / 'oap.npy',oap)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment