Compare commits
3 Commits
main
...
ste_phasec
Author | SHA1 | Date | |
---|---|---|---|
9f718f71c7 | |||
d14a46bca9 | |||
5a7d530f5e |
@ -11,15 +11,16 @@ def experiment(): # saturation-recovery experiment
|
||||
pars = {}
|
||||
pars['P90'] = 1.7e-6 # 90-degree pulse length (s)
|
||||
pars['SF'] = 338.7e6 # spectrometer frequency (Hz)
|
||||
pars['SW'] = 200e3 # sampling rate (Hz)
|
||||
pars['O1'] = -60e3 # offset from SF (Hz)
|
||||
pars['SW'] = 200e3 # spectral window (Hz)
|
||||
pars['SI'] = 1*256 # number of acquisition points
|
||||
pars['NS'] = 8 # number of scans
|
||||
pars['DS'] = 0 # number of dummy scans
|
||||
pars['TAU'] = 1 # delay for recovery (s)
|
||||
pars['DEAD1'] = 5e-6 # receiver dead time (s)
|
||||
pars['PHA'] = 0 # receiver phase (degree)
|
||||
pars['PHA'] = 100 # receiver phase (degree)
|
||||
# -*- these aren't variable: -*-
|
||||
pars['NECH'] = 7 # number of saturation pulses
|
||||
pars['NECH'] = 40 # number of saturation pulses
|
||||
pars['D1'] = 100e-3 # starting interval in saturation sequence (s)
|
||||
pars['D2'] = 1e-4 # end interval in saturation sequence (s)
|
||||
pars['DATADIR'] = '/home/fprak/Students/' # data directory
|
||||
@ -46,7 +47,8 @@ def experiment(): # saturation-recovery experiment
|
||||
raise Exception("Pulse too long!!!")
|
||||
|
||||
if pars['NS']%4 != 0:
|
||||
print 'Number of scans should be changed to ',pars['NS'],' due to phase cycling'
|
||||
pars['NS'] = int(round(pars['NS'] / 4) + 1) * 4
|
||||
print 'Number of scans changed to ',pars['NS'],' due to phase cycling'
|
||||
|
||||
if pars['D1'] < pars['D2']:
|
||||
raise Exception("D1 must be greater than D2")
|
||||
@ -115,6 +117,7 @@ def satrec_experiment(pars, run):
|
||||
# read in variables:
|
||||
P90 = pars['P90']
|
||||
SF = pars['SF']
|
||||
O1 = pars['O1']
|
||||
DEAD1 = pars['DEAD1']
|
||||
NECH = pars['NECH']
|
||||
D1 = pars['D1']
|
||||
@ -124,15 +127,21 @@ def satrec_experiment(pars, run):
|
||||
PH3 = pars['PH3'][run%len(pars['PH3'])]
|
||||
PH2 = pars['PH2'][run%len(pars['PH2'])]
|
||||
PHA = pars['PHA']
|
||||
SI = pars["SI"]
|
||||
SW = pars["SW"]
|
||||
|
||||
# set sampling parameters:
|
||||
SI = pars['SI']
|
||||
SW = pars['SW']
|
||||
while SW <= 10e6 and SI < 256*1024:
|
||||
SI *= 2
|
||||
SW *= 2
|
||||
|
||||
# set variable delay list for saturation pulses:
|
||||
vdlist = log_range(D2, D1, NECH-1)
|
||||
|
||||
# run the pulse sequence:
|
||||
|
||||
# saturation:
|
||||
e.set_frequency(SF, phase=PH1) # set frequency and phase for saturation pulses
|
||||
e.set_frequency(SF+O1, phase=PH1) # set frequency and phase for saturation pulses
|
||||
e.ttl_pulse(TXEnableDelay, value=TXEnableValue) # enable RF amplifier
|
||||
e.ttl_pulse(P90, value=TXEnableValue|TXPulseValue) # apply 90-degree pulse
|
||||
for delay in vdlist[::-1]:
|
||||
@ -140,15 +149,15 @@ def satrec_experiment(pars, run):
|
||||
e.ttl_pulse(TXEnableDelay, value=TXEnableValue) # enable RF amplifier
|
||||
e.ttl_pulse(P90, value=TXEnableValue|TXPulseValue) # apply 90-degree pulse
|
||||
|
||||
e.set_phase(PH3) # set phase for measuring pulse
|
||||
# recovery:
|
||||
e.wait(TAU-5e-7) # recovery time
|
||||
e.wait(TAU) # recovery time
|
||||
e.set_phase(PH3) # set phase for measuring pulse
|
||||
|
||||
# detection:
|
||||
e.ttl_pulse(TXEnableDelay, value=TXEnableValue) # enable RF amplifier
|
||||
e.ttl_pulse(P90, value=TXEnableValue|TXPulseValue) # apply 90-degree pulse
|
||||
e.set_phase(PHA) # set phase for receiver
|
||||
e.wait(DEAD1-5e-7) # wait for coil ringdown
|
||||
e.wait(DEAD1) # wait for coil ringdown
|
||||
e.record(SI, SW, sensitivity=ADCSensitivity) # acquire signal
|
||||
|
||||
# write experiment parameters:
|
||||
|
@ -29,6 +29,42 @@ def result():
|
||||
# get actual sampling rate of timesignal:
|
||||
sampling_rate = timesignal.get_sampling_rate()
|
||||
|
||||
# get user-defined spectrum width:
|
||||
spec_width = pars['SW']
|
||||
|
||||
# specify cutoff frequency, in relative units:
|
||||
cutoff = spec_width / sampling_rate
|
||||
|
||||
if cutoff < 1: # no filter applied otherwise
|
||||
|
||||
# number of filter's coefficients:
|
||||
numtaps = 29
|
||||
|
||||
# use firwin to create a lowpass FIR filter:
|
||||
fir_coeff = firwin(numtaps, cutoff)
|
||||
|
||||
# downsize x according to user-defined spectral window:
|
||||
skip = int(sampling_rate / spec_width)
|
||||
timesignal.x = timesignal.x[::skip]
|
||||
|
||||
for i in range(2):
|
||||
# apply the filter to ith channel:
|
||||
timesignal.y[i] = lfilter(fir_coeff, 1.0, timesignal.y[i])
|
||||
|
||||
# zeroize first N-1 "corrupted" samples:
|
||||
timesignal.y[i][:numtaps-1] = 0.0
|
||||
|
||||
# circular left shift of y:
|
||||
timesignal.y[i] = roll(timesignal.y[i], -(numtaps-1))
|
||||
|
||||
# downsize y to user-defined number of samples (SI):
|
||||
timesignal.y[i] = timesignal.y[i][::skip]
|
||||
|
||||
# update the sampling_rate attribute of the signal's:
|
||||
timesignal.set_sampling_rate(spec_width)
|
||||
|
||||
# ----------------------------------------------------
|
||||
|
||||
# rotate timesignal according to current receiver's phase:
|
||||
timesignal.phase(pars['rec_phase'])
|
||||
|
||||
|
@ -11,21 +11,21 @@ def experiment(): # saturation-recovery with soild-echo detection
|
||||
pars = {}
|
||||
pars['P90'] = 2.3e-6 # 90-degree pulse length (s)
|
||||
pars['SF'] = 46.7e6 # spectrometer frequency (Hz)
|
||||
pars['O1'] = 5.6e3 # offset from SF (Hz)
|
||||
pars['SW'] = 10e6 # spectral window (Hz)
|
||||
pars['SI'] = 1*1024 # number of acquisition points
|
||||
pars['NS'] = 16 # number of scans
|
||||
pars['DS'] = 0 # number of dummy scans
|
||||
pars['TAU'] = 1 # delay for recovery (s)
|
||||
pars['D3'] = 20e-6 # echo delay (s)
|
||||
pars['D4'] = 0 # pre-aquisition delay (s), use negative values
|
||||
pars['D4'] = 0 # echo pre-aquisition delay (s)
|
||||
pars['PHA'] = -30 # receiver phase (degree)
|
||||
# -*- these ain't variable: -*-
|
||||
pars['NECH'] = 7 # number of saturation pulses
|
||||
pars['NECH'] = 40 # number of saturation pulses
|
||||
pars['D1'] = 100e-3 # starting interval in saturation sequence (s)
|
||||
pars['D2'] = 1e-4 # end interval in saturation sequence (s)
|
||||
pars['DATADIR'] = '/home/fprak/Students/' # data directory
|
||||
pars['OUTFILE'] = None # output file name
|
||||
pars["suppress_ringing"] = False # 16 Phase cycle, reduces ringing but halves SNR
|
||||
|
||||
# specify a variable parameter (optional):
|
||||
pars['VAR_PAR'] = 'TAU' # variable parameter name (a string)
|
||||
@ -48,7 +48,8 @@ def experiment(): # saturation-recovery with soild-echo detection
|
||||
raise Exception("Pulse too long!!!")
|
||||
|
||||
if pars['NS']%8 != 0:
|
||||
print 'Number of scans should be ',pars['NS'],' due to phase cycling'
|
||||
pars['NS'] = int(round(pars['NS'] / 8) + 1) * 8
|
||||
print 'Number of scans changed to ',pars['NS'],' due to phase cycling'
|
||||
|
||||
if pars['D1'] < pars['D2']:
|
||||
raise Exception("D1 must be greater than D2!")
|
||||
@ -110,21 +111,16 @@ def satrec2_experiment(pars, run):
|
||||
|
||||
pars['PROG'] = 'satrec2_experiment'
|
||||
|
||||
if pars["suppress_ringing"]:
|
||||
# phase cycle to compensate ringing (loss of half the signal!)
|
||||
pars['PH3'] = [ 0, 0, 0, 0, 90, 90, 90, 90, 180, 180, 180, 180, 270, 270, 270, 270] # 1st 90-degree pulse
|
||||
pars['PH4'] = [ 0, 90, 180, 270, 90, 180, 270, 0, 180, 270, 0, 90, 270, 0, 90, 180] # 2nd 90-degree pulse
|
||||
pars['PH2'] = [ 180, 0, 180, 0, 270, 90, 270, 90, 0, 180, 0, 180, 90, 270, 90, 270] # receiver
|
||||
else:
|
||||
# simple phase cycle:
|
||||
pars['PH1'] = [0] # saturation pulses
|
||||
pars['PH3'] = [0, 180, 0, 180, 90, 270, 90, 270] # 1st 90-degree pulse
|
||||
# phase lists:
|
||||
pars['PH1'] = [ 0] # saturation pulses
|
||||
pars['PH3'] = [ 0, 180, 0, 180, 90, 270, 90, 270] # 1st 90-degree pulse
|
||||
pars['PH4'] = [90, 90, 270, 270, 0, 0, 180, 180] # 2nd 90-degree pulse
|
||||
pars['PH2'] = [0, 180, 0, 180, 90, 270, 90, 270] # receiver
|
||||
pars['PH2'] = [ 0, 180, 0, 180, 90, 270, 90, 270] # receiver
|
||||
|
||||
# read in variables:
|
||||
P90 = pars['P90']
|
||||
SF = pars['SF']
|
||||
O1 = pars['O1']
|
||||
NECH = pars['NECH']
|
||||
D1 = pars['D1']
|
||||
D2 = pars['D2']
|
||||
@ -136,16 +132,21 @@ def satrec2_experiment(pars, run):
|
||||
PH4 = pars['PH4'][run%len(pars['PH4'])]
|
||||
PH2 = pars['PH2'][run%len(pars['PH2'])]
|
||||
PHA = pars['PHA']
|
||||
SI = pars['SI']
|
||||
SW = pars['SW']
|
||||
|
||||
# set variable delay list for saturation pulses:
|
||||
vdlist = log_range(D2, D1, NECH-1)
|
||||
|
||||
# set sampling parameters:
|
||||
SI = pars['SI']
|
||||
SW = pars['SW']
|
||||
while SW <= 10e6 and SI < 256*1024:
|
||||
SI *= 2
|
||||
SW *= 2
|
||||
|
||||
# the pulse sequence:
|
||||
|
||||
# saturation:
|
||||
e.set_frequency(SF, phase=PH1) # set frequency and phase for saturation pulses
|
||||
e.set_frequency(SF+O1, phase=PH1) # set frequency and phase for saturation pulses
|
||||
e.ttl_pulse(TXEnableDelay, value=TXEnableValue) # enable RF amplifier
|
||||
e.ttl_pulse(P90, value=TXEnableValue|TXPulseValue) # apply 90-degree pulse
|
||||
for delay in vdlist[::-1]:
|
||||
@ -153,19 +154,19 @@ def satrec2_experiment(pars, run):
|
||||
e.ttl_pulse(TXEnableDelay, value=TXEnableValue) # enable RF amplifier
|
||||
e.ttl_pulse(P90, value=TXEnableValue|TXPulseValue) # apply 90-degree pulse
|
||||
|
||||
e.set_phase(PH3) # set phase for next pulse
|
||||
# recovery:
|
||||
e.wait(TAU-5e-7) # wait for tau
|
||||
e.wait(TAU) # wait for tau
|
||||
e.set_phase(PH3) # set phase for next pulse
|
||||
|
||||
# echo detection:
|
||||
e.ttl_pulse(TXEnableDelay, value=TXEnableValue) # enable RF amplifier
|
||||
e.ttl_pulse(P90, value=TXEnableValue|TXPulseValue) # apply 90-degree pulse
|
||||
e.wait(D3-P90-TXEnableDelay) # echo delay
|
||||
e.set_phase(PH4) # set phase for next pulse
|
||||
e.wait(D3-P90-TXEnableDelay-5e-7) # echo delay
|
||||
e.ttl_pulse(TXEnableDelay, value=TXEnableValue) # enable RF amplifier
|
||||
e.ttl_pulse(P90, value=TXEnableValue|TXPulseValue) # apply 90-degree pulse
|
||||
e.set_phase(PHA) # set phase for receiver
|
||||
e.wait(D3-P90/2+D4-5e-7) # echo delay
|
||||
e.wait(D3-P90/2+D4) # echo delay
|
||||
e.record(SI, SW, sensitivity=ADCSensitivity) # acquisition
|
||||
|
||||
# write experiment attributes:
|
||||
|
@ -29,6 +29,40 @@ def result():
|
||||
# get actual sampling rate of timesignal:
|
||||
sampling_rate = timesignal.get_sampling_rate()
|
||||
|
||||
# get user-defined spectrum width:
|
||||
spec_width = pars['SW']
|
||||
|
||||
# specify cutoff frequency, in relative units:
|
||||
cutoff = spec_width / sampling_rate
|
||||
|
||||
if cutoff < 1: # no filter applied otherwise
|
||||
|
||||
# number of filter's coefficients:
|
||||
numtaps = 29
|
||||
|
||||
# use firwin to create a lowpass FIR filter:
|
||||
fir_coeff = firwin(numtaps, cutoff)
|
||||
|
||||
# downsize x according to user-defined spectral window:
|
||||
skip = int(sampling_rate / spec_width)
|
||||
timesignal.x = timesignal.x[::skip]
|
||||
|
||||
for i in range(2):
|
||||
# apply the filter to ith channel:
|
||||
timesignal.y[i] = lfilter(fir_coeff, 1.0, timesignal.y[i])
|
||||
|
||||
# zeroize first N-1 "corrupted" samples:
|
||||
timesignal.y[i][:numtaps-1] = 0.0
|
||||
|
||||
# circular left shift of y:
|
||||
timesignal.y[i] = roll(timesignal.y[i], -(numtaps-1))
|
||||
|
||||
# downsize y to user-defined number of samples (SI):
|
||||
timesignal.y[i] = timesignal.y[i][::skip]
|
||||
|
||||
# update the sampling_rate attribute of the signal's:
|
||||
timesignal.set_sampling_rate(spec_width)
|
||||
|
||||
# ----------------------------------------------------
|
||||
|
||||
# rotate timesignal according to current receiver's phase:
|
||||
|
@ -105,7 +105,7 @@ def spinal_experiment(pars, run):
|
||||
|
||||
# 8-step phase cycle (Schaefer et al. J Magn Res A 115 (1995))
|
||||
pars['PH1'] = [ 0, 0, 180, 180, 90, 90, 270, 270] # 1st (90-degree) pulse
|
||||
pars['PH3'] = [90, 270, 270, 90, 180, 0, 0, 180] # 2nd (90-degree) pulse
|
||||
pars['PH3'] = [90, 270, 90, 270, 180, 90, 180, 90] # 2nd (90-degree) pulse
|
||||
pars['PH4'] = [90] # 3rd (90-degree) pulse
|
||||
pars['PH2'] = [90, 270] # receiver
|
||||
|
||||
|
@ -106,7 +106,7 @@ def spinal4pulses_experiment(pars, run):
|
||||
|
||||
# 8-step phase cycle (Schaefer et al. J Magn Res A 115 (1995))
|
||||
pars['PH1'] = [0, 0, 180, 180, 90, 90, 270, 270] # 1st (90-degree) pulse
|
||||
pars['PH3'] = [90, 270, 270, 90, 180, 0, 0, 180] # 2nd (90-degree) pulse
|
||||
pars['PH3'] = [90, 270, 270, 90, 180, 90, 90, 180] # 2nd (90-degree) pulse
|
||||
pars['PH4'] = [90] # 3rd (90-degree) pulse
|
||||
pars['PH5'] = [90] * 8 + [270] * 8
|
||||
pars['PH2'] = [90, 270] # receiver
|
||||
|
@ -104,7 +104,7 @@ def zeeman_experiment(pars, run):
|
||||
# 8-step phase cycle (Schaefer et al. J Magn Res A 115 (1995))
|
||||
pars['PH1'] = [0, 0, 180, 180, 90, 90, 270, 270] # 1st (90-degree) pulse
|
||||
pars['PH3'] = [0, 180, 180, 0, 90, 270, 270, 90] # 2nd (90-degree) pulse
|
||||
pars['PH4'] = [0] # 3rd (90-degree) pulse
|
||||
pars['PH4'] = [90] # 3rd (90-degree) pulse
|
||||
pars['PH2'] = [90, 270] # receiver
|
||||
|
||||
# read in variables:
|
||||
|
Loading…
Reference in New Issue
Block a user