title: Minimum distance for each value in array respect to other
body: <p>I have two numpy arrays of integers A and B. The values in array A and B correspond to time-points at which events A and B occurred. I would like to transform A to contain the time since the most recent event b occurred.</p>
  
  <p>I know I need to subtract each element of A by its nearest smaller the element of B but am unsure of how to do so. Any help would be greatly appreciated.</p>
  
  <pre><code>&gt;&gt;&gt; import numpy as np
  
  &gt;&gt;&gt; A = np.array([11, 12, 13, 17, 20, 22, 33, 34])
  &gt;&gt;&gt; B = np.array([5, 10, 15, 20, 25, 30])
  </code></pre>
  
  <p>Desired Result:</p>
  
  <pre><code>cond_a = relative_timestamp(to_transform=A, reference=B)
  cond_a
  &gt;&gt;&gt; array([1, 2, 3, 2, 0, 2, 3, 4])
  </code></pre>