Compare commits
No commits in common. "d4c8b6a98c9522145fbe90e6d52553fc2ea41695" and "8de31a8c5362e1ebf9bbe329a809affe05f162c4" have entirely different histories.
d4c8b6a98c
...
8de31a8c53
@ -1,18 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Directory containing SVG files
|
|
||||||
INPUT_DIR="."
|
|
||||||
|
|
||||||
# Loop through all SVG files in the directory
|
|
||||||
for svg_file in "$INPUT_DIR"/*.svg; do
|
|
||||||
# Check if there are SVG files in the directory
|
|
||||||
if [ -f "$svg_file" ]; then
|
|
||||||
# Output PDF file name
|
|
||||||
pdf_file="../${svg_file%.svg}.pdf"
|
|
||||||
png_file="../${svg_file%.svg}"
|
|
||||||
|
|
||||||
# Convert SVG to PDF using Inkscape
|
|
||||||
inkscape "$svg_file" --export-filename="$pdf_file" && \
|
|
||||||
pdftocairo -png -singlefile -cropbox "$pdf_file" "$png_file"
|
|
||||||
fi
|
|
||||||
done
|
|
Before Width: | Height: | Size: 20 MiB After Width: | Height: | Size: 20 MiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,61 +1,102 @@
|
|||||||
% function [cntrs,tp] = h5scan(pth,smp,ds,sn,varargin)
|
function [cntrs,tp] = h5scan(pth,smp,ds,sn,varargin)
|
||||||
function [cntrs,tp] = h5scan(ds,sn)
|
|
||||||
if ~isstr(ds), ds = sprintf('%.4d',ds); end;
|
|
||||||
|
|
||||||
f = sprintf('%s.h5',ds);
|
i = cellfun(@(x) isa(x,'detector'),varargin);
|
||||||
h = h5info(f,sprintf('/%d.1/measurement',sn));
|
if any(i), det = varargin{i}; varargin = varargin(~i); else, det = []; end;
|
||||||
fid = H5F.open(f);
|
if ~isstr(ds), ds = sprintf('%.4d',ds); end;
|
||||||
for i = 1:length(h.Links)
|
|
||||||
nm = h.Links(i).Name;
|
|
||||||
try
|
|
||||||
id = H5D.open(fid,h.Links(i).Value{1});
|
|
||||||
cntrs.(nm) = H5D.read(id);
|
|
||||||
H5D.close(id);
|
|
||||||
if ~isempty(det) & strcmp(nm,det.name), cntrs.(nm) = integrate(det,double(cntrs.(nm))); end;
|
|
||||||
end
|
|
||||||
[~,tp.(nm)] = fileparts(h.Links(i).Value{1});
|
|
||||||
end
|
|
||||||
try
|
|
||||||
h = h5info(f,sprintf('/%d.2/measurement',sn));
|
|
||||||
catch
|
|
||||||
h = [];
|
|
||||||
end
|
|
||||||
if ~isempty(h)
|
|
||||||
for i = 1:length(h.Links)
|
|
||||||
nm = h.Links(i).Name;
|
|
||||||
try
|
|
||||||
id = H5D.open(fid,h.Links(i).Value{1});
|
|
||||||
cntrs.part2.(nm) = H5D.read(id);
|
|
||||||
H5D.close(id);
|
|
||||||
end
|
|
||||||
[~,tp.part2.(nm)] = fileparts(h.Links(i).Value{1});
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
H5F.close(fid);
|
f = sprintf('%s/%s/%s_%s/%s_%s.h5',pth,smp,smp,ds,smp,ds);
|
||||||
|
h = h5info(f,sprintf('/%d.1/measurement',sn));
|
||||||
|
fid = H5F.open(f);
|
||||||
|
for i = 1:length(h.Links),
|
||||||
|
nm = h.Links(i).Name;
|
||||||
|
try,
|
||||||
|
id = H5D.open(fid,h.Links(i).Value{1});
|
||||||
|
cntrs.(nm) = H5D.read(id);
|
||||||
|
H5D.close(id);
|
||||||
|
if ~isempty(det) & strcmp(nm,det.name), cntrs.(nm) = integrate(det,double(cntrs.(nm))); end;
|
||||||
|
catch,
|
||||||
|
warning('solving problem with %s\n',nm);
|
||||||
|
cntrs.(nm) = vrtlds(sprintf('%s/%s/%s_%s/scan%.4d/',pth,smp,smp,ds,sn),nm,det);
|
||||||
|
end;
|
||||||
|
[~,tp.(nm)] = fileparts(h.Links(i).Value{1});
|
||||||
|
end;
|
||||||
|
try,
|
||||||
|
h = h5info(f,sprintf('/%d.2/measurement',sn));
|
||||||
|
catch,
|
||||||
|
h = [];
|
||||||
|
end;
|
||||||
|
if ~isempty(h),
|
||||||
|
for i = 1:length(h.Links),
|
||||||
|
nm = h.Links(i).Name;
|
||||||
|
try,
|
||||||
|
id = H5D.open(fid,h.Links(i).Value{1});
|
||||||
|
cntrs.part2.(nm) = H5D.read(id);
|
||||||
|
H5D.close(id);
|
||||||
|
catch,
|
||||||
|
warning('solving problem with %s\n',nm);
|
||||||
|
cntrs.part2.(nm) = vrtlds(sprintf('%s/%s/%s_%s/scan%.4d/',pth,smp,smp,ds,sn),nm,det);
|
||||||
|
end;
|
||||||
|
[~,tp.part2.(nm)] = fileparts(h.Links(i).Value{1});
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if length(varargin),
|
||||||
|
fn = sprintf('/%d.1/instrument/positioners/',sn);
|
||||||
|
h = h5info(f,fn);
|
||||||
|
[~,k,m] = intersect({h.Datasets.Name},varargin,'stable');
|
||||||
|
h.Datasets = h.Datasets(k);
|
||||||
|
for i = 1:length(h.Datasets),
|
||||||
|
id = H5D.open(fid,[fn h.Datasets(i).Name]);
|
||||||
|
cntrs.(h.Datasets(i).Name) = H5D.read(id);
|
||||||
|
H5D.close(id);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%
|
H5F.close(fid);
|
||||||
|
|
||||||
function A = vrtlds(f,nm,det)
|
%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
n = 0; A = [];
|
|
||||||
fn = sprintf('%s/%s_%.4d.h5',f,nm,n);
|
|
||||||
|
|
||||||
while exist(fn) == 2
|
function A = vrtlds(f,nm,det)
|
||||||
fid = H5F.open(fn); n = n+1;
|
%try,
|
||||||
id = H5D.open(fid,sprintf('/entry_0000/ESRF-ID31/%s/data',nm));
|
n = 0; A = [];
|
||||||
if 2 < nargin & strcmp(nm,'p3') & ~isempty(det)
|
fn = sprintf('%s/%s_%.4d.h5',f,nm,n);
|
||||||
fprintf('integrating %s\n',fn);
|
while exist(fn) == 2,
|
||||||
if isempty(A)
|
fid = H5F.open(fn); n = n+1;
|
||||||
A = integrate(det,double(H5D.read(id)),1);
|
id = H5D.open(fid,sprintf('/entry_0000/ESRF-ID31/%s/data',nm));
|
||||||
else
|
if 2 < nargin & strcmp(nm,'p3') & ~isempty(det),
|
||||||
tmp = integrate(det,double(H5D.read(id)),1); A.y = cat(2,A.y,tmp.y); A.y0 = cat(2,A.y0,tmp.y0);
|
fprintf('integrating %s\n',fn);
|
||||||
end
|
if isempty(A),
|
||||||
else
|
A = integrate(det,double(H5D.read(id)),1);
|
||||||
fprintf('loading %s\n',fn);
|
else,
|
||||||
A = cat(3,A,H5D.read(id));
|
tmp = integrate(det,double(H5D.read(id)),1); A.y = cat(2,A.y,tmp.y); A.y0 = cat(2,A.y0,tmp.y0);
|
||||||
end
|
end;
|
||||||
H5D.close(id); H5F.close(fid);
|
else,
|
||||||
fn = sprintf('%s/%s_%.4d.h5',f,nm,n);
|
fprintf('loading %s\n',fn);
|
||||||
end
|
A = cat(3,A,H5D.read(id));
|
||||||
end
|
end;
|
||||||
end
|
H5D.close(id); H5F.close(fid);
|
||||||
|
fn = sprintf('%s/%s_%.4d.h5',f,nm,n);
|
||||||
|
end;
|
||||||
|
%catch,
|
||||||
|
% A = [];
|
||||||
|
%end;
|
||||||
|
|
||||||
|
% fid = H5F.open...
|
||||||
|
% id = H5D.open...
|
||||||
|
% sid = H5D.get_space(id);
|
||||||
|
% [ndims,h5_dims]=H5S.get_simple_extent_dims(sid)
|
||||||
|
|
||||||
|
% Read a 2x3 hyperslab of data from a dataset, starting in the 4th row and 5th column of the example dataset.
|
||||||
|
% Create a property list identifier, then open the HDF5 file and the dataset /g1/g1.1/dset1.1.1.
|
||||||
|
|
||||||
|
% fid = H5F.open('example.h5');
|
||||||
|
% id = H5D.open(fid,'/g1/g1.1/dset1.1.1');
|
||||||
|
|
||||||
|
% dims = ([500 1679 1475];
|
||||||
|
% msid = H5S.create_simple(3,dims,[]);
|
||||||
|
% sid = H5D.get_space(id);
|
||||||
|
% offset = [n*500 0 0];
|
||||||
|
% block = dims; % d1: 500 or min(d1tot-n*500,500)
|
||||||
|
% H5S.select_hyperslab(sid,'H5S_SELECT_SET',offset,[],[],block);
|
||||||
|
% data = H5D.read(id,'H5ML_DEFAULT',msid,sid,'H5P_DEFAULT');
|
||||||
|
% H5D.close(id);
|
||||||
|
% H5F.close(fid);
|
||||||
|
@ -46,9 +46,9 @@ Hm = [ 0 1 0 -l2 0;
|
|||||||
|
|
||||||
%% Angular alignment
|
%% Angular alignment
|
||||||
% Load Data
|
% Load Data
|
||||||
data_it0 = h5scan('alignment_h1rx_h1ry', 1);
|
data_it0 = h5scan(data_dir, 'alignment', 'h1rx_h1ry', 1);
|
||||||
data_it1 = h5scan('alignment_h1rx_h1ry_0002', 3);
|
data_it1 = h5scan(data_dir, 'alignment', 'h1rx_h1ry_0002', 3);
|
||||||
data_it2 = h5scan('alignment_h1rx_h1ry_0002', 5);
|
data_it2 = h5scan(data_dir, 'alignment', 'h1rx_h1ry_0002', 5);
|
||||||
|
|
||||||
% Offset wrong points
|
% Offset wrong points
|
||||||
i_it0 = find(abs(data_it0.Rx_int_filtered(2:end)-data_it0.Rx_int_filtered(1:end-1))>1e-5);
|
i_it0 = find(abs(data_it0.Rx_int_filtered(2:end)-data_it0.Rx_int_filtered(1:end-1))>1e-5);
|
||||||
@ -81,8 +81,8 @@ ylim([-100, 800]);
|
|||||||
|
|
||||||
%% Eccentricity alignment
|
%% Eccentricity alignment
|
||||||
% Load Data
|
% Load Data
|
||||||
data_it0 = h5scan('alignment_h1rx_h1ry_0002', 5);
|
data_it0 = h5scan(data_dir, 'alignment', 'h1rx_h1ry_0002', 5);
|
||||||
data_it1 = h5scan('alignment_h1dx_h1dy', 1);
|
data_it1 = h5scan(data_dir, 'alignment', 'h1dx_h1dy', 1);
|
||||||
|
|
||||||
% Offset wrong points
|
% Offset wrong points
|
||||||
i_it0 = find(abs(data_it0.Dy_int_filtered(2:end)-data_it0.Dy_int_filtered(1:end-1))>1e-5);
|
i_it0 = find(abs(data_it0.Dy_int_filtered(2:end)-data_it0.Dy_int_filtered(1:end-1))>1e-5);
|
||||||
@ -110,7 +110,7 @@ ylim([-8, 14]);
|
|||||||
% This is estimated by moving the spheres using the micro-hexapod
|
% This is estimated by moving the spheres using the micro-hexapod
|
||||||
|
|
||||||
% Dx
|
% Dx
|
||||||
data_dx = h5scan('metrology_acceptance_new_align_dx', 1);
|
data_dx = h5scan(data_dir, 'metrology_acceptance_new_align', 'dx', 1);
|
||||||
|
|
||||||
dx_acceptance = zeros(5,1);
|
dx_acceptance = zeros(5,1);
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ for i = [1:size(dx_acceptance, 1)]
|
|||||||
end
|
end
|
||||||
|
|
||||||
% Dy
|
% Dy
|
||||||
data_dy = h5scan('metrology_acceptance_new_align_dy', 1);
|
data_dy = h5scan(data_dir, 'metrology_acceptance_new_align', 'dy', 1);
|
||||||
|
|
||||||
dy_acceptance = zeros(5,1);
|
dy_acceptance = zeros(5,1);
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ for i = [1:size(dy_acceptance, 1)]
|
|||||||
end
|
end
|
||||||
|
|
||||||
% Dz
|
% Dz
|
||||||
data_dz = h5scan('metrology_acceptance_new_align_dz', 1);
|
data_dz = h5scan(data_dir, 'metrology_acceptance_new_align', 'dz', 1);
|
||||||
|
|
||||||
dz_acceptance = zeros(5,1);
|
dz_acceptance = zeros(5,1);
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ leg = legend('location', 'northeast', 'FontSize', 8, 'NumColumns', 1);
|
|||||||
leg.ItemTokenSize(1) = 15;
|
leg.ItemTokenSize(1) = 15;
|
||||||
|
|
||||||
%% X-Y scan with the micro-hexapod, and record of the vertical interferometer
|
%% X-Y scan with the micro-hexapod, and record of the vertical interferometer
|
||||||
data = h5scan('metrology_acceptance_after_int_align_meshXY', 1);
|
data = h5scan(data_dir, 'metrology_acceptance', 'after_int_align_meshXY', 1);
|
||||||
|
|
||||||
x = 1e3*detrend(data.h1tx, 0); % [um]
|
x = 1e3*detrend(data.h1tx, 0); % [um]
|
||||||
y = 1e3*detrend(data.h1ty, 0); % [um]
|
y = 1e3*detrend(data.h1ty, 0); % [um]
|
||||||
|
@ -198,10 +198,10 @@ linkaxes([ax1,ax2],'x');
|
|||||||
xlim([1, 1e3]);
|
xlim([1, 1e3]);
|
||||||
|
|
||||||
%% Load Data
|
%% Load Data
|
||||||
data_1_dx = h5scan('align_int_enc_Rz_tx_first_scan', 2);
|
data_1_dx = h5scan(data_dir, 'align_int_enc_Rz', 'tx_first_scan', 2);
|
||||||
data_1_dy = h5scan('align_int_enc_Rz_tx_first_scan', 3);
|
data_1_dy = h5scan(data_dir, 'align_int_enc_Rz', 'tx_first_scan', 3);
|
||||||
data_2_dx = h5scan('align_int_enc_Rz_verif-after-correct-offset', 1);
|
data_2_dx = h5scan(data_dir, 'align_int_enc_Rz', 'verif-after-correct-offset', 1);
|
||||||
data_2_dy = h5scan('align_int_enc_Rz_verif-after-correct-offset', 2);
|
data_2_dy = h5scan(data_dir, 'align_int_enc_Rz', 'verif-after-correct-offset', 2);
|
||||||
|
|
||||||
% Estimation of Rz misalignment
|
% Estimation of Rz misalignment
|
||||||
p1 = polyfit(data_1_dx.Dx_int_filtered, data_1_dx.Dy_int_filtered, 1);
|
p1 = polyfit(data_1_dx.Dx_int_filtered, data_1_dx.Dy_int_filtered, 1);
|
||||||
|
@ -685,9 +685,9 @@ The remaining errors after alignment are in the order of $\pm5\,\mu\text{rad}$ i
|
|||||||
#+begin_src matlab
|
#+begin_src matlab
|
||||||
%% Angular alignment
|
%% Angular alignment
|
||||||
% Load Data
|
% Load Data
|
||||||
data_it0 = h5scan('alignment_h1rx_h1ry', 1);
|
data_it0 = h5scan(data_dir, 'alignment', 'h1rx_h1ry', 1);
|
||||||
data_it1 = h5scan('alignment_h1rx_h1ry_0002', 3);
|
data_it1 = h5scan(data_dir, 'alignment', 'h1rx_h1ry_0002', 3);
|
||||||
data_it2 = h5scan('alignment_h1rx_h1ry_0002', 5);
|
data_it2 = h5scan(data_dir, 'alignment', 'h1rx_h1ry_0002', 5);
|
||||||
|
|
||||||
% Offset wrong points
|
% Offset wrong points
|
||||||
i_it0 = find(abs(data_it0.Rx_int_filtered(2:end)-data_it0.Rx_int_filtered(1:end-1))>1e-5);
|
i_it0 = find(abs(data_it0.Rx_int_filtered(2:end)-data_it0.Rx_int_filtered(1:end-1))>1e-5);
|
||||||
@ -728,8 +728,8 @@ exportFig('figs/test_id31_metrology_align_rx_ry.pdf', 'width', 'half', 'height',
|
|||||||
#+begin_src matlab
|
#+begin_src matlab
|
||||||
%% Eccentricity alignment
|
%% Eccentricity alignment
|
||||||
% Load Data
|
% Load Data
|
||||||
data_it0 = h5scan('alignment_h1rx_h1ry_0002', 5);
|
data_it0 = h5scan(data_dir, 'alignment', 'h1rx_h1ry_0002', 5);
|
||||||
data_it1 = h5scan('alignment_h1dx_h1dy', 1);
|
data_it1 = h5scan(data_dir, 'alignment', 'h1dx_h1dy', 1);
|
||||||
|
|
||||||
% Offset wrong points
|
% Offset wrong points
|
||||||
i_it0 = find(abs(data_it0.Dy_int_filtered(2:end)-data_it0.Dy_int_filtered(1:end-1))>1e-5);
|
i_it0 = find(abs(data_it0.Dy_int_filtered(2:end)-data_it0.Dy_int_filtered(1:end-1))>1e-5);
|
||||||
@ -793,7 +793,7 @@ The obtained lateral acceptance for pure displacements in any direction is estim
|
|||||||
% This is estimated by moving the spheres using the micro-hexapod
|
% This is estimated by moving the spheres using the micro-hexapod
|
||||||
|
|
||||||
% Dx
|
% Dx
|
||||||
data_dx = h5scan('metrology_acceptance_new_align_dx', 1);
|
data_dx = h5scan(data_dir, 'metrology_acceptance_new_align', 'dx', 1);
|
||||||
|
|
||||||
dx_acceptance = zeros(5,1);
|
dx_acceptance = zeros(5,1);
|
||||||
|
|
||||||
@ -809,7 +809,7 @@ for i = [1:size(dx_acceptance, 1)]
|
|||||||
end
|
end
|
||||||
|
|
||||||
% Dy
|
% Dy
|
||||||
data_dy = h5scan('metrology_acceptance_new_align_dy', 1);
|
data_dy = h5scan(data_dir, 'metrology_acceptance_new_align', 'dy', 1);
|
||||||
|
|
||||||
dy_acceptance = zeros(5,1);
|
dy_acceptance = zeros(5,1);
|
||||||
|
|
||||||
@ -825,7 +825,7 @@ for i = [1:size(dy_acceptance, 1)]
|
|||||||
end
|
end
|
||||||
|
|
||||||
% Dz
|
% Dz
|
||||||
data_dz = h5scan('metrology_acceptance_new_align_dz', 1);
|
data_dz = h5scan(data_dir, 'metrology_acceptance_new_align', 'dz', 1);
|
||||||
|
|
||||||
dz_acceptance = zeros(5,1);
|
dz_acceptance = zeros(5,1);
|
||||||
|
|
||||||
@ -920,7 +920,7 @@ exportFig('figs/test_id31_interf_noise.pdf', 'width', 'half', 'height', 'normal'
|
|||||||
|
|
||||||
#+begin_src matlab
|
#+begin_src matlab
|
||||||
%% X-Y scan with the micro-hexapod, and record of the vertical interferometer
|
%% X-Y scan with the micro-hexapod, and record of the vertical interferometer
|
||||||
data = h5scan('metrology_acceptance_after_int_align_meshXY', 1);
|
data = h5scan(data_dir, 'metrology_acceptance', 'after_int_align_meshXY', 1);
|
||||||
|
|
||||||
x = 1e3*detrend(data.h1tx, 0); % [um]
|
x = 1e3*detrend(data.h1tx, 0); % [um]
|
||||||
y = 1e3*detrend(data.h1ty, 0); % [um]
|
y = 1e3*detrend(data.h1ty, 0); % [um]
|
||||||
@ -1305,10 +1305,10 @@ Results shown in Figure ref:fig:test_id31_Rz_align_correct are indeed indicating
|
|||||||
|
|
||||||
#+begin_src matlab
|
#+begin_src matlab
|
||||||
%% Load Data
|
%% Load Data
|
||||||
data_1_dx = h5scan('align_int_enc_Rz_tx_first_scan', 2);
|
data_1_dx = h5scan(data_dir, 'align_int_enc_Rz', 'tx_first_scan', 2);
|
||||||
data_1_dy = h5scan('align_int_enc_Rz_tx_first_scan', 3);
|
data_1_dy = h5scan(data_dir, 'align_int_enc_Rz', 'tx_first_scan', 3);
|
||||||
data_2_dx = h5scan('align_int_enc_Rz_verif-after-correct-offset', 1);
|
data_2_dx = h5scan(data_dir, 'align_int_enc_Rz', 'verif-after-correct-offset', 1);
|
||||||
data_2_dy = h5scan('align_int_enc_Rz_verif-after-correct-offset', 2);
|
data_2_dy = h5scan(data_dir, 'align_int_enc_Rz', 'verif-after-correct-offset', 2);
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src matlab
|
#+begin_src matlab
|
||||||
@ -5208,67 +5208,108 @@ specs_ry_rms = 0.25; % [urad RMS]
|
|||||||
:header-args:matlab+: :comments none :mkdirp yes :eval no
|
:header-args:matlab+: :comments none :mkdirp yes :eval no
|
||||||
:END:
|
:END:
|
||||||
#+begin_src matlab
|
#+begin_src matlab
|
||||||
% function [cntrs,tp] = h5scan(pth,smp,ds,sn,varargin)
|
function [cntrs,tp] = h5scan(pth,smp,ds,sn,varargin)
|
||||||
function [cntrs,tp] = h5scan(ds,sn)
|
|
||||||
if ~isstr(ds), ds = sprintf('%.4d',ds); end;
|
|
||||||
|
|
||||||
f = sprintf('%s.h5',ds);
|
i = cellfun(@(x) isa(x,'detector'),varargin);
|
||||||
h = h5info(f,sprintf('/%d.1/measurement',sn));
|
if any(i), det = varargin{i}; varargin = varargin(~i); else, det = []; end;
|
||||||
fid = H5F.open(f);
|
if ~isstr(ds), ds = sprintf('%.4d',ds); end;
|
||||||
for i = 1:length(h.Links)
|
|
||||||
nm = h.Links(i).Name;
|
|
||||||
try
|
|
||||||
id = H5D.open(fid,h.Links(i).Value{1});
|
|
||||||
cntrs.(nm) = H5D.read(id);
|
|
||||||
H5D.close(id);
|
|
||||||
if ~isempty(det) & strcmp(nm,det.name), cntrs.(nm) = integrate(det,double(cntrs.(nm))); end;
|
|
||||||
end
|
|
||||||
[~,tp.(nm)] = fileparts(h.Links(i).Value{1});
|
|
||||||
end
|
|
||||||
try
|
|
||||||
h = h5info(f,sprintf('/%d.2/measurement',sn));
|
|
||||||
catch
|
|
||||||
h = [];
|
|
||||||
end
|
|
||||||
if ~isempty(h)
|
|
||||||
for i = 1:length(h.Links)
|
|
||||||
nm = h.Links(i).Name;
|
|
||||||
try
|
|
||||||
id = H5D.open(fid,h.Links(i).Value{1});
|
|
||||||
cntrs.part2.(nm) = H5D.read(id);
|
|
||||||
H5D.close(id);
|
|
||||||
end
|
|
||||||
[~,tp.part2.(nm)] = fileparts(h.Links(i).Value{1});
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
H5F.close(fid);
|
f = sprintf('%s/%s/%s_%s/%s_%s.h5',pth,smp,smp,ds,smp,ds);
|
||||||
|
h = h5info(f,sprintf('/%d.1/measurement',sn));
|
||||||
|
fid = H5F.open(f);
|
||||||
|
for i = 1:length(h.Links),
|
||||||
|
nm = h.Links(i).Name;
|
||||||
|
try,
|
||||||
|
id = H5D.open(fid,h.Links(i).Value{1});
|
||||||
|
cntrs.(nm) = H5D.read(id);
|
||||||
|
H5D.close(id);
|
||||||
|
if ~isempty(det) & strcmp(nm,det.name), cntrs.(nm) = integrate(det,double(cntrs.(nm))); end;
|
||||||
|
catch,
|
||||||
|
warning('solving problem with %s\n',nm);
|
||||||
|
cntrs.(nm) = vrtlds(sprintf('%s/%s/%s_%s/scan%.4d/',pth,smp,smp,ds,sn),nm,det);
|
||||||
|
end;
|
||||||
|
[~,tp.(nm)] = fileparts(h.Links(i).Value{1});
|
||||||
|
end;
|
||||||
|
try,
|
||||||
|
h = h5info(f,sprintf('/%d.2/measurement',sn));
|
||||||
|
catch,
|
||||||
|
h = [];
|
||||||
|
end;
|
||||||
|
if ~isempty(h),
|
||||||
|
for i = 1:length(h.Links),
|
||||||
|
nm = h.Links(i).Name;
|
||||||
|
try,
|
||||||
|
id = H5D.open(fid,h.Links(i).Value{1});
|
||||||
|
cntrs.part2.(nm) = H5D.read(id);
|
||||||
|
H5D.close(id);
|
||||||
|
catch,
|
||||||
|
warning('solving problem with %s\n',nm);
|
||||||
|
cntrs.part2.(nm) = vrtlds(sprintf('%s/%s/%s_%s/scan%.4d/',pth,smp,smp,ds,sn),nm,det);
|
||||||
|
end;
|
||||||
|
[~,tp.part2.(nm)] = fileparts(h.Links(i).Value{1});
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if length(varargin),
|
||||||
|
fn = sprintf('/%d.1/instrument/positioners/',sn);
|
||||||
|
h = h5info(f,fn);
|
||||||
|
[~,k,m] = intersect({h.Datasets.Name},varargin,'stable');
|
||||||
|
h.Datasets = h.Datasets(k);
|
||||||
|
for i = 1:length(h.Datasets),
|
||||||
|
id = H5D.open(fid,[fn h.Datasets(i).Name]);
|
||||||
|
cntrs.(h.Datasets(i).Name) = H5D.read(id);
|
||||||
|
H5D.close(id);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%
|
H5F.close(fid);
|
||||||
|
|
||||||
function A = vrtlds(f,nm,det)
|
%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
n = 0; A = [];
|
|
||||||
fn = sprintf('%s/%s_%.4d.h5',f,nm,n);
|
|
||||||
|
|
||||||
while exist(fn) == 2
|
function A = vrtlds(f,nm,det)
|
||||||
fid = H5F.open(fn); n = n+1;
|
%try,
|
||||||
id = H5D.open(fid,sprintf('/entry_0000/ESRF-ID31/%s/data',nm));
|
n = 0; A = [];
|
||||||
if 2 < nargin & strcmp(nm,'p3') & ~isempty(det)
|
fn = sprintf('%s/%s_%.4d.h5',f,nm,n);
|
||||||
fprintf('integrating %s\n',fn);
|
while exist(fn) == 2,
|
||||||
if isempty(A)
|
fid = H5F.open(fn); n = n+1;
|
||||||
A = integrate(det,double(H5D.read(id)),1);
|
id = H5D.open(fid,sprintf('/entry_0000/ESRF-ID31/%s/data',nm));
|
||||||
else
|
if 2 < nargin & strcmp(nm,'p3') & ~isempty(det),
|
||||||
tmp = integrate(det,double(H5D.read(id)),1); A.y = cat(2,A.y,tmp.y); A.y0 = cat(2,A.y0,tmp.y0);
|
fprintf('integrating %s\n',fn);
|
||||||
end
|
if isempty(A),
|
||||||
else
|
A = integrate(det,double(H5D.read(id)),1);
|
||||||
fprintf('loading %s\n',fn);
|
else,
|
||||||
A = cat(3,A,H5D.read(id));
|
tmp = integrate(det,double(H5D.read(id)),1); A.y = cat(2,A.y,tmp.y); A.y0 = cat(2,A.y0,tmp.y0);
|
||||||
end
|
end;
|
||||||
H5D.close(id); H5F.close(fid);
|
else,
|
||||||
fn = sprintf('%s/%s_%.4d.h5',f,nm,n);
|
fprintf('loading %s\n',fn);
|
||||||
end
|
A = cat(3,A,H5D.read(id));
|
||||||
end
|
end;
|
||||||
end
|
H5D.close(id); H5F.close(fid);
|
||||||
|
fn = sprintf('%s/%s_%.4d.h5',f,nm,n);
|
||||||
|
end;
|
||||||
|
%catch,
|
||||||
|
% A = [];
|
||||||
|
%end;
|
||||||
|
|
||||||
|
% fid = H5F.open...
|
||||||
|
% id = H5D.open...
|
||||||
|
% sid = H5D.get_space(id);
|
||||||
|
% [ndims,h5_dims]=H5S.get_simple_extent_dims(sid)
|
||||||
|
|
||||||
|
% Read a 2x3 hyperslab of data from a dataset, starting in the 4th row and 5th column of the example dataset.
|
||||||
|
% Create a property list identifier, then open the HDF5 file and the dataset /g1/g1.1/dset1.1.1.
|
||||||
|
|
||||||
|
% fid = H5F.open('example.h5');
|
||||||
|
% id = H5D.open(fid,'/g1/g1.1/dset1.1.1');
|
||||||
|
|
||||||
|
% dims = ([500 1679 1475];
|
||||||
|
% msid = H5S.create_simple(3,dims,[]);
|
||||||
|
% sid = H5D.get_space(id);
|
||||||
|
% offset = [n*500 0 0];
|
||||||
|
% block = dims; % d1: 500 or min(d1tot-n*500,500)
|
||||||
|
% H5S.select_hyperslab(sid,'H5S_SELECT_SET',offset,[],[],block);
|
||||||
|
% data = H5D.read(id,'H5ML_DEFAULT',msid,sid,'H5P_DEFAULT');
|
||||||
|
% H5D.close(id);
|
||||||
|
% H5F.close(fid);
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
*** =sphereFit= - Fit sphere from x,y,z points
|
*** =sphereFit= - Fit sphere from x,y,z points
|
||||||
|
Reference in New Issue
Block a user