%pullls data from csv file and formats into spectra array
%removes first 2 data points because are not pixel data
%Insion 1.7 device used to test spectrolon for 60 seconds each run 
%array gain=low, gain=1.1, offset=-57mV
%x040 corrsponds to 40ms integration
%x080 corrsponds to 40ms integration
%x160 corrsponds to 40ms integration
%x320 corrsponds to 40ms integration

x1=load('TINT_040_PDAG_0_OFFS-57_GAIN1.1_ADCV_2_2025_09_03_15_43_58.csv');
x2=load('TINT_080_PDAG_0_OFFS-57_GAIN1.1_ADCV_2_2025_09_03_15_41_55.csv');
x3=load('TINT_160_PDAG_0_OFFS-57_GAIN1.1_ADCV_2_2025_09_03_15_38_56.csv');
x4=load('TINT_320_PDAG_0_OFFS-57_GAIN1.1_ADCV_2_2025_09_03_15_33_04.csv');

[N1 M] =size(x1);
[N2 M] =size(x2);
[N3 M] =size(x3);
[N4 M] =size(x4);

M=256;
dN1=N1/M;
dN2=N2/M;
dN3=N3/M;
dN4=N4/M;

 x1=reshape(x1,[M,dN1])';
 x2=reshape(x2,[M,dN2])';
 x3=reshape(x3,[M,dN3])';
 x4=reshape(x4,[M,dN4])';

 x040=x1(:,3:256);
 x080=x2(:,3:256);
 x160=x3(:,3:256);
 x320=x4(:,3:256);

 save('dat_insion4_17') 




