BCDA-APS / mdaviz

Data visualization for mda
https://bcda-aps.github.io/mdaviz/
Other
3 stars 0 forks source link

Make `mda_folder.selectionField` a class #111

Open rodolakis opened 3 months ago

rodolakis commented 3 months ago

    def selectionField(self):
        """
        Retrieves the current field selection for plotting.
        - Returns a dictionary with selected positioner and detectors indices.
        - Format: {'X': positioner_index, 'Y': [detector_indices]}.
        - Returns None if no selection is made.
        """
        return self._selection_field

    def setSelectionField(self, new_selection=None):
        """
        Updates the current field selection for plotting.
        - Accepts a dictionary specifying new selection of positioner and detectors.
        - Resets to None if given an empty dictionary.
        - Format for new_selection: {'X': positioner_index, 'Y': [detector_indices]}.
        """
        # TODO - how to enfore selectionField structure? Turn it into a class!
        # what if new_selectionvdoes not have X or Y key, or any of those key return
        # a None value? or is {}?
        self._selection_field = new_selection if new_selection != {} else None