Saving results

PAOS implements different saving routines, summarized here, that can be used to save the main POP simulation results.

Save output

The base saving method, save_output, receives as input the POP simulation output dictionary, a hdf5 file name and the keys to store at each surface and saves the dictionary along with the PAOS package information to the hdf5 output file. If indicated, this function overwrites a previously saved file.

The hdf5 file is structured in two sub-folders, as shown in Fig. 28. The first one is labelled with the wavelength used in the simulation, while the other is labelled ‘info’.

../../_images/output_gen.png

Fig. 28 Output file general interface

The first folder contains a list of sub-folders, in which is stored the data relative to the individual optical surfaces. Each surface is labelled as ‘S#’ where # is the surface index, as shown in Fig. 29.

../../_images/output_surfaces.png

Fig. 29 Output file surfaces interface

The ‘info’ folder contains the data that are needed for traceability and versioning of the results, as shown in Fig. 30.

This includes:

  1. The HDF5 package version

  2. The PAOS creator names

  3. The saving path

  4. The saving time in human readable format

  5. The h5py version

  6. This package’s name

  7. This package’s version

../../_images/output_info.png

Fig. 30 Output file info interface

Example

Code example to use save_output to save the POP simulation output dictionary.

The user can select to save only the relevant dictionary keys, here ‘wfo’ (the complex wavefront array), ‘dx’ (the sampling along the horizontal axis), ‘dy’ (the sampling along the vertical axis).

from paos.core.saveOutput import save_output
save_output(ret_val,
            file_name='path/to/hdf5',
            keys_to_keep=['wfo', 'dx', 'dy'],
            overwrite=True)

Save datacube

The save_datacube method receives as input a list of output dictionaries for each POP simulation, a hdf5 file name, a list of identifiers to tag each simulation and the relevant keys to store at each surface, and saves all the outputs to a data cube stored in the hdf5 output file. If indicated, this method overwrites a previously saved file.

Fig. 31

../../_images/output_cube.png

Fig. 31 Output file cube general interface

Example

Code example to use save_datacube to save the output dictionary for multiple POP simulations done at different wavelengths.

The user can select to save only the relevant dictionary keys, here ‘amplitude’ (the wavefront amplitude), ‘dx’ (the sampling along the horizontal axis), ‘dy’ (the sampling along the vertical axis).

from paos.core.saveOutput import save_datacube

save_datacube(retval_list=ret_val_list,
              file_name='path/to/hdf5',
              group_names=['2.5', '3.0'],
              keys_to_keep=['amplitude', 'dx', 'dy'],
              overwrite=True)