Moved example sequences to base repo.

This commit is contained in:
jupfi 2024-06-18 16:19:50 +02:00
parent 0314240594
commit c72be61c0f
4 changed files with 99 additions and 0 deletions

View file

@ -0,0 +1,30 @@
"""Composite FID example.
This example demonstrates how to simulate a composite FID signal using the quackseq simulator.
See the paper:
Sauer, K.L., Klug, C.A., Miller, J.B. et al. Using quaternions to design composite pulses for spin-1 NQR. Appl. Magn. Reson. 25, 485500 (2004). https://doi.org/10.1007/BF03166543
This also works for Samples with spin > 1.
"""
from quackseq.pulsesequence import QuackSequence
from quackseq.functions import RectFunction
def create_COMPFID():
COMPFID = QuackSequence("COMPFID")
COMPFID.add_pulse_event("tx1", "3u", 100, 0, RectFunction())
COMPFID.add_pulse_event("tx2", "6u", 100, 45, RectFunction())
# This makes the phase 45, 135, 225, 315 (because of the previous 45 degree phase shift and 360/4 = 90 degree phase shift)
COMPFID.set_tx_n_phase_cycles("tx2", 4)
COMPFID.add_blank_event("blank", "5u")
COMPFID.add_readout_event("rx", "100u")
# No phase shifiting of the receive data but weighting of -1 for the 45 degree pulse, +1 for the 135 degree pulse, -1 for the 225 degree pulse and +1 for the 315 degree pulse
readout_scheme = [[1, 0], [-1, 0], [1, 0], [-1, 0]]
COMPFID.set_rx_readout_scheme("rx", readout_scheme)
return COMPFID

View file

@ -0,0 +1,18 @@
"""Simple FID sequence with a single excitation pulse and readout event."""
from quackseq.pulsesequence import QuackSequence
from quackseq.functions import RectFunction
def create_FID() -> QuackSequence:
"""Creates a simple FID sequence with a single excitation pulse and readout event.
Returns:
QuackSequence: The FID sequence
"""
FID = QuackSequence("FID")
FID.add_pulse_event("tx", "3u", 100, 0, RectFunction())
FID.add_blank_event("blank", "5u")
FID.add_readout_event("rx", "100u")
FID.add_blank_event("TR", "1m")
return FID

View file

@ -0,0 +1,19 @@
"""A simple SE sequence with a pi/2 pulse, a pi pulse, and a readout event."""
from quackseq.pulsesequence import QuackSequence
from quackseq.functions import RectFunction
def create_SE() -> QuackSequence:
"""Creates a simple SE sequence with a pi/2 pulse, a pi pulse, and a readout event.
Returns:
QuackSequence: The SE sequence
"""
SE = QuackSequence("SE")
SE.add_pulse_event("pi-half", "3u", 100, 0, RectFunction())
SE.add_blank_event("te-half", "150u")
SE.add_pulse_event("pi", "6u", 100, 0, RectFunction())
SE.add_blank_event("blank", "50u")
SE.add_readout_event("rx", "200u")
return SE

View file

@ -0,0 +1,32 @@
"""A spin echo sequence with phase cycling."""
from quackseq.pulsesequence import QuackSequence
from quackseq.functions import RectFunction
def create_SEPC() -> QuackSequence:
"""Creates a simple spin echo sequence with phase cycling.
The sequence consists of a pi/2 pulse, a pi pulse, and a readout event.
The phase cycling is set to cycle through 0°, 90°, 180°, 270° for the first pulse and constant 180° for the second pulse.
The readout phase for the different phase cycles is set to 0°, 90°, 180°, 270°.
Returns:
QuackSequence: The SEPC sequence
"""
sepc = QuackSequence("SEPC")
sepc.add_pulse_event("pi-half", "3u", 100, 0, RectFunction())
# This causes the phase to cycle through 0, 90, 180, 270
sepc.set_tx_n_phase_cycles("pi-half", 4)
sepc.add_blank_event("te-half", "150u")
# For the second pulse we just need a phase of 180
sepc.add_pulse_event("pi", "6u", 100, 180, RectFunction())
sepc.add_blank_event("blank", "50u")
sepc.add_readout_event("rx", "200u")
# Readout scheme for phase cycling TX pulses have the scheme 0 90 180 270 for the first pulse and 180 always for the second pulse
readout_scheme = [[1, 0], [1, 90], [1, 180], [1, 270]]
sepc.set_rx_readout_scheme("rx", readout_scheme)
return sepc