123456789101112131415161718192021222324252627282930313233343536 |
- import snlay as snlay
- import h5py
- import numpy as np
- from scattnlay import scattnlay
- import time
- import progressbar
- dataset_size = 100000
- # parameters of the dataset
- num_layers = 8
- num_lpoints = 250
- lam_min = 300
- lam_max = 1200
- size_min = 30
- size_max = 70
- #make the materials list here
- mats = [3, 4, 3, 4, 3, 4, 3, 4] # 2 - silicon, silicon.dat, 1 - gold, gold.dat
- # 3 - silica, silica.dat, 4 - titania, tio2.dat
- #generate a huge array and then reshape
- dataset_X = np.random.randint(size_min,size_max+1,num_layers*dataset_size).astype(float).reshape(dataset_size, num_layers)
- lams = np.linspace(lam_min, lam_max, num_lpoints)
- dataset_Y = np.zeros((dataset_size,num_lpoints))
- for ind in progressbar.progressbar(np.arange(dataset_size)):
- kr, m = snlay.make_xm(dataset_X[ind,:], mats, lams)
- terms, dataset_Y[ind,:], Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2 = scattnlay(kr, m)
- h5f = h5py.File('./datasets/s8_sio2tio2.h5', 'w')
- h5f.create_dataset('sizes', data=dataset_X)
- h5f.create_dataset('spectrum', data=dataset_Y)
- h5f.close()
|