@@ -253,7 +253,7 @@ def write_trajectory(
253253 Maximum slew rate in T/m/ms, by default 0.1
254254 pregrad : str, optional
255255 Pregrad method, by default `prephase`
256- `prephase` will add a prephase gradient to the start of the trajectory.
256+ `prephase` will add a prephasing gradient to the start of the trajectory.
257257 postgrad : str, optional
258258 Postgrad method, by default 'slowdown_to_edge'
259259 `slowdown_to_edge` will add a gradient to slow down to the edge of the k-space
@@ -300,7 +300,7 @@ def write_trajectory(
300300 initial_positions = np .zeros_like (initial_positions )
301301 gradients = np .hstack ([start_gradients , gradients ])
302302 Ns_to_skip_at_start = start_gradients .shape [1 ]
303- if postgrad is not None :
303+ if postgrad :
304304 if version < 5.1 :
305305 raise ValueError (
306306 "postgrad is only supported for version >= 5.1, "
@@ -339,7 +339,7 @@ def write_trajectory(
339339 warnings .warn (
340340 "Slew rate at start of trajectory exceeds maximum slew rate!"
341341 f"Maximum slew rate: { np .max (np .abs (border_slew_rate )):.3f} "
342- " > {smax:.3f}. Please use prephase gradient to avoid this "
342+ f " > { smax :.3f} . Please use prephase gradient to avoid this "
343343 " issue."
344344 )
345345
@@ -449,15 +449,15 @@ def read_trajectory(
449449 gradients = np .reshape (
450450 grad_max * gradients * 1e-3 , (num_shots , num_samples_per_shot , dimension )
451451 )
452+ # Handle skipped samples
452453 if start_skip_samples > 0 :
453454 start_location_updates = (
454455 np .sum (gradients [:, :start_skip_samples ], axis = 1 ) * raster_time * gamma
455456 )
456457 initial_positions += start_location_updates
457- gradients = gradients [:, start_skip_samples :, :]
458- if end_skip_samples > 0 :
459- gradients = gradients [:, :- end_skip_samples , :]
458+ gradients = gradients [:, start_skip_samples :- end_skip_samples , :]
460459 num_samples_per_shot -= start_skip_samples + end_skip_samples
460+
461461 if num_adc_samples is None :
462462 if read_shots :
463463 num_adc_samples = num_samples_per_shot + 1
0 commit comments