Beispiel #1
0
 def test_nolerp_basic(self):
     f = Gimenez(npol=500, nthr=1, lerp=False)(self.z, self.k, self.u[0])
     npt.assert_array_almost_equal(f, self.f_ref[:, 0])
     for i in range(2, 4):
         f = Gimenez(npol=500, nthr=1, lerp=False)(self.z, self.k,
                                                   self.u[0:i])
         npt.assert_array_almost_equal(f, self.f_ref[:, 0:i])
Beispiel #2
0
 def test_lerp_npol(self):
     f = Gimenez(npol=100, nthr=1, lerp=True)(self.z, self.k, self.u[0])
     npt.assert_array_almost_equal(f, self.f_ref[:, 0], decimal=4)
     for i in range(2, 4):
         f = Gimenez(npol=100, nthr=1, lerp=True)(self.z, self.k,
                                                  self.u[0:i])
         npt.assert_array_almost_equal(f, self.f_ref[:, 0:i], decimal=4)
Beispiel #3
0
 def test_lerp_threading(self):
     for nthr in range(16):
         f = Gimenez(npol=500, nthr=nthr, lerp=True)(self.z, self.k,
                                                     self.u[0])
         npt.assert_array_almost_equal(f, self.f_ref[:, 0], decimal=4)
         for i in range(2, 4):
             f = Gimenez(npol=500, nthr=nthr, lerp=True)(self.z, self.k,
                                                         self.u[0:i])
             npt.assert_array_almost_equal(f, self.f_ref[:, 0:i], decimal=4)
Beispiel #4
0
 def test_noip_threading(self):
     for nthr in range(16):
         tm = Gimenez(npol=500, nthr=nthr, interpolate=False)
         f = tm(self.z, self.k, self.u[0])
         npt.assert_array_almost_equal(f, self.f_ref[:, 0])
         for i in range(2, 4):
             f = tm(self.z, self.k, self.u[0:i])
             npt.assert_array_almost_equal(f, self.f_ref[:, 0:i])
Beispiel #5
0
import numpy as np
import matplotlib.pyplot as pl
from pytransit import Gimenez, MandelAgol, z_circular

m_mad = MandelAgol()
m_mal = MandelAgol(interpolate=True)
m_gmd = Gimenez(interpolate=False)
m_gml = Gimenez(interpolate=True)

u = np.array([[0.1, 0.1], [0.2, 0.2], [0.6, 0.3]])

t = np.linspace(-0.2, 0.2, 500)
pl.plot(t, m_mad.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47 * np.pi), 'b-', alpha=0.5)
pl.plot(t, m_mal.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47 * np.pi), 'r-', alpha=0.5)
pl.plot(t,
        m_gmd.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47 * np.pi),
        'k--',
        alpha=1.0)
pl.show()
Beispiel #6
0
import numpy as np
import matplotlib.pyplot as pl
from pytransit import Gimenez, MandelAgol

k, t0, p, a, i, e, w = 0.1, 1., 4., 8., 0.5*np.pi, 0.01, 0.5*np.pi
t = np.linspace(0.9,1.1,20)
#u = np.array([[0.04*iu, 0.025*iu, 0.01*iu] for iu in range(21)])
u = np.array([[0.04*iu, 0.025*iu] for iu in range(4)])
c = np.linspace(0,0.9,u.shape[0])*0

m = Gimenez(lerp=True, npol=100, nldc=2)
m = MandelAgol(lerp=True, nthr=4)
f = m.evaluate(t, k, u, t0, p, a, i, e, w, c=c)

fig,ax = pl.subplots(1,1,figsize=(7,7))
ax.plot(t,f + np.arange(u.shape[0])*0.00, 'k');
pl.setp(ax, ylim=(0.9875,1.011), yticks=[], xlabel='Time [d]', ylabel='Normalised flux', 
        title='Light curve for a set of multiple limb darkening coefficients');
fig.tight_layout()
pl.show()
import numpy as np
import matplotlib.pyplot as pl

from pytransit import Gimenez, MandelAgol, MandelAgolCL, z_circular

mgfd = Gimenez()
mgfl = Gimenez(lerp=True)
macl = MandelAgolCL()
mafl = MandelAgol(lerp=True)
mafd = MandelAgol(lerp=False)

u = [[0.1,0.0], [0.2,0.05], [0.5,0.4]]
u1 = [0.5,0.4]

t = np.linspace(-0.2, 0.2, 500)
pl.plot(t, mafd.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47*np.pi), ls='-', c='0.5', lw=1,  alpha=0.5) #, drawstyle='steps-mid')
pl.plot(t, macl.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47*np.pi), 'b-',  alpha=0.5) #, drawstyle='steps-mid')
pl.plot(t, mgfd.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47*np.pi)+1e-4, 'b-',  alpha=0.5) #, drawstyle='steps-mid')
pl.plot(t, mgfl.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47*np.pi)+2e-4, 'b-',  alpha=0.5) #, drawstyle='steps-mid')

#pl.plot(t, mafl.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47*np.pi), ls='--', c='0.5', lw=3,  alpha=0.5) #, drawstyle='steps-mid')
#pl.plot(t, mafl.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47*np.pi), 'k-',  alpha=0.5) #, drawstyle='steps-mid')
#pl.plot(t, macl.evaluate(t, 0.1, u1, 0.0, 5, 5, 0.47*np.pi), 'b--',  alpha=0.5) #, drawstyle='steps-mid')


pl.ylim(0.98,1.005)
pl.xlim(-0.2,0.2)
pl.show()
Beispiel #8
0
 def test_ip_np100(self):
     self.tae(Gimenez(npol=100, nthr=1, interpolate=True))
Beispiel #9
0
import numpy as np
import matplotlib.pyplot as pl
from pytransit import Gimenez, MandelAgol, z_circular

m_mad = MandelAgol()
m_mal = MandelAgol(lerp=True)
m_gmd = Gimenez()

t = np.linspace(0, 2, 100)
pl.plot(t, z_circular(t, 1, 1, 3, 0.5 * np.pi, nthreads=4))
pl.show()

u = [[0.1, 0.1], [0.2, 0.2], [0.6, 0.3]]
#u = [0.2,0.2]

t = np.linspace(-0.2, 0.2, 500)
pl.plot(t, m_mad.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47 * np.pi), 'b-', alpha=0.5)
pl.plot(t, m_mal.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47 * np.pi), 'r-', alpha=0.5)
pl.plot(t,
        m_gmd.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47 * np.pi),
        'k--',
        alpha=1.0)
pl.show()
Beispiel #10
0
 def test_gmi_special_z(self):
     """Test the interpolated Gimenez model with z in [0,k,1-k,1,1+k]"""
     tm = Gimenez(interpolate=True)
     npt.assert_array_almost_equal(tm(self.z, self.k, self.u),
                                   self.f,
                                   decimal=3)
Beispiel #11
0
 def test_gmi_multiband(self):
     self.mbt(Gimenez(interpolate=True))
Beispiel #12
0
 def test_gmi_singleband(self):
     self.sbt(Gimenez(interpolate=True))
Beispiel #13
0
 def test_gmd_multiband(self):
     self.mbt(Gimenez(interpolate=False))
Beispiel #14
0
 def test_gmd_singleband(self):
     self.sbt(Gimenez(interpolate=False))
Beispiel #15
0
import numpy as np
import matplotlib.pyplot as pl

from pytransit import Gimenez, MandelAgol, MandelAgolCL, z_circular

mgfd = Gimenez()
mgfl = Gimenez(lerp=True)
macl = MandelAgolCL()
mafl = MandelAgol(lerp=True)
mafd = MandelAgol(lerp=False)

u = [[0.1, 0.0], [0.2, 0.05], [0.5, 0.4]]
u1 = [0.5, 0.4]

t = np.linspace(-0.2, 0.2, 500)
pl.plot(t,
        mafd.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47 * np.pi),
        ls='-',
        c='0.5',
        lw=1,
        alpha=0.5)  #, drawstyle='steps-mid')
pl.plot(t, macl.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47 * np.pi), 'b-',
        alpha=0.5)  #, drawstyle='steps-mid')
pl.plot(t,
        mgfd.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47 * np.pi) + 1e-4,
        'b-',
        alpha=0.5)  #, drawstyle='steps-mid')
pl.plot(t,
        mgfl.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47 * np.pi) + 2e-4,
        'b-',
        alpha=0.5)  #, drawstyle='steps-mid')
Beispiel #16
0
import numpy as np
import matplotlib.pyplot as pl
from pytransit import Gimenez, MandelAgol

k, t0, p, a, i, e, w = 0.1, 1., 4., 8., 0.5 * np.pi, 0.01, 0.5 * np.pi
t = np.linspace(0.9, 1.1, 20)
#u = np.array([[0.04*iu, 0.025*iu, 0.01*iu] for iu in range(21)])
u = np.array([[0.04 * iu, 0.025 * iu] for iu in range(4)])
c = np.linspace(0, 0.9, u.shape[0]) * 0

m = Gimenez(lerp=True, npol=100, nldc=2)
m = MandelAgol(lerp=True, nthr=4)
f = m.evaluate(t, k, u, t0, p, a, i, e, w, c=c)

fig, ax = pl.subplots(1, 1, figsize=(7, 7))
ax.plot(t, f + np.arange(u.shape[0]) * 0.00, 'k')
pl.setp(ax,
        ylim=(0.9875, 1.011),
        yticks=[],
        xlabel='Time [d]',
        ylabel='Normalised flux',
        title='Light curve for a set of multiple limb darkening coefficients')
fig.tight_layout()
pl.show()
Beispiel #17
0
import numpy as np
import matplotlib.pyplot as pl
from pytransit import Gimenez, MandelAgol, z_circular

m_mad = MandelAgol()
m_mal = MandelAgol(lerp=True)
m_gmd = Gimenez(lerp=False)
m_gml = Gimenez(lerp=True)

u = np.array([[0.1,0.1],[0.2,0.2],[0.6,0.3]])

t = np.linspace(-0.2, 0.2, 500)
pl.plot(t, m_mad.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47*np.pi), 'b-',  alpha=0.5)
pl.plot(t, m_mal.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47*np.pi), 'r-',  alpha=0.5)
pl.plot(t, m_gmd.evaluate(t, 0.1, u, 0.0, 5, 5, 0.47*np.pi), 'k--', alpha=1.0)
pl.show()
Beispiel #18
0
 def test_noip_np100(self):
     self.tae(Gimenez(npol=100, nthr=1, interpolate=False))