@@ -25,7 +25,7 @@ They should be placed inside the folder `lib` in the project's root as follows.
25
25
│ └───avaspec3
26
26
│ │ └───avaspecx64.dll
27
27
├───scripts
28
- ├───singlepixel
28
+ ├───spas
29
29
├───requirements.txt
30
30
├───setup.py
31
31
├───stats
@@ -40,7 +40,7 @@ They should be placed inside the folder `lib` in the project's root as follows.
40
40
In python:
41
41
42
42
``` python
43
- import singlepixel as sp
43
+ import spas as sp
44
44
sp.walsh_patterns(save_data = True )
45
45
```
46
46
By default the patterns are 1024x768 PNG images saved in ` ./Walsh_64_64/ `
@@ -81,7 +81,7 @@ conda install pywin32
81
81
82
82
* Initilization (just once, two consecutively returns an error)
83
83
``` python
84
- from singlepixel import *
84
+ from spas import *
85
85
spectrometer, DMD , DMD_initial_memory = init()
86
86
```
87
87
@@ -140,7 +140,7 @@ disconnect(spectrometer, DMD)
140
140
Reconstruct the measurements contained in the variable ` meas `
141
141
``` python
142
142
import spyrit.misc.walsh_hadamard as wh
143
- from singlepixel import reconstruction_hadamard
143
+ from spas import reconstruction_hadamard
144
144
H = wh.walsh2_matrix(64 )
145
145
rec = reconstruction_hadamard(acquisition_parameters.patterns, ' walsh' , H,
146
146
meas)
@@ -149,14 +149,14 @@ rec = reconstruction_hadamard(acquisition_parameters.patterns, 'walsh', H,
149
149
Bin the reconstructed hypercube in 8 bins between 530 and 730 nm
150
150
151
151
``` python
152
- from singlepixel import spectral_binning
152
+ from spas import spectral_binning
153
153
rec_bin, wavelengths_bin, _ = spectral_binning(
154
154
rec.T, acquisition_parameters.wavelengths, 530 , 730 , 8 )
155
155
```
156
156
157
157
Plot the 8 bins
158
158
``` python
159
- from singlepixel import plot_color
159
+ from spas import plot_color
160
160
plot_color(rec_bin, wavelengths_bin)
161
161
```
162
162
@@ -173,7 +173,7 @@ meas = file['spectral_data']
173
173
174
174
Read the metadata (we need the get the acquisition order of the patterns)
175
175
``` python
176
- from singlepixel import read_metadata, reconstruction_hadamard
176
+ from spas import read_metadata, reconstruction_hadamard
177
177
_, acquisition_parameters, _, _ = read_metadata(' ../meas/my_first_measurement' + ' _metadata.json' )
178
178
179
179
```
@@ -201,7 +201,7 @@ meas = file['spectral_data']
201
201
202
202
Read the metadata (we need the get the acquisition order of the patterns)
203
203
``` python
204
- from singlepixel import read_metadata, reconstruction_hadamard
204
+ from spas import read_metadata, reconstruction_hadamard
205
205
_, acquisition_parameters, _, _ = read_metadata(' ../meas/my_first_measurement' + ' _metadata.json' )
206
206
207
207
```
@@ -211,7 +211,7 @@ _, acquisition_parameters, _, _ = read_metadata('../meas/my_first_measurement' +
211
211
An example network can be downloaded [ here] ( https://www.creatis.insa-lyon.fr/~ducros/spyritexamples/2021_ISTE/NET_c0mp_N0_50.0_sig_0.0_Denoi_N_64_M_1024_epo_40_lr_0.001_sss_20_sdr_0.2_bs_256_reg_1e-07.pth ) , which you can save in ` ./models/ ` . It allows to reconstruction images from only 1'024 hadamard coefficients (i.e., 2'048 raw measurements)
212
212
213
213
``` python
214
- from singlepixel import ReconstructionParameters, setup_reconstruction
214
+ from spas import ReconstructionParameters, setup_reconstruction
215
215
network_params = ReconstructionParameters(
216
216
img_size = 64 ,
217
217
CR = 1024 ,
@@ -237,18 +237,18 @@ model, device = setup_reconstruction(cov_path, mean_path, '../stats/H.npy', mode
237
237
238
238
Load noise calibration parameters (provided with the data or computed using ` /noise-calibration/noise_modeling.py ` )
239
239
``` python
240
- from singlepixel import load_noise
240
+ from spas import load_noise
241
241
noise = load_noise(' ../noise-calibration/fit_model.npz' )
242
242
```
243
243
244
244
Bin before reconstruction and plot
245
245
246
246
``` python
247
- from singlepixel import spectral_binning
247
+ from spas import spectral_binning
248
248
meas_bin, wavelengths_bin, _, noise_bin = spectral_binning(meas.T, acquisition_parameters.wavelengths, 530 , 730 , 8 , noise)
249
249
```
250
250
``` python
251
- from singlepixel import reconstruct, plot_color
251
+ from spas import reconstruct, plot_color
252
252
rec = reconstruct(model, device, meas_bin[0 :8192 // 4 ,:], 1 , noise_bin)
253
253
plot_color(rec, wavelengths_bin)
254
254
0 commit comments