nodes: 0, module; 1, function_definition; 2, function_name:locate_ranges; 3, parameters; 4, block; 5, identifier:self; 6, identifier:starts; 7, identifier:stops; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, identifier:strict; 14, True; 15, comment:"""Locate items within the given ranges.
  
          Parameters
          ----------
          starts : array_like, int
              Range start values.
          stops : array_like, int
              Range stop values.
          strict : bool, optional
              If True, raise KeyError if any ranges contain no entries.
  
          Returns
          -------
          loc : ndarray, bool
              Boolean array with location of entries found.
  
          Examples
          --------
  
          >>> import allel
          >>> import numpy as np
          >>> idx = allel.SortedIndex([3, 6, 11, 20, 35])
          >>> ranges = np.array([[0, 2], [6, 17], [12, 15], [31, 35],
          ...                    [100, 120]])
          >>> starts = ranges[:, 0]
          >>> stops = ranges[:, 1]
          >>> loc = idx.locate_ranges(starts, stops, strict=False)
          >>> loc
          array([False,  True,  True, False,  True])
          >>> idx[loc]
          <SortedIndex shape=(3,) dtype=int64>
          [6, 11, 35]
  
          """; 16, assignment; 17, boolean_operator; 18, block; 19, identifier:loc; 20, pattern_list; 21, call; 22, identifier:strict; 23, call; 24, raise_statement; 25, identifier:loc; 26, identifier:found; 27, attribute; 28, argument_list; 29, attribute; 30, argument_list; 31, call; 32, identifier:self; 33, identifier:locate_intersection_ranges; 34, identifier:starts; 35, identifier:stops; 36, identifier:np; 37, identifier:any; 38, unary_operator; 39, identifier:KeyError; 40, argument_list; 41, identifier:found; 42, subscript; 43, subscript; 44, identifier:starts; 45, unary_operator; 46, identifier:stops; 47, unary_operator; 48, identifier:found; 49, identifier:found
code: def locate_ranges(self, starts, stops, strict=True):
          """Locate items within the given ranges.
  
          Parameters
          ----------
          starts : array_like, int
              Range start values.
          stops : array_like, int
              Range stop values.
          strict : bool, optional
              If True, raise KeyError if any ranges contain no entries.
  
          Returns
          -------
          loc : ndarray, bool
              Boolean array with location of entries found.
  
          Examples
          --------
  
          >>> import allel
          >>> import numpy as np
          >>> idx = allel.SortedIndex([3, 6, 11, 20, 35])
          >>> ranges = np.array([[0, 2], [6, 17], [12, 15], [31, 35],
          ...                    [100, 120]])
          >>> starts = ranges[:, 0]
          >>> stops = ranges[:, 1]
          >>> loc = idx.locate_ranges(starts, stops, strict=False)
          >>> loc
          array([False,  True,  True, False,  True])
          >>> idx[loc]
          <SortedIndex shape=(3,) dtype=int64>
          [6, 11, 35]
  
          """
  
          loc, found = self.locate_intersection_ranges(starts, stops)
  
          if strict and np.any(~found):
              raise KeyError(starts[~found], stops[~found])
  
          return loc