Run computation of the total spectrum and total count. Use the selected spatial ROI and/or mask Parameters ---------- data: ndarray(float) raw data array, shape (n_rows, n_cols, n_energy_bins) client: dask.distributed.Client or None
(self, data, *, client=None)
| 988 | self.mask = mask |
| 989 | |
| 990 | def get_spectrum(self, data, *, client=None): |
| 991 | """ |
| 992 | Run computation of the total spectrum and total count. Use the selected |
| 993 | spatial ROI and/or mask |
| 994 | |
| 995 | Parameters |
| 996 | ---------- |
| 997 | data: ndarray(float) |
| 998 | raw data array, shape (n_rows, n_cols, n_energy_bins) |
| 999 | client: dask.distributed.Client or None |
| 1000 | Dask client. If None, then local client will be created |
| 1001 | """ |
| 1002 | selection = None |
| 1003 | if self._pt_start: |
| 1004 | if self._pt_end: |
| 1005 | # Region is selected |
| 1006 | selection = ( |
| 1007 | self._pt_start[0], |
| 1008 | self._pt_start[1], |
| 1009 | self._pt_end[0] - self._pt_start[0], |
| 1010 | self._pt_end[1] - self._pt_start[1], |
| 1011 | ) |
| 1012 | else: |
| 1013 | # Only a single point is selected |
| 1014 | selection = (self._pt_start[0], self._pt_start[1], 1, 1) |
| 1015 | |
| 1016 | progress_bar = TerminalProgressBar("Computing total spectrum: ") |
| 1017 | total_spectrum, total_count = compute_total_spectrum_and_count( |
| 1018 | data, |
| 1019 | selection=selection, |
| 1020 | mask=self.mask, |
| 1021 | chunk_pixels=5000, |
| 1022 | n_chunks_min=4, |
| 1023 | progress_bar=progress_bar, |
| 1024 | client=client, |
| 1025 | ) |
| 1026 | |
| 1027 | return total_spectrum, total_count |
| 1028 | |
| 1029 | |
| 1030 | def load_data_from_hdf5(working_directory, file_name, load_each_channel=True): |
no test coverage detected