copy-nx tutorial#

5 min read

the copy-nx command can be used to copy one or several NXtomo contained in a file to another location.

Examples#

copy a single file (with potentially several NXtomo)#

nxtomomill nx-copy /path/to/nxomofile.nx .
nxtomomill nx-copy /path/to/nxomofile.nx new.nx

copy a single NXtomo (potentially contained in a file with several NXtomo)#

nxtomomill nx-copy /path/to/nxomofile.nx --entry entry0000  .
nxtomomill nx-copy /path/to/nxomofile.nx --entries entry0000,entry0001  .

copy a set of file#

for file in *.nx
do
    nxtomomill nx-copy "$file" /new/path/"$file"
done

Virtual dataset behavior#

If the source file contains HDF5 virtual dataset then the virtual source will be updated to fix relative links.

You can also use the ‘remove-vds’ option. In this case the HDF5 - virtual dataset will be replaced by a standard HDF5 dataset (getting rid of the virtual link). But be aware that with this option full dataaset must be able to fill in memory in order to modify it (at least for now).

Help#

usage: nxtomomill nx-copy [-h] [--entry ENTRIES] [--overwrite] [--debug]
                          [--remove-vds]
                          [nexus_file] [output_file]

copy one or several NXtomo to another location

positional arguments:
  nexus_file            file path to the nexus file containing NXtomo
  output_file           output nexus file

options:
  -h, --help            show this help message and exit
  --entry ENTRIES, --entries ENTRIES
                        NXtomo path(s) to be copied. If none provided then all
                        NXtomo entries will be copied
  --overwrite           Do not ask for user permission to overwrite output
                        files
  --debug               Set logs to debug mode
  --remove-vds          Remove any Virtual dataset to the resulting NXtomo
                        (duplicate detector data - warning: all data will be
                        load in memory before dumping it)