latools/filtering/filt_obj.py
def grab_filt(self, filt, analyte=None):
        """
        Flexible access to specific filter using any key format.

        Parameters
        ----------
        f : str, dict or bool
            either logical filter expression, dict of expressions,
            or a boolean
        analyte : str
            name of analyte the filter is for.

        Returns
        -------
        array_like
            boolean filter
        """
        if isinstance(filt, str):
            if filt in self.components:
                if analyte is None:
                    return self.components[filt]
                else:
                    if self.switches[analyte][filt]:
                        return self.components[filt]
            else:
                try:
                    ind = self.make_fromkey(filt)
                except KeyError:
                    print(("\n\n***Filter key invalid. Please consult "
                           "manual and try again."))
        elif isinstance(filt, dict):
            try:
                ind = self.make_fromkey(filt[analyte])
            except ValueError:
                print(("\n\n***Filter key invalid. Please consult manual "
                       "and try again.\nOR\nAnalyte missing from filter "
                       "key dict."))
        elif filt:
            ind = self.make(analyte)
        else:
            ind = ~np.zeros(self.size, dtype=bool)
        return ind
def grab_filt(self, filt, analyte=None):
        if isinstance(filt, str):
            if filt in self.components:
                if analyte is None:
                    return self.components[filt]
                else:
                    if self.switches[analyte][filt]:
                        return self.components[filt]
            else:
                try:
                    ind = self.make_fromkey(filt)
                except KeyError:
                    print(("\n\n***Filter key invalid. Please consult "
                           "manual and try again."))
        elif isinstance(filt, dict):
            try:
                ind = self.make_fromkey(filt[analyte])
            except ValueError:
                print(("\n\n***Filter key invalid. Please consult manual "
                       "and try again.\nOR\nAnalyte missing from filter "
                       "key dict."))
        elif filt:
            ind = self.make(analyte)
        else:
            ind = ~np.zeros(self.size, dtype=bool)
        return ind
def grab_filt ( self , filt , analyte = None ) : if isinstance ( filt , str ) : if filt in self . components : if analyte is None : return self . components [ filt ] else : if self . switches [ analyte ] [ filt ] : return self . components [ filt ] else : try : ind = self . make_fromkey ( filt ) except KeyError : print ( ( "\n\n***Filter key invalid. Please consult " "manual and try again." ) ) elif isinstance ( filt , dict ) : try : ind = self . make_fromkey ( filt [ analyte ] ) except ValueError : print ( ( "\n\n***Filter key invalid. Please consult manual " "and try again.\nOR\nAnalyte missing from filter " "key dict." ) ) elif filt : ind = self . make ( analyte ) else : ind = ~ np . zeros ( self . size , dtype = bool ) return ind
Flexible access to specific filter using any key format.

        Parameters
        ----------
        f : str, dict or bool
            either logical filter expression, dict of expressions,
            or a boolean
        analyte : str
            name of analyte the filter is for.

        Returns
        -------
        array_like
            boolean filter
Flexible access to specific filter using any key format .