Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Plotting question

I am trying to plot Sage calculation listed below. I get the following error:

verbose 0 (3989: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points. verbose 0 (3989: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation'

Gather all for Full H off resonance

Ix=1/2matrix(SR,2,2,[[0,1],[1,0]]) Iy=1/(2I)matrix(SR,2,2,[[0,1],[-1,0]]) Iz=1/2matrix(SR,2,2,[[1,0],[0,-1]]) Al=vector(SR,[1,0]) Be=vector(SR,[0,1])

g = 26.7522128e7 # 1H Gamma rad/s/T rf_field = 100 # B1 rf field in kHz Brf = rf_field1e32pi/g2 # B1 in T for Wnut/2pi= 100 kHz Thetarf = pi/2 # angle between BO and Brf Wnut = (1/2gBrfsin(Thetarf)) t360 = 1/((1/2gBrfsin(Thetarf))/(2pi))# 360 pulse tip = 180 # Tip angle tp = tip/360t360 Bo = 500e62pi/g# T Spectrometer Field Strength wref = gBo # spectrometer reference frequency for Protons, rad/S Bo.n(),(wref/(2pi)).simplify()/1e6;(Wnut/(2pi)).simplify()/1e3,tp.simplify()1e6

Ratio = var ('Ratio')# Wnut/O0, Ratio creates offset, 0=on res Boo=(WnutRatio+wref)/g woo = gBoo O0=woo-wref Phip = var('Phip') # Phip = phase of rf pulse Hrfrf = (O0)Iz + Wnut(Ixcos(Phip)+Iysin(Phip)) Pabrf=((abs(Beexp(-iHrfrf(Phip=0)tp)Al))^2)

for Ratio in srange (-1,1,0.25,include_endpoint=True):

Pabrf(Ratio=Ratio).n(digits=5) #(pi)x on Alpha off resonance Full H

plot (Pabrf,(Ratio, -1,1))

Plotting question

I am trying to plot Sage calculation listed below. I get the following error:

verbose 0 (3989: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points. verbose 0 (3989: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation'

Gather all for Full H off resonance

Ix=1/2matrix(SR,2,2,[[0,1],[1,0]])

Ix=1/2*matrix(SR,2,2,[[0,1],[1,0]])

Iy=1/(2I)matrix(SR,2,2,[[0,1],[-1,0]]) Iz=1/2matrix(SR,2,2,[[1,0],[0,-1]]) Al=vector(SR,[1,0]) matrix(SR,2,2,[[0,1],[-1,0]])

Iz=1/2*matrix(SR,2,2,[[1,0],[0,-1]])

Al=vector(SR,[1,0])

Be=vector(SR,[0,1])

g = 26.7522128e7 # 1H Gamma rad/s/T rad/s/T

rf_field = 100 # B1 rf field in kHz kHz

Brf = rf_field1e32pi/g2 # B1 in T for Wnut/2pi= 100 kHz kHz

Thetarf = pi/2 # angle between BO and Brf Brf

Wnut = (1/2gBrf*sin(Thetarf))

t360 = 1/((1/2gBrfsin(Thetarf)) t360 = 1/((1/2gBrfsin(Thetarf))/(2pi))# 360 pulse pulse

tip = 180 # Tip angle angle

tp = tip/360t360 tip/360*t360

Bo = 500e62pi/g# T Spectrometer Field Strength Strength

wref = gBo g*Bo # spectrometer reference frequency for Protons, rad/S rad/S

Bo.n(),(wref/(2pi)).simplify()/1e6;(Wnut/(2pi)).simplify()/1e3,tp.simplify()1e6pi)).simplify()/1e3,tp.simplify()*1e6

Ratio = var ('Ratio')# Wnut/O0, Ratio creates offset, 0=on res Boo=(WnutRatio+wref)/g res

Boo=(Wnut*Ratio+wref)/g

woo = gBoo O0=woo-wref g*Boo

O0=woo-wref

Phip = var('Phip') # Phip = phase of rf pulse pulse

Hrfrf = (O0)Iz + Wnut(Ixcos(Phip)+Iysin(Phip)) sin(Phip))

Pabrf=((abs(Beexp(-iHrfrf(Phip=0)tp)Al))^2)

for Ratio in srange (-1,1,0.25,include_endpoint=True):

Pabrf(Ratio=Ratio).n(digits=5) #(pi)x on Alpha off resonance Full H

plot (Pabrf,(Ratio, -1,1))

Plotting question

I am trying to plot Sage calculation listed below. I get the following error:

verbose 0 (3989: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points. verbose 0 (3989: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation'

What am I doing wrong?

Thank you for your help.

Gather all for Full H off resonance

Ix=1/2*matrix(SR,2,2,[[0,1],[1,0]])

Iy=1/(2I)matrix(SR,2,2,[[0,1],[-1,0]])

Iz=1/2*matrix(SR,2,2,[[1,0],[0,-1]])

Al=vector(SR,[1,0])

Be=vector(SR,[0,1])

g = 26.7522128e7 # 1H Gamma rad/s/T

rf_field = 100 # B1 rf field in kHz

Brf = rf_field1e32pi/g2 # B1 in T for Wnut/2pi= 100 kHz

Thetarf = pi/2 # angle between BO and Brf

Wnut = (1/2gBrf*sin(Thetarf))

t360 = 1/((1/2gBrfsin(Thetarf))/(2pi))# 360 pulse

tip = 180 # Tip angle

tp = tip/360*t360

Bo = 500e62pi/g# T Spectrometer Field Strength

wref = g*Bo # spectrometer reference frequency for Protons, rad/S

Bo.n(),(wref/(2pi)).simplify()/1e6;(Wnut/(2pi)).simplify()/1e3,tp.simplify()*1e6

Ratio = var ('Ratio')# Wnut/O0, Ratio creates offset, 0=on res

Boo=(Wnut*Ratio+wref)/g

woo = g*Boo

O0=woo-wref

Phip = var('Phip') # Phip = phase of rf pulse

Hrfrf = (O0)Iz + Wnut(Ixcos(Phip)+Iysin(Phip))

Pabrf=((abs(Beexp(-iHrfrf(Phip=0)tp)Al))^2)

for Ratio in srange (-1,1,0.25,include_endpoint=True):

Pabrf(Ratio=Ratio).n(digits=5) #(pi)x on Alpha off resonance Full H

plot (Pabrf,(Ratio, -1,1))

Plotting question

I am trying to plot Sage calculation listed below. I get the following error:

verbose 0 (3989: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points. verbose 0 (3989: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation'

What am I doing wrong?

Thank you for your help.

Gather all for Full H off resonance

Ix=1/2*matrix(SR,2,2,[[0,1],[1,0]])

Ix=1/2matrix(SR,2,2,[[0,1],[1,0]]) Iy=1/(2I)matrix(SR,2,2,[[0,1],[-1,0]])

Iz=1/2*matrix(SR,2,2,[[1,0],[0,-1]])

Al=vector(SR,[1,0])

matrix(SR,2,2,[[0,1],[-1,0]]) Iz=1/2matrix(SR,2,2,[[1,0],[0,-1]]) Al=vector(SR,[1,0]) Be=vector(SR,[0,1])

Ix, Iy, Iz , Al.transpose(),Be.transpose()

g = 26.7522128e7 # 1H Gamma rad/s/T

rf_field = 100 # B1 rf field in kHz

Brf = rf_field1e32pi/g2 # B1 in T for Wnut/2pi= 100 kHz

Thetarf = pi/2 # angle between BO and Brf

Wnut = (1/2gBrf*sin(Thetarf))

t360 = 1/((1/2gBrfsin(Thetarf))/(2pi))# 360 pulse

tip = 180 # Tip angle

tp = tip/360*t360

Bo = 500e62pi/g# T Spectrometer Field Strength

wref = g*Bo # spectrometer reference frequency for Protons, rad/S

Bo.n(),(wref/(2pi)).simplify()/1e6;(Wnut/(2pi)).simplify()/1e3,tp.simplify()*1e6

Ratio = var ('Ratio')# Wnut/O0, Ratio creates offset, 0=on res

Boo=(Wnut*Ratio+wref)/g

woo = g*Boo

O0=woo-wref

Phip = var('Phip') # Phip = phase of rf pulse

Hrfrf = (O0)Iz + Wnut(Ixcos(Phip)+Iysin(Phip))

Pabrf=((abs(Beexp(-iHrfrf(Phip=0)tp)Al))^2)

for Ratio in srange (-1,1,0.25,include_endpoint=True):

Pabrf(Ratio=Ratio).n(digits=5) #(pi)x on Alpha off resonance Full H

plot (Pabrf,(Ratio, -1,1))

Plotting question

I am trying to plot Sage calculation listed below. I get the following error:

verbose 0 (3989: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points. verbose 0 (3989: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation'

What am I doing wrong?

Thank you for your help.

Gather

sage: #Gather all for Full H off resonance

resonance sage: Ix=1/2matrix(SR,2,2,[[0,1],[1,0]]) sage: Iy=1/(2I)matrix(SR,2,2,[[0,1],[-1,0]]) sage: Iz=1/2matrix(SR,2,2,[[1,0],[0,-1]]) sage: Al=vector(SR,[1,0]) Be=vector(SR,[0,1])

Ix, sage: Be=vector(SR,[0,1]) sage: #Ix, Iy, Iz , Al.transpose(),Be.transpose()

Al.transpose(),Be.transpose() sage: g = 26.7522128e7 # 1H Gamma rad/s/T

rad/s/T sage: rf_field = 100 # B1 rf field in kHz

kHz sage: Brf = rf_field1e32pi/g2 # B1 in T for Wnut/2pi= 100 kHz

kHz sage: Thetarf = pi/2 # angle between BO and Brf sage: Wnut = (1/2gBrf

Wnut = (1/2sin(Thetarf)) sage: t360 = 1/((1/2gBrf*sin(Thetarf))

t360 = 1/((1/2gBrfsin(Thetarf))/(2pi))# 360 pulse

pulse sage: tip = 180 # Tip angle

angle sage: tp = tip/360*t360

tip/360t360 sage: Bo = 500e62pi/g# T Spectrometer Field Strength

Strength sage: wref = g*Bo gBo # spectrometer reference frequency for Protons, rad/S

rad/S sage: Bo.n(),(wref/(2pi)).simplify()/1e6;(Wnut/(2pi)).simplify()/1e3,tp.simplify()*1e6

pi)).simplify()/1e3,tp.simplify()1e6 (11.7433001788540, 500.0) (100.0, 5.0) sage: Ratio = var ('Ratio')# Wnut/O0, Ratio creates offset, 0=on res

Boo=(Wnut*Ratio+wref)/g

res sage: Boo=(WnutRatio+wref)/g sage: woo = g*Boo

O0=woo-wref

gBoo sage: O0=woo-wref sage: Phip = var('Phip') # Phip = phase of rf pulse

pulse sage: Hrfrf = (O0)Iz + Wnut(Ixcos(Phip)+Iysin(Phip))

sin(Phip)) sage: Pabrf=((abs(Beexp(-iHrfrf(Phip=0)tp)Al))^2)

Al))^2) sage: for Ratio in srange (-1,1,0.25,include_endpoint=True):

(-1,1,0.25,include_endpoint=True): 
...       Pabrf(Ratio=Ratio).n(digits=5) #(pi)x on Alpha off resonance Full H

0.31656 0.54627 0.77281 0.93898 1 0.93898 0.77281 0.54627 0.31656 sage: plot (Pabrf,(Ratio, -1,1))-1,1)) verbose 0 (3989: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points. verbose 0 (3989: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation' <html></html>

Plotting question

I am trying to plot Sage calculation listed below. I get the following error:

verbose 0 (3989: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points. verbose 0 (3989: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation'

What am I doing wrong?

Thank you for your help.

sage: #Gather all for Full H off resonance sage: Ix=1/2matrix(SR,2,2,[[0,1],[1,0]]) sage: Iy=1/(2I)matrix(SR,2,2,[[0,1],[-1,0]]) sage: Iz=1/2matrix(SR,2,2,[[1,0],[0,-1]]) sage: Al=vector(SR,[1,0]) sage: Be=vector(SR,[0,1]) sage: #Ix, Iy, Iz , Al.transpose(),Be.transpose() sage: g = 26.7522128e7 # 1H Gamma rad/s/T sage: rf_field = 100 # B1 rf field in kHz sage: Brf = rf_field1e32pi/g2 # B1 in T for Wnut/2pi= 100 kHz sage: Thetarf = pi/2 # angle between BO and Brf sage: Wnut = (1/2gBrfsin(Thetarf)) sage: t360 = 1/((1/2gBrfsin(Thetarf))/(2pi))# 360 pulse sage: tip = 180 # Tip angle sage: tp = tip/360t360 sage: Bo = 500e62pi/g# T Spectrometer Field Strength sage: wref = gBo # spectrometer reference frequency for Protons, rad/S sage: Bo.n(),(wref/(2pi)).simplify()/1e6;(Wnut/(2pi)).simplify()/1e3,tp.simplify()1e6 (11.7433001788540, 500.0) (100.0, 5.0) sage: Ratio = var ('Ratio')# Wnut/O0, Ratio creates offset, 0=on res sage: Boo=(WnutRatio+wref)/g sage: woo = gBoo sage: O0=woo-wref sage: Phip = var('Phip') # Phip = phase of rf pulse sage: Hrfrf = (O0)Iz + Wnut(Ixcos(Phip)+Iysin(Phip)) sage: Pabrf=((abs(Beexp(-iHrfrf(Phip=0)tp)Al))^2) sage: for Ratio in srange (-1,1,0.25,include_endpoint=True): ... Pabrf(Ratio=Ratio).n(digits=5) #(pi)x on Alpha off resonance Full H 0.31656 0.54627 0.77281 0.93898 1 0.93898 0.77281 0.54627 0.31656 sage: plot (Pabrf,(Ratio, -1,1)) verbose 0 (3989: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points. verbose 0 (3989: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation' <html></html>

sage: #Gather all for Full H off resonance sage: Ix=1/2matrix(SR,2,2,[[0,1],[1,0]]) sage: Iy=1/(2I)matrix(SR,2,2,[[0,1],[-1,0]]) sage: Iz=1/2matrix(SR,2,2,[[1,0],[0,-1]]) sage: Al=vector(SR,[1,0]) sage: Be=vector(SR,[0,1]) sage: #Ix, Iy, Iz , Al.transpose(),Be.transpose() sage: g = 26.7522128e7 # 1H Gamma rad/s/T sage: rf_field = 100 # B1 rf field in kHz sage: Brf = rf_field1e32pi/g2 # B1 in T for Wnut/2pi= 100 kHz sage: Thetarf = pi/2 # angle between BO and Brf sage: Wnut = (1/2gBrfsin(Thetarf)) sage: t360 = 1/((1/2gBrfsin(Thetarf))/(2pi))# 360 pulse sage: tip = 180 # Tip angle sage: tp = tip/360t360 sage: Bo = 500e62pi/g# T Spectrometer Field Strength sage: wref = gBo # spectrometer reference frequency for Protons, rad/S sage: Bo.n(),(wref/(2pi)).simplify()/1e6;(Wnut/(2pi)).simplify()/1e3,tp.simplify()1e6 (11.7433001788540, 500.0) (100.0, 5.0) sage: Ratio = var ('Ratio')# Wnut/O0, Ratio creates offset, 0=on res sage: Boo=(WnutRatio+wref)/g sage: woo = gBoo sage: O0=woo-wref sage: Phip = var('Phip') # Phip = phase of rf pulse sage: Hrfrf = (O0)Iz + Wnut(Ixcos(Phip)+Iysin(Phip)) sage: Pabrf=((abs(Beexp(-iHrfrf(Phip=0)tp)Al))^2) sage: for Ratio in srange (-1,1,0.25,include_endpoint=True): ... Pabrf(Ratio=Ratio).n(digits=5) #(pi)x on Alpha off resonance Full H 0.31656 0.54627 0.77281 0.93898 1 0.93898 0.77281 0.54627 0.31656 sage: plot (Pabrf,(Ratio, -1,1)) verbose 0 (3989: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points. verbose 0 (3989: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation' <html></html>

Plotting question

I am trying to plot Sage calculation listed below. I get the following error:

verbose 0 (3989: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points. verbose 0 (3989: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation'

What am I doing wrong?

Thank you for your help.

sage: #Gather

Gather all for Full H off resonance sage: Ix=1/2matrix(SR,2,2,[[0,1],[1,0]]) sage: resonance

Ix=1/2*matrix(SR,2,2,[[0,1],[1,0]])

Iy=1/(2I)matrix(SR,2,2,[[0,1],[-1,0]]) sage: Iz=1/2matrix(SR,2,2,[[1,0],[0,-1]]) sage: Al=vector(SR,[1,0]) sage: Be=vector(SR,[0,1]) sage: #Ix, Iy, Iz , Al.transpose(),Be.transpose() sage: matrix(SR,2,2,[[0,1],[-1,0]])

Iz=1/2*matrix(SR,2,2,[[1,0],[0,-1]])

Al=vector(SR,[1,0])

Be=vector(SR,[0,1])

g = 26.7522128e7 # 1H Gamma rad/s/T sage: rad/s/T

rf_field = 100 # B1 rf field in kHz sage: kHz

Brf = rf_field1e32pi/g2 # B1 in T for Wnut/2pi= 100 kHz sage: kHz

Thetarf = pi/2 # angle between BO and Brf sage: Brf

Wnut = (1/2gBrf*sin(Thetarf))

t360 = 1/((1/2gBrfsin(Thetarf)) sage: t360 = 1/((1/2gBrfsin(Thetarf))/(2pi))# 360 pulse sage: pulse

tip = 180 # Tip angle sage: angle

tp = tip/360t360 sage: tip/360*t360

Bo = 500e62pi/g# T Spectrometer Field Strength sage: Strength

wref = gBo g*Bo # spectrometer reference frequency for Protons, rad/S sage: rad/S

Bo.n(),(wref/(2pi)).simplify()/1e6;(Wnut/(2pi)).simplify()/1e3,tp.simplify()1e6 (11.7433001788540, 500.0) (100.0, 5.0) sage: pi)).simplify()/1e3,tp.simplify()*1e6

Ratio = var ('Ratio')# Wnut/O0, Ratio creates offset, 0=on res sage: Boo=(WnutRatio+wref)/g sage: res

Boo=(Wnut*Ratio+wref)/g

woo = gBoo sage: O0=woo-wref sage: g*Boo

O0=woo-wref

Phip = var('Phip') # Phip = phase of rf pulse sage: pulse

Hrfrf = (O0)Iz + Wnut(Ixcos(Phip)+Iysin(Phip)) sage: sin(Phip))

Pabrf=((abs(Beexp(-iHrfrf(Phip=0)tp)Al))^2) sage: Al))^2)

for Ratio in srange (-1,1,0.25,include_endpoint=True): ... Pabrf(Ratio=Ratio).n(digits=5) #(pi)x on Alpha off resonance Full H 0.31656 0.54627 0.77281 0.93898 1 0.93898 0.77281 0.54627 0.31656 sage: H

plot (Pabrf,(Ratio, -1,1)) verbose 0 (3989: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points. verbose 0 (3989: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation' <html></html>

sage: #Gather all for Full H off resonance sage: Ix=1/2matrix(SR,2,2,[[0,1],[1,0]]) sage: Iy=1/(2I)matrix(SR,2,2,[[0,1],[-1,0]]) sage: Iz=1/2matrix(SR,2,2,[[1,0],[0,-1]]) sage: Al=vector(SR,[1,0]) sage: Be=vector(SR,[0,1]) sage: #Ix, Iy, Iz , Al.transpose(),Be.transpose() sage: g = 26.7522128e7 # 1H Gamma rad/s/T sage: rf_field = 100 # B1 rf field in kHz sage: Brf = rf_field1e32pi/g2 # B1 in T for Wnut/2pi= 100 kHz sage: Thetarf = pi/2 # angle between BO and Brf sage: Wnut = (1/2gBrfsin(Thetarf)) sage: t360 = 1/((1/2gBrfsin(Thetarf))/(2pi))# 360 pulse sage: tip = 180 # Tip angle sage: tp = tip/360t360 sage: Bo = 500e62pi/g# T Spectrometer Field Strength sage: wref = gBo # spectrometer reference frequency for Protons, rad/S sage: Bo.n(),(wref/(2pi)).simplify()/1e6;(Wnut/(2pi)).simplify()/1e3,tp.simplify()1e6 (11.7433001788540, 500.0) (100.0, 5.0) sage: Ratio = var ('Ratio')# Wnut/O0, Ratio creates offset, 0=on res sage: Boo=(WnutRatio+wref)/g sage: woo = gBoo sage: O0=woo-wref sage: Phip = var('Phip') # Phip = phase of rf pulse sage: Hrfrf = (O0)Iz + Wnut(Ixcos(Phip)+Iysin(Phip)) sage: Pabrf=((abs(Beexp(-iHrfrf(Phip=0)tp)Al))^2) sage: for Ratio in srange (-1,1,0.25,include_endpoint=True): ... Pabrf(Ratio=Ratio).n(digits=5) #(pi)x on Alpha off resonance Full H 0.31656 0.54627 0.77281 0.93898 1 0.93898 0.77281 0.54627 0.31656 sage: plot (Pabrf,(Ratio, -1,1)) verbose 0 (3989: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points. verbose 0 (3989: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation' <html></html>-1,1))

click to hide/show revision 8
No.8 Revision

Plotting question

I am trying to plot Sage calculation listed below. I get the following error:

verbose 0 (3989: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points. verbose 0 (3989: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation'

What am I doing wrong?

Thank you for your help.

Gather all for Full H off resonance

Ix=1/2*matrix(SR,2,2,[[0,1],[1,0]])

Iy=1/(2I)matrix(SR,2,2,[[0,1],[-1,0]])

Iz=1/2*matrix(SR,2,2,[[1,0],[0,-1]])

Al=vector(SR,[1,0])

Be=vector(SR,[0,1])

Ix=1/2*matrix(SR,2,2,[[0,1],[1,0]])
Iy=1/(2*I)*matrix(SR,2,2,[[0,1],[-1,0]])
Iz=1/2*matrix(SR,2,2,[[1,0],[0,-1]])
Al=vector(SR,[1,0])
Be=vector(SR,[0,1])

g = 26.7522128e7 # 1H Gamma rad/s/T

rad/s/T rf_field = 100 # B1 rf field in kHz

kHz Brf = rf_field1e32pi/g2 rf_field*1e3*2*pi/g*2 # B1 in T for Wnut/2pi= 100 kHz

kHz Thetarf = pi/2 # angle between BO and Brf

Brf Wnut = (1/2gBrf*sin(Thetarf))

(1/2*g*Brf*sin(Thetarf)) t360 = 1/((1/2gBrfsin(Thetarf))/(2pi))# 1/((1/2*g*Brf*sin(Thetarf))/(2*pi))# 360 pulse

pulse tip = 180 # Tip angle

angle tp = tip/360*t360

tip/360*t360 Bo = 500e62pi/g# 500e6*2*pi/g# T Spectrometer Field Strength

Strength wref = g*Bo # spectrometer reference frequency for Protons, rad/S

Bo.n(),(wref/(2pi)).simplify()/1e6;(Wnut/(2pi)).simplify()/1e3,tp.simplify()*1e6

rad/S Bo.n(),(wref/(2*pi)).simplify()/1e6;(Wnut/(2*pi)).simplify()/1e3,tp.simplify()*1e6 Ratio = var ('Ratio')# Wnut/O0, Ratio creates offset, 0=on res

Boo=(Wnut*Ratio+wref)/g

res Boo=(Wnut*Ratio+wref)/g woo = g*Boo

O0=woo-wref

g*Boo O0=woo-wref Phip = var('Phip') # Phip = phase of rf pulse

pulse Hrfrf = (O0)Iz (O0)*Iz + Wnut(Ixcos(Phip)+Iysin(Phip))

Pabrf=((abs(Beexp(-iHrfrf(Phip=0)tp)Al))^2)

Wnut*(Ix*cos(Phip)+Iy*sin(Phip)) Pabrf=((abs(Be*exp(-i*Hrfrf(Phip=0)*tp)*Al))^2) for Ratio in srange (-1,1,0.25,include_endpoint=True): (-1,1,0.25,include_endpoint=True): Pabrf(Ratio=Ratio).n(digits=5) #(pi)x on Alpha off resonance Full H

H plot (Pabrf,(Ratio, -1,1))

-1,1))
click to hide/show revision 9
retagged

Plotting question

I am trying to plot Sage calculation listed below. I get the following error:

verbose 0 (3989: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points. verbose 0 (3989: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation'

What am I doing wrong?

Thank you for your help.

Gather all for Full H off resonance

Ix=1/2*matrix(SR,2,2,[[0,1],[1,0]])
Iy=1/(2*I)*matrix(SR,2,2,[[0,1],[-1,0]])
Iz=1/2*matrix(SR,2,2,[[1,0],[0,-1]])
Al=vector(SR,[1,0])
Be=vector(SR,[0,1])

g = 26.7522128e7 # 1H Gamma rad/s/T
rf_field = 100 # B1 rf field in kHz
Brf = rf_field*1e3*2*pi/g*2 # B1 in T for Wnut/2pi= 100 kHz
Thetarf = pi/2 # angle between BO and Brf

Wnut = (1/2*g*Brf*sin(Thetarf))
t360 = 1/((1/2*g*Brf*sin(Thetarf))/(2*pi))# 360 pulse
tip = 180 # Tip angle
tp = tip/360*t360
Bo = 500e6*2*pi/g# T Spectrometer Field Strength
wref = g*Bo # spectrometer reference frequency for Protons, rad/S
Bo.n(),(wref/(2*pi)).simplify()/1e6;(Wnut/(2*pi)).simplify()/1e3,tp.simplify()*1e6

Ratio = var ('Ratio')# Wnut/O0, Ratio creates offset, 0=on res
Boo=(Wnut*Ratio+wref)/g
woo = g*Boo
O0=woo-wref

Phip = var('Phip') # Phip = phase of rf pulse
Hrfrf = (O0)*Iz + Wnut*(Ix*cos(Phip)+Iy*sin(Phip))
Pabrf=((abs(Be*exp(-i*Hrfrf(Phip=0)*tp)*Al))^2)



for Ratio in srange (-1,1,0.25,include_endpoint=True):
    Pabrf(Ratio=Ratio).n(digits=5) #(pi)x on Alpha off resonance Full H

plot (Pabrf,(Ratio, -1,1))