Change of variables for weak field

  |   Source
In [1]:
import numpy as np
import matplotlib.pyplot as pl
%matplotlib inline
In [13]:
BParObs = 300.0*np.cos(60.0*np.pi/180.0)
In [14]:
B = np.linspace(0.0,1000.0,200)
theta = np.linspace(0.0,np.pi,200)
h = np.linspace(-20.0,20.0,200)
BMat, thetaMat = np.meshgrid(B, theta)
BMat, hMat = np.meshgrid(B, h)
f = lambda x: (1.0+np.tanh(x))/2.0*np.pi
In [15]:
like = np.exp(-(BParObs - BMat*np.cos(thetaMat))**2 / 20.0**2)
chi2 = (BParObs - BMat*np.cos(thetaMat))**2 / 20.0**2
pl.contourf(B, theta, chi2, levels=np.arange(10))
Out[15]:
<matplotlib.contour.QuadContourSet instance at 0xb00e844c>
In [16]:
likeTransformed = np.exp(-(BParObs - BMat*np.cos(f(hMat)))**2 / 20.0**2)
chi2Transformed = (BParObs - BMat*np.cos(f(hMat)))**2 / 20.0**2
pl.contourf(B, h, chi2Transformed, levels=np.arange(10))
Out[16]:
<matplotlib.contour.QuadContourSet instance at 0xb00cb48c>
In [ ]: