code: def _euler_step(xyf_traj, dmap, f):
      """Simple Euler integration step that extends streamline to boundary."""
      ny, nx = dmap.grid.shape
      xi, yi = xyf_traj[-1]
      cx, cy = f(xi, yi)
      if cx == 0:
          dsx = np.inf
      elif cx < 0:
          dsx = xi / -cx
      else:
          dsx = (nx - 1 - xi) / cx
      if cy == 0:
          dsy = np.inf
      elif cy < 0:
          dsy = yi / -cy
      else:
          dsy = (ny - 1 - yi) / cy
      ds = min(dsx, dsy)
      xyf_traj.append((xi + cx * ds, yi + cy * ds))
      return ds, xyf_traj
  
imports: import numpy
  import matplotlib
  from matplotlib import _api, cm, patches
  import matplotlib.colors
  import matplotlib.collections
  import matplotlib.lines
label_desc: Use image node_id 4 for calling a global function with example usage: _euler_step(xyf_traj, dmap, f) and returns: ds,  xyf_traj