class_docstr: Mask to keep track of discrete regions crossed by streamlines.
  
  The resolution of this grid determines the approximate spacing between
  trajectories. Streamlines are only allowed to pass through zeroed cells:
  When a streamline enters a cell, that cell is set to 1, and no new
  streamlines are allowed to enter.
class_docstr_tok: ["Mask","to","keep","track","of","discrete","regions","crossed","by","streamlines",".","The","resolution","of","this","grid","determines","the","approximate","spacing","between","trajectories",".","Streamlines","are","only","allowed","to","pass","through","zeroed","cells",":","When","a","streamline","enters","a","cell",",","that","cell","is","set","to","1",",","and","no","new","streamlines","are","allowed","to","enter","."]
code: def __init__(self, density):
      if np.isscalar(density):
          if density <= 0:
              raise ValueError(
                  "If a scalar, 'density' must be positive"
              )
          self.nx = self.ny = int(30 * density)
      else:
          if len(density) != 2:
              raise ValueError(
                  "'density' can have at maximum 2 dimensions"
              )
          self.nx = int(30 * density[0])
          self.ny = int(30 * density[1])
      self._mask = np.zeros((self.ny, self.nx))
      self.shape = self._mask.shape
  
      self._current_xy = None
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import six
  from six.moves import xrange
  import numpy
  import matplotlib
  import matplotlib.cm
  import matplotlib.colors
  import matplotlib.collections
  import matplotlib.lines
  import matplotlib.patches
label_desc: Use image node_id 1 to create a new StreamMask object from inherited base classes: object with example: obj = StreamMask(density)