Phase Object Reconstruction for 4D-STEM using Deep Learning, (4D-STEM Training Data)
Overview This repository contains 742,688 samples of simulated Convergent Beam Electron Diffraction patterns (CBEDs); the training data for the paper "Phase Object Reconstruction for 4D-STEM using Deep Learning". The folder contains multiple hdf5 datasets. Each dataset has a corresponding Excel-sheet containing detailed information and simulation parameters for every datapoint, as well as a summary-report containing the parameter distributions, hdf5-infos and random number generator settings. This makes every dataset reproducible, using the simulation codes provided in https://github.com/ThFriedrich/ap_data_generation.
Technical details Every Datapoint consists of a 3x3 set of adjacent Convergent Beam Electron Diffraction pattern (CBEDs), the coherent exit wave phase and amplitude in real and reciprocal space, and the probe functions phase and amplitude in real space. All patterns are 64x64 pixel in 16 bit unsigned integer data format. Every hdf5 file has the following structure: The data was written to hdf5 in matlab. When reading from these files consider possibly different storage conventions (Row major vs. column major format). Data may need to be transposed accordingly. The integer arrays were scaled to use the full range of the uint16 datatype. The scaling values are stored under "meta". To restore the original values in floating point numbers, convert the arrays like this: Matlab:
Attributes 'Seed': 6108236
'State': 251786606 ...
'Type': 'twister'
'arch': 'glnxa64'
'gpu': 'NVIDIA GeForce RTX 3080'
'matlab_ver': '2021a'
Dataset 'features' Size: 64x64x9x5000
Datatype: H5T_STD_U16LE (uint16)
Dataset 'labels_k' Size: 64x64x2x5000
Datatype: H5T_STD_U16LE (uint16)
Dataset 'labels_r' Size: 64x64x2x5000
Datatype: H5T_STD_U16LE (uint16)
Dataset 'probe_r' Size: 64x64x2x5000
Datatype: H5T_STD_U16LE (uint16)
Dataset 'meta' Size: 19x5000
Datatype: H5T_IEEE_F32LE (single)
hdf_file = ['db_h5_b_5_Training.h5'];
n = 128; % load `n` k-space exit waves
x = single(h5read(hdf_file, '/labels_k', [1,1,1,1], [64,64,2,n])); % `meta` contains parameters and scaling factors for a given datapoint in following order: [E_0(keV), cond_lens_outer_aper_ang(mrad), collection angle(rA), step_size(A), scale_cbed_1 ... scale_cbed_9, scale_phase_k, scale_amp_k, scale_phase_r, scale_amp_r, scale_probe_phase_r, scale_probe_amp_r]
s = h5read(hdf_file, '/meta', [14,1], [2,n]);
amplitude = zeros(64,64,n);
phase = zeros(64,64,n);
for ix = 1:n
phase(:,:,n) = (x(:,:,1,n)*s(1,ix) / 65536) - pi;
amplitude(:,:,n) = (x(:,:,2,n)*s(2,ix)) / 65536;
end
% The 9 CBEDs correspond to a 3x3 kernel of patterns. The order in [x,y] is: %[[3, 6, 9]; % [2, 5, 8]; % [1, 4, 7]]