phase_grad_utils.py 466 B

12345678910111213141516
  1. import numpy as np
  2. def create_k_steps(k_span, steps):
  3. """
  4. A function that returns a k_span gradient span with odd and even gradient steps
  5. """
  6. k_steps = np.array(range(steps+1))
  7. if (np.mod(steps,2) == 0):
  8. k_steps = ( k_steps - steps/2 ) / (steps/2)
  9. else:
  10. k_steps = ( k_steps - (steps+1)/2 ) / (steps/2)
  11. k_steps = np.flip(k_steps,0)
  12. k_steps = np.delete(k_steps,-1)
  13. return k_steps*k_span*0.5