The class used for management of raw data. Function `get_sum` is used to compute the total spectrum (sum of spectra for all pixels) and total count (sum of counts over all energy bins for each pixel). Selection of pixels may be set by selecting an area (limited by `point1` and `
| 678 | |
| 679 | |
| 680 | class DataSelection(Atom): |
| 681 | """ |
| 682 | The class used for management of raw data. Function |
| 683 | `get_sum` is used to compute the total spectrum (sum of spectra for all pixels) |
| 684 | and total count (sum of counts over all energy bins for each pixel). |
| 685 | Selection of pixels may be set by selecting an area (limited by `point1` and |
| 686 | `point2` or the mask `mask`. Selection of area also applied to the mask if |
| 687 | both are set. |
| 688 | |
| 689 | There are some unresolved questions about logic: |
| 690 | - what is exactly the role of `self.io_model.data`? It is definitely used when |
| 691 | the data is plotted, but is it ever bypassed by directly calling `get_sum`? |
| 692 | If the data is always accessed using `self.io_model.data`, then storing the averaged |
| 693 | spectrum in cache is redundant, but since the array is small, it's not |
| 694 | much overhead to keep another copy just in case. |
| 695 | - there is no obvious way to set `point1` and `point2` |
| 696 | (it seems like point selection doesn't work in PyXRF). May be at some point |
| 697 | this needs to be fixed. |
| 698 | Anyway, the logic is not defined to the level when it makes sense to |
| 699 | write tests for this class. There are tests for underlying computational |
| 700 | functions though. |
| 701 | |
| 702 | Attributes |
| 703 | ---------- |
| 704 | filename : str |
| 705 | plot_choice : enum |
| 706 | methods ot plot |
| 707 | point1 : str |
| 708 | starting position |
| 709 | point2 : str |
| 710 | ending position |
| 711 | roi : list |
| 712 | raw_data : array |
| 713 | experiment 3D data |
| 714 | data : array |
| 715 | selected_for_preview : int |
| 716 | plot data or not, sum or roi or point |
| 717 | """ |
| 718 | |
| 719 | filename = Str() |
| 720 | plot_choice = Enum(*plot_as) |
| 721 | # point1 = Str('0, 0') |
| 722 | # point2 = Str('0, 0') |
| 723 | selection_active = Bool(False) |
| 724 | sel_pt_start = List() |
| 725 | sel_pt_end = List() # Not included |
| 726 | mask_active = Bool(False) |
| 727 | mask = Typed(np.ndarray) |
| 728 | # 'raw_data' may be numpy array, dask array or core.map_processing.RawHDF5Dataset |
| 729 | # Processing functions are expected to support all those types |
| 730 | raw_data = Typed(object) |
| 731 | selected_for_preview = Bool(False) # Dataset is currently selected for preview |
| 732 | data_ready = Bool(False) # Total spectrum and total count map are computed |
| 733 | fit_name = Str() |
| 734 | fit_data = Typed(np.ndarray) |
| 735 | |
| 736 | _cached_spectrum = Dict() |
| 737 |
no outgoing calls
no test coverage detected