# These CXI datasets were taken on id01 with a Siemens star target

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

# 1) analyse it using (maxframe=256 will just take the first 256 frames to go faster):

pynx-cxipty.py cxifile=201606id01-FZP-S0013.cxi probe=focus,60e-6x200e-6,0.09 defocus=200e-6 loadmask=maxipix algorithm=analysis,ML**100,DM**200,probe=1 maxframe=256 saveplot liveplot save=all

# 2) You can look at the results of the analysis using:

eog ResultsScan0013/lat*.png

or:
 silx view ResultsScan0013/latest.cxi
(with silx, use the 'image' viewer and see the amplitude, phase or mixed phase/amplitude view)


# 3) Analysis with modes (and all frames)

pynx-cxipty.py cxifile=201606id01-FZP-S0013.cxi probe=focus,60e-6x200e-6,0.09 defocus=200e-6 loadmask=maxipix algorithm=analysis,ML**100,DM**200,nbprobe=3,probe=1 saveplot liveplot save=all


# 4) You can restart from a previous optimisation...with just the probe:

pynx-cxipty.py cxifile=201606id01-FZP-S0013.cxi loadprobe=ResultsScan0013/latest.cxi loadmask=maxipix algorithm=analysis,ML**100,DM**200,probe=1 saveplot save=all


# 5) You can also restart from a previous optimisation with both object and probe:

pynx-cxipty.py cxifile=201606id01-FZP-S0013.cxi load=ResultsScan0013/latest.cxi loadmask=maxipix algorithm=analysis,ML**100,DM**200,probe=1 saveplot save=all


# 6) Looking at the size of the probe and scanned area, it's clear way too many points were measured,
# so you can reduce the points used by using 'maxframe', 'moduloframe', or even reduce
# the data size using 'rebin' (if the probe size is small and there is enough oversampling)

pynx-cxipty.py cxifile=201606id01-FZP-S0013.cxi probe=focus,60e-6x200e-6,0.09 defocus=200e-6 loadmask=maxipix algorithm=analysis,ML**100,DM**200,probe=1 saveplot save=all moduloframe=4 liveplot

# 7) Analysis with modes, all frames, and optimisation of positions

pynx-cxipty.py cxifile=201606id01-FZP-S0013.cxi probe=focus,60e-6x200e-6,0.09 defocus=200e-6 loadmask=maxipix algorithm=analysis,ML**100,AP**100,position=1,AP**50,DM**200,nbprobe=3,probe=1 saveplot liveplot save=all

