You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it would be useful to have the type of event and in case of the type beeing some type of gradient the gradient channel to be returned with the duration.
This makes sense to me when using pp.calc_duration with multiple blocks running at the same time and wanting to find out which one is actually responsible for the max length of the block.
This could be added in the if statements without much hussle.
E.g.:
if event.type == "delay":
duration_temp = max(duration, event.delay)
if duration_temp != duration:
event_info = event.type
duration = duration_temp
or for gradients:
elif event.type == "grad":
duration_temp = max(duration, event.delay + event.shape_dur)
if duration_temp != duration:
event_info = (event.type, event.channel)
duration = duration_temp
The text was updated successfully, but these errors were encountered:
I see how this could be useful in certain situations, though probably only in an interactive notebook/ipython environment while debugging. I can not think of many situations where you'd use this information as part of the actual sequence design, and where it isn't already obvious which events may be the longest:
i.e. if pp.calc_duration(gx,gy)[1].channel == 'x':
vs if pp.calc_duration(gx) > pp.calc_duration(gy)
We cannot just add another return value without breaking backwards compatibility though. And this a function that is very likely to be used in most sequences. To avoid this, there is the possibility of adding a keyword argument: pp.calc_duration(adc, gx, gy, return_longest=True) -> (<duration>, <event>)
To avoid this, there is the possibility of adding a keyword argument: pp.calc_duration(adc, gx, gy, return_longest=True) -> (duration, event) <
This would also be feasible for me, my usecase was a block where a read spoiler gradient was played at the same time, in the same block as rephasing gradients and I wanted to determine which one was crucial for the block length.
I think it would be useful to have the type of event and in case of the type beeing some type of gradient the gradient channel to be returned with the duration.
This makes sense to me when using pp.calc_duration with multiple blocks running at the same time and wanting to find out which one is actually responsible for the max length of the block.
This could be added in the if statements without much hussle.
E.g.:
if event.type == "delay":
duration_temp = max(duration, event.delay)
if duration_temp != duration:
event_info = event.type
duration = duration_temp
or for gradients:
elif event.type == "grad":
duration_temp = max(duration, event.delay + event.shape_dur)
if duration_temp != duration:
event_info = (event.type, event.channel)
duration = duration_temp
The text was updated successfully, but these errors were encountered: