imr-framework / pypulseq

Pulseq in Python
https://pypulseq.readthedocs.io
GNU Affero General Public License v3.0
112 stars 58 forks source link

Negative gyromagnetic ratio #112

Closed Cwis closed 1 year ago

Cwis commented 1 year ago

I am working with nuclei having negative gyromagnetic ratio (such as 129mXe) and this leads to error when using pypulseq. So far, I have identified issues in making trapezoidal gradients and in Sequence/Block.py. In those files I had to add an abs() on the system max_grad and max_slew. This might be needed elsewhere if using other functions.

btasdelen commented 1 year ago

Hi @Cwis, thanks for raising this issue. Excuse my ignorance, but this is the first time I hear about negative gyromagnetic ratio.

Can you tell us the implications of this, so we can come up with a plan to how to support it properly?

The only implication I can think of is the precession direction. If that is the case, would simply giving the absolute value of the gyromagnetic ratio, rather than the negative value, solve the issue?

btasdelen commented 1 year ago

@Cwis Thanks for sharing the extra information about negative gyromagnetic ratio.

As you said, I don't think currently there is any mechanism in Pulseq that allows you to change reverse CP mode for transmit coil. That, most likely, requires a change in the interpreter code. For that, you can create an issue on Pulseq GitHub: https://github.com/pulseq/pulseq

It still looks like, the rest can be fixed by giving the absolute value of the negative gyromagnetic ratio to the PyPulseq. I think it is a better approach, rather than taking absolute values for max_slew and max_grad, those values should never be negative in the first place.

Let me know if my suggestion does not solve your issue, or misses some points.

Cwis commented 1 year ago

@bilal-tasdelen Thank you for your answer, I am working on simulations with nuclei that have negative gyromagnetic ratio (metastable Xenon isomers). It happens when the magnetic moment and the angular moment of the nuclei are in opposite direction (but still co-aligned). It's true that the only difference is the precession direction - which is important to my study - but it should not change anything for the sequence design with PyPulseq, does it ? If not, then I will just use the absolute value when designing the sequence.

btasdelen commented 1 year ago

@Cwis That is my understanding as well. I will close this for now, but feel free to reopen if there is any unforeseen consequence of negative gyromagnetic ratio in the sequence design.