code: def _make_pattern(length, pattern, caps):
      """Make a concrete dash pattern of a given length."""
      # A pattern is defined as on/off sequence of segments
      # It must be a multiple of 2
      if len(pattern) > 1 and len(pattern) % 2:
          pattern = [pattern[0] + pattern[-1]] + pattern[1:-1]
      P = np.array(pattern)
  
      # Period is the sum of all segment length
      period = np.cumsum(P)[-1]
  
      # Find all start and end of on-segment only
      C, c = [], 0
      for i in range(0, len(P) + 2, 2):
          a = max(0.0001, P[i % len(P)])
          b = max(0.0001, P[(i + 1) % len(P)])
          C.extend([c, c + a])
          c += a + b
      C = np.array(C)
  
      # Build pattern
      Z = np.zeros((length, 4), dtype=np.float32)
      for i in np.arange(0, len(Z)):
          x = period * (i) / float(len(Z) - 1)
          index = np.argmin(abs(C - (x)))
          if index % 2 == 0:
              if x <= C[index]:
                  dash_type = +1
              else:
                  dash_type = 0
              dash_start, dash_end = C[index], C[index + 1]
          else:
              if x > C[index]:
                  dash_type = -1
              else:
                  dash_type = 0
              dash_start, dash_end = C[index - 1], C[index]
          Z[i] = C[index], dash_type, dash_start, dash_end
      return Z, period
  
file_path: vispy/vispy/visuals/line/dash_atlas.py
imports: from functools import lru_cache
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: _make_pattern(length, pattern, caps) and returns: Z,  period