-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make_trapezoid with just flat_area fails #150
Comments
There's more: |
Hi @gabuzi, thanks for reporting this. It is definitely an unintended behavior. Are you suggesting just supplying I think if it is not something that most developer expect, it might not be best to silently give something without throwing a warning. |
Hi! Thanks for following up! To be quite honest, I stumbled over it by mistakenly using flat_area instead of just area, so I don't actually have a real use case for that anymore. Giving it more thought, it's probably rather unusual to request a trapz gradient with a specific flat_area, but not caring about the flat duration. So I guess it's probably not a huge loss if that wouldn't be supported. The same probably applies to the issue in the second comment about giving specific rise and fall times but not the flat time. I totally agree, optional parameters should never be silently ignored, but rather result in an error if they won't be honored. |
@btasdelen Thanks a lot and sorry for the dupe! |
Describe the bug
Calling pypulseq.make_trapezoid with only flat_area given fails. Specifying just the area argument works fine.
To Reproduce
Expected behavior
Should return a trapezoid gradient event with the requested flat_area.
Desktop (please complete the following information):
pypulseq
version: 1.4.0Looking at make_trapezoid.py, there are checks like
if area == 0: raise ValueError ("Must supply area or duration.")
, whichappears out of date as the default value for area is
None
in 1.4.0.So it looks like just supplying flat_area was never intended to work, but the error is not caught anymore.
But rather than catching the absence of area as an error, I propose to allow just specifying flat_area and return a trapz gradient with default slew rates having the intended flat_area.
The text was updated successfully, but these errors were encountered: