# These datasets were taken on ID1 at the ESRF in the small angle geometry on a single Vaterite nano-particle

# 0) Set the GPU number in the PYNX_PU if not already done (replace '1' by your trainee number):
export PYNX_PU=.1

# 1) Look at the raw data file and the mask:

silx view T25_60_3D.cxi

# 2) perform a quick analysis. The initial support will be calculated using
# auto-correlation, so no need to supply one.

pynx-cdi-id10 data=T25_60_3D.cxi support=circle support_size=70 nb_raar=800 nb_hio=0 nb_er=200 verbose=50 support_smooth_width_begin=3 support_smooth_width_end=1 positivity support_threshold=0.2 support_threshold_method=max max_size=512 liveplot


# 3) Look at the result using silx:

silx view latest.cxi

# You can tune the threshold if you want to improve the solution, or try HIO instead of RAAR (nb_hio=800 nb_raar=0)


# 4) (takes longer) perform 10 runs and combine the 5 best ones (takes a little longer, 30s per run on a V100 GPU, liveplot is disabled)
# Note support_threshold=0.1,0.2 means threshold is randomly chosen between 0.1 and 0.2 for each run

rm -f *LLK*.cxi  # remove previous results

pynx-cdi-id10 data=T25_60_3D.cxi support=circle support_size=70 nb_raar=800 nb_hio=0 nb_er=200 verbose=50 support_smooth_width_begin=3 support_smooth_width_end=1 positivity support_threshold=0.1,0.2 support_threshold_method=max max_size=512 nb_run=10 nb_run_keep=5

pynx-cdi-analysis *LLK*.cxi modes movie   # mode analysis
silx view *modes*.h5		                 # look at modes analysis
vlc *.mp4                    # See movie of slices from modes analysis
