Combine images n by n
This notebook allows you to combine all the images you selected. Those images are grouped n by n via any of the following algorithms:
- Arithmetic mean
- Geometric mean
Not seeing the algorithm you want to use? Please contact Jean Bilheux to get it added.
Let’s pretend you selected the following 21 images
and you decide to combine the first 4 images, then the next 4, and so on.
This will produce 5 files with 3 options of naming convention to use
Option 1 – using new names
Option 2 – using the original base name
Option 3 – using first name of each group
where the first one will be the combination of data_000_010_000.fits, data_000_010_001.fits, data_000_010_002.fits, and data_000_010_003.fits
NB: Because there were 21 images to start with, the last image was dropped (data_000_060_020.fits) as 21 can not be evenly divided by 4!
How does the notebook work?
Select your IPTS
Need help using the IPTS selector?
Select the images to combine
Using the file selection tool, select all the images you want to combine.
Sorting the files
In this cell, you can choose to sort the files by using their full name, or only using the file index. Simply select, and review, the tab corresponding to the sorting method you want to use.
Merging Arithmetic Method
It’s now time to select your merging algorithm.
How many files do you want to combine together?
Select how you want to combine your files.
Preview of how the files will be combined and renamed
This is where you can check that the files are correctly grouped. This is where you can also select how the new combined files will be named
- using a whole new name image_####.ext
- using part of the original name <original_name>_####.ext
- using the name of the first file of the group
The new name will show up below the list of files for the corresponding group selected.
If for each group, at least one of the files doesn’t have the same base file name, the group is automatically excluded from the process and will show up in the tab groups with errors. If you don’t see that tab, it means that none of the groups got rejected.
Select output location
Using the folder selection tool, select the output folder.
Once you have selected the output folder, the images will be automatically merged and a progress bar will show up. Then finally the notebook displays a message to inform you that the process is completed.
Working with TOF data
In the case where you are working with TOF data set, where a _Spectra.txt file is present, the notebook will automatically create a new _Spectra.txt file according to the merging parameters you selected.
- the first column of the file, time, will be the average of the corresponding row/files combines
- the second column, total counts, will use the same algorithm as the one you selected in the notebook
If a spectra file has been located and a new one created, the full path to that file will be displayed in the notebook.
If the output folder already exists, the current date and time will be prefixed to the new folder name to make sure the previous folder is not replaced!