Multiple File Processor
In this class, the user can process multiple CRD files simultaneously.
It is mainly intended as an easy interface class for the RIMSEvalGUI
.
MultiFileProcessor
: Multi File Processor class
- class rimseval.multi_proc.MultiFileProcessor(crd_files: List[Path])
Class to process multiple CRD files at ones.
- Example:
>>> file_names = [Path("file1.crd"), Path("file2.crd"), Path("file3.crd")] >>> mfp = MultiFileProcessor(file_names) >>> mfp.num_of_files 3 >>> mfp.peak_fwhm = 0.02 # set full with half max for all files
- apply_to_all(id: int, opt_mcal: bool = False, bg_corr: bool = False)
Take the configuration for the ID file and apply it to all files.
- Parameters:
id – Index where the main CRD file is in the list
opt_mcal – Optimize mass calibration if True (default: False)
bg_corr – Perform background correction?
- close_files() None
Destroys the files and frees the memory.
- close_selected_files(ids: List[int], main_id: int = None) int
Close selected files.
Close the ided files and free the memory. If the main_id is given, the program will return the new ID of the main file in case it got changed. If the main file is gone or no main file was provided, zero is returned.
- Parameters:
ids – List of file IDs, i.e., where they are in
self.files
.main_id – ID of the main file, an updated ID will be returned if main file is present, otherwise zero will be returned.
- Returns:
New ID of main file if present or given. Otherwise, return zero.
- property files: List[CRDFileProcessor]
Return a list of files.
If the files are not opened, it will open and read them.
- Returns:
List of CRDFileProcessor instances with files opened
- static load_calibration_single(crd: CRDFileProcessor, secondary_cal: Path = None) None
Load a single calibration for a CRD file.
Loads the primary calibration (i.e., the one with the same name but .json qualifier) if it exists. Otherwise, if a secondary calibration is given, it will try to load that one. If that file does not exist either, nothing will be done.
- Parameters:
crd – CRD file to load the calibration for.
secondary_cal – Optional, calibration to fall back on if no primary calibration is available.
- load_calibrations(secondary_cal: Path = None) None
Load calibration files for all CRDs.
This routine checks first if a calibration file with the same name exists. If so, it will be loaded. If no primary calibration is present and a secondary calibration filename is given, the program will try to load that one if it exists. Otherwise, no calibration will be loaded.
- Parameters:
secondary_cal – File for secondary calibration. Will only be used if it exists.
- property num_of_files: int
Get the number of files that are in the multiprocessor.
- open_additional_files(fnames: List[Path], read_files=True, secondary_cal=None) None
Open additional files to the ones already opened.
Files will be appended to the list, no sorting.
- Parameters:
fnames – List of filenames for the additional files to be opened.
read_files – Read the files after opening?
secondary_cal – Secondary calibration file for loading calibrations.
- open_files() None
Open the files and store them in the list.
- property peak_fwhm: float
Get / Set FWHM of each peak.
The getter returns the average, the setter sets the same for all.
- Returns:
Average peak FWHM in us.
- read_files() None
Run spectrum_full on all CRD files.
- signal_processed
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.