In [6]:
import numpy as np
from scipy.integrate import odeint
from scipy.integrate import ode

import numpy as np
from sympy import symbols,sqrt,sech,Rational,lambdify,Matrix,exp,cosh,cse,simplify,cos,sin
from sympy.vector import CoordSysCartesian

from theano.scalar.basic_sympy import SymPyCCode
from theano import function
from theano.scalar import floats

from IRI import *
from Symbolic import *
from ENUFrame import ENU

import astropy.coordinates as ac
import astropy.units as au
import astropy.time as at

#from multiprocessing import Pool
import dill
dill.settings['recurse'] = True
#import sys
#sys.setrecursionlimit(30000)

import threading
from time import sleep,time

import cloudpickle

class Fermat(object):
    def __init__(self,nFunc=None,neFunc=None,frequency = 120e6,type='s'):
        self.type = type
        self.frequency = frequency#Hz
        if nFunc is not None and neFunc is not None:
            self.nFunc = nFunc
            self.neFunc = neFunc
            self.eulerLambda, self.jacLambda = self.generateEulerEqnsSym(self.nFunc)
            return
        if nFunc is not None:
            self.nFunc = nFunc
            self.neFunc = self.n2ne(nFunc)
            self.eulerLambda, self.jacLambda = self.generateEulerEqnsSym(self.nFunc)
            return
        if neFunc is not None:
            self.neFunc = neFunc
            self.nFunc = self.ne2n(neFunc)
            self.eulerLambda, self.jacLambda = self.generateEulerEqnsSym(self.nFunc)
            return
    def loadFunc(self,filename):
        '''Load symbolic functions'''
        file = np.load(filename)
        if 'neFunc' in file.keys():
            self.neFunc = file['neFunc']
            self.nFunc = self.ne2n(neFunc)
            self.eulerLambda, self.jacLambda = self.generateEulerEqnsSym(self.nFunc)
            return
        if 'nFunc' in file.keys():
            self.nFunc = file['nFunc']
            self.neFunc = self.n2ne(nFunc)
            self.eulerLambda, self.jacLambda = self.generateEulerEqnsSym(self.nFunc)
            return
        
    def ne2n(self,neFunc):
        '''Analytically turn electron density to refractive index. Assume ne in m^-3'''
        self.neFunc = neFunc
        #wp = 5.63e4*np.sqrt(ne/1e6)/2pi#Hz^2 m^3 lightman p 226
        fp2 = 8.980**2 * neFunc
        self.nFunc = sqrt(Rational(1) - fp2/self.frequency**2)
        return self.nFunc
    
    def n2ne(self,nFunc):
        """Get electron density in m^-3 from refractive index"""
        self.nFunc = nFunc
        self.neFunc = (Rational(1) - nFunc**2)*self.frequency**2/8.980**2
        return self.neFunc
        
    def euler(self,px,py,pz,x,y,z,s,t=0):
        N = np.size(px)
        euler = np.zeros([7,N])
        i = 0
        while i < 7:
            euler[i,:] = self.eulerLambda[i](px,py,pz,x,y,z,s,t)
            i += 1
        return euler
    
    def eulerODE(self,y,t,*args):
        '''return pxdot,pydot,pzdot,xdot,ydot,zdot,sdot'''
        #print(y)
        e = self.euler(y[0],y[1],y[2],y[3],y[4],y[5],y[6],args[0]).flatten()
        #print(e)
        return e
    
    def jac(self,px,py,pz,x,y,z,s,t=0):
        N = np.size(px)
        jac = np.zeros([7,7,N])
        i = 0
        while i < 7:
            j = 0
            while j < 7:
                jac[i,j,:] = self.jacLambda[i][j](px,py,pz,x,y,z,s,t)
                j += 1
            i += 1
        return jac
    
    def jacODE(self,y,t,*args):
        '''return d ydot / d y'''
        j = self.jac(y[0],y[1],y[2],y[3],y[4],y[5],y[6],args[0]).reshape([7,7])

        #print('J:',j)
        return j
        
    def generateEulerEqnsSym(self,nFunc=None):
        '''Generate function with call signature f(t,y,*args)
        and accompanying jacobian jac(t,y,*args), jac[i,j] = d f[i] / d y[j]'''
        if nFunc is None:
            nFunc = self.nFunc
        x,y,z,px,py,pz,s,t = symbols('x y z px py pz s t')
        if self.type == 'z':
            sdot = nFunc / pz
            pxdot = nFunc.diff('x')*nFunc/pz
            pydot = nFunc.diff('y')*nFunc/pz
            pzdot = nFunc.diff('z')*nFunc/pz

            xdot = px / pz
            ydot = py / pz
            zdot = Rational(1)
        
        if self.type == 's':
            sdot = Rational(1)
            pxdot = nFunc.diff('x')
            pydot = nFunc.diff('y')
            pzdot = nFunc.diff('z')

            xdot = px / nFunc
            ydot = py / nFunc
            zdot = pz / nFunc

        eulerEqns = (pxdot,pydot,pzdot,xdot,ydot,zdot,sdot)

        euler = [lambdify((px,py,pz,x,y,z,s,t),eqn,"numpy") for eqn in eulerEqns]
        self.eulerLambda = euler
        jac = []
        
        for eqn in eulerEqns:
            jac.append([lambdify((px,py,pz,x,y,z,s,t),eqn.diff(var),"numpy") for var in (px,py,pz,x,y,z,s)])
        self.jacLambda = jac
        
        return self.eulerLambda, self.jacLambda
    def integrateRay(self,X0,direction,tmax,time = 0,N=100):
        '''Integrate rays from x0 in initial direction where coordinates are (r,theta,phi)'''
        direction /= np.linalg.norm(direction)
        x0,y0,z0 = X0
        xdot0,ydot0,zdot0 = direction
        sdot = np.sqrt(xdot0**2 + ydot0**2 + zdot0**2)
        px0 = xdot0/sdot
        py0 = ydot0/sdot
        pz0 = zdot0/sdot
        init = [px0,py0,pz0,x0,y0,z0,0]
        if self.type == 'z':
            tarray = np.linspace(z0,tmax,N)
        if self.type == 's':
            tarray = np.linspace(0,tmax,N)
        #print("Integrating at {0} from {1} in direction {2} until {3}".format(time,X0,direction,tmax))
        #print(init)
        #print("Integrating from {0} in direction {1} until {2}".format(x0,directions,tmax))
        Y,info =  odeint(self.eulerODE, init, tarray, args=(time,),Dfun = self.jacODE, col_deriv = 0, full_output=1)
        #print(info['hu'].shape,np.sum(info['hu']),info['hu'])
        #print(Y)
        x = Y[:,3]
        y = Y[:,4]
        z = Y[:,5]
        s = Y[:,6]
        return x,y,z,s    
    
def synchronized(func):
    func.__lock__ = threading.Lock()
    def synced_func(*args, **kws):
        with func.__lock__:
            return func(*args, **kws)
    return synced_func
    
class FermatIntegrationThread (threading.Thread):
    '''Only works with one thread running per time.'''
    def __init__(self, fermat, threadId):
        super(FermatIntegrationThread,self).__init__()
        self.fermat = fermat
        self.stop = False
        self.threadId = threadId
        self.numJobs = 0
        self.jobIdx = 0
        self.jobs = {}
        self.resultMap = {}
        self.results = {}
        self.totalTime = 0.
        
    def addJob(self,X0,direction,tmax,time = 0,N=100,resultIdx=None):
        '''Add a ray job return the result index'''
        self.jobs[self.numJobs] = (X0,direction,tmax,time,N)
        if resultIdx is None:
            resultIdx = self.numJobs
        self.resultMap[self.numJobs] = resultIdx
        self.numJobs += 1
        return self.numJobs - 1
    
    def kill(self):
        self.stop = True
        
    def isEmpty(self):
        return self.jobIdx == self.numJobs
    def getAverageIntegrationTime(self):
        if self.numJobs > 0:
            return self.totalTime/self.numJobs
        else:
            return 0.
        
    def run(self):
        print ("Starting thread-{0}".format(self.threadId))
        while not self.stop or not self.isEmpty():
            while self.jobIdx < self.numJobs:
                tic = time()
                x,y,z,s = self.fermat.integrateRay(*self.jobs[self.jobIdx])
                self.totalTime += time() - tic
                self.results[self.resultMap[self.jobIdx]] = {'x':x,'y':y,'z':z,'s':s}
                self.jobIdx += 1
            #sleep(self.getAverageIntegrationTime())
        print ("Stopping thread-{0}".format(self.threadId))
        print("Number of jobs done: {0}".format(self.numJobs))
        print("Integration time: {0} s [total] | {1} s [average]".format(self.totalTime,self.getAverageIntegrationTime()))

        


def testThreadedFermat():
    sol = SolitonModel(5)
    neFunc = sol.generateSolitonsModel()
    f =  Fermat(neFunc = neFunc,type = 's')
    n = 1
    threads = []
    for i in range(n):
        threads.append(FermatIntegrationThread(f,i))
        threads[i].start()
    
    count = 0
    
    theta = np.linspace(-np.pi/8.,np.pi/8.,5)
    #phi = np.linspace(0,2*np.pi,6)
    rays = []
    origin = ac.ITRS(sol.enu.location).cartesian.xyz.to(au.km).value
    for t in theta:
        for p in theta:
            direction = ac.SkyCoord(np.sin(t),
                                    np.sin(p),
                                    1.,frame=sol.enu).transform_to('itrs').cartesian.xyz.value
            threads[count % n].addJob(origin,direction,1000,0.,100,resultIdx = count)
            count += 1
    for i in range(n):
        threads[i].kill()
    #print('waiting for completion')
    for i in range(n):
        threads[i].join()
        #pass
        
    #plotWavefront(f.nFunc.subs({'t':0}),rays,*getSolitonCube(sol))
    
if __name__=='__main__':
    np.random.seed(1234)
    #testSquare()
    #testSweep()
    testThreadedFermat()
    #testSmoothify()
    #testcseLam()


Generated solitons symbolic function with 40 params
Starting thread-0
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.83321342 -0.23898555  0.49863946] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.73397746 -0.26606299  0.62489005] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.60174521 -0.28776134  0.74504773] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.45001998 -0.30013794  0.84107029] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.30006919 -0.30296296  0.90452856] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.84996359 -0.07854343  0.52095377] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.74850794 -0.09959196  0.65560453] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.61044294 -0.11960092  0.78297831] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.45059343 -0.13534176  0.88241043] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.29296095 -0.14538385  0.94500657] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.84224831  0.10106996  0.52953059] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.73929233  0.08871522  0.66751513] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.59870714  0.07184497  0.79773934] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.43596551  0.05231595  0.89844149] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.27607536  0.0331291   0.96056486] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.8072492   0.27740928  0.52095377] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.70369406  0.27385648  0.65560453] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.5648149   0.26063209  0.78297831] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.40577955  0.23810668  0.88241043] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.25024656  0.21056886  0.94500657] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.75301503  0.42933327  0.49863946] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.65019017  0.43216337  0.62489005] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.51657846  0.4219604   0.74504773] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.36623269  0.39808842  0.84107029] until 1000
Integrating at 0.0 from [ 3826.81561935   459.21861553  5064.85501047] in direction [ 0.2198708   0.36535586  0.90452856] until 1000
Stopping thread-0
Number of jobs done: 25
Integration time: 0.912000179291 s [total] | 0.0364800071716 s [average]

In [1]:
import numpy as np

import dill
dill.settings['recurse'] = True

from sympy import symbols,sqrt,Rational,lambdify,Matrix,exp,cosh,cse,simplify,cos,sin
from sympy.vector import CoordSysCartesian

def createInitSolitonParam():
    '''Create an initial random param for a soliton'''
    #initial amp
    amp = 10**np.random.uniform(low = 9.5, high = 10.5)#electron / m^3
    #initial velcoity
    maxVel = 350./3600.#100km/hour in km/s pi*(6300+350)*2/24.*0.2 (20% of solar pressure field movement)
    initc = [np.random.uniform(low=-maxVel,high=maxVel),
             np.random.uniform(low=-maxVel,high=maxVel),
             np.random.uniform(low=-maxVel,high=maxVel)]
                        
    #initial  location of blobs
    initx = [np.random.uniform(low=-100,high=100),
             np.random.uniform(low=-100,high=100),
             np.random.uniform(low=50,high=800)]
    b = np.random.uniform(low = 10.,high=100.)

    return {"A":np.sqrt(amp),
                       "cx":initc[0],
                       "cy":initc[1],
                       "cz":initc[2],
                       "x0":initx[0],
                       "y0":initx[1],
                       "z0":initx[2],
                       "b":b
                      }
    
solitonsFunc = None
initSolitonsParams = {}
i = 0
while i < 100:
    A = symbols ('A_{0}'.format(i))
    cx = symbols ('cx_{0}'.format(i))
    cy = symbols ('cy_{0}'.format(i))
    cz = symbols ('cz_{0}'.format(i))
    x0 = symbols ('x0_{0}'.format(i))
    y0 = symbols ('y0_{0}'.format(i))
    z0 = symbols ('z0_{0}'.format(i))
    b = symbols ('b_{0}'.format(i))
    i += 1
    init = createInitSolitonParam()

    initSolitonsParams[A.name] = init['A']
    initSolitonsParams[cx.name] = init['cx']
    initSolitonsParams[cy.name] = init['cy']
    initSolitonsParams[cz.name] = init['cz']
    initSolitonsParams[x0.name] = init['x0']
    initSolitonsParams[y0.name] = init['y0']
    initSolitonsParams[z0.name] = init['z0']
    initSolitonsParams[b.name] = init['b']

    x,y,z,t = symbols('x,y,z,t')

    N = CoordSysCartesian('N')
    c = cx*N.i + cy*N.j + cz*N.k  
    X = x*N.i + y*N.j + z*N.k
    X0 = x0*N.i + y0*N.j + z0*N.k
    xx0 = X - t*c - X0
    func = A*A* exp(-xx0.dot(xx0)/b**Rational(2))
    if solitonsFunc is None:
        solitonsFunc = func
    else:
        solitonsFunc += func

print("Function: {0}".format(solitonsFunc))
solitonsFunc = solitonsFunc.subs(initSolitonsParams)
print("Lambdifying")
lam = lambdify(symbols('x,y,z,t'),solitonsFunc,"numpy")
dill.dump(lam,file("lambdified_func",'wb'))


Function: A_0**2*exp((-(-cx_0*t + x - x0_0)**2 - (-cy_0*t + y - y0_0)**2 - (-cz_0*t + z - z0_0)**2)/b_0**2) + A_1**2*exp((-(-cx_1*t + x - x0_1)**2 - (-cy_1*t + y - y0_1)**2 - (-cz_1*t + z - z0_1)**2)/b_1**2) + A_10**2*exp((-(-cx_10*t + x - x0_10)**2 - (-cy_10*t + y - y0_10)**2 - (-cz_10*t + z - z0_10)**2)/b_10**2) + A_11**2*exp((-(-cx_11*t + x - x0_11)**2 - (-cy_11*t + y - y0_11)**2 - (-cz_11*t + z - z0_11)**2)/b_11**2) + A_12**2*exp((-(-cx_12*t + x - x0_12)**2 - (-cy_12*t + y - y0_12)**2 - (-cz_12*t + z - z0_12)**2)/b_12**2) + A_13**2*exp((-(-cx_13*t + x - x0_13)**2 - (-cy_13*t + y - y0_13)**2 - (-cz_13*t + z - z0_13)**2)/b_13**2) + A_14**2*exp((-(-cx_14*t + x - x0_14)**2 - (-cy_14*t + y - y0_14)**2 - (-cz_14*t + z - z0_14)**2)/b_14**2) + A_15**2*exp((-(-cx_15*t + x - x0_15)**2 - (-cy_15*t + y - y0_15)**2 - (-cz_15*t + z - z0_15)**2)/b_15**2) + A_16**2*exp((-(-cx_16*t + x - x0_16)**2 - (-cy_16*t + y - y0_16)**2 - (-cz_16*t + z - z0_16)**2)/b_16**2) + A_17**2*exp((-(-cx_17*t + x - x0_17)**2 - (-cy_17*t + y - y0_17)**2 - (-cz_17*t + z - z0_17)**2)/b_17**2) + A_18**2*exp((-(-cx_18*t + x - x0_18)**2 - (-cy_18*t + y - y0_18)**2 - (-cz_18*t + z - z0_18)**2)/b_18**2) + A_19**2*exp((-(-cx_19*t + x - x0_19)**2 - (-cy_19*t + y - y0_19)**2 - (-cz_19*t + z - z0_19)**2)/b_19**2) + A_2**2*exp((-(-cx_2*t + x - x0_2)**2 - (-cy_2*t + y - y0_2)**2 - (-cz_2*t + z - z0_2)**2)/b_2**2) + A_20**2*exp((-(-cx_20*t + x - x0_20)**2 - (-cy_20*t + y - y0_20)**2 - (-cz_20*t + z - z0_20)**2)/b_20**2) + A_21**2*exp((-(-cx_21*t + x - x0_21)**2 - (-cy_21*t + y - y0_21)**2 - (-cz_21*t + z - z0_21)**2)/b_21**2) + A_22**2*exp((-(-cx_22*t + x - x0_22)**2 - (-cy_22*t + y - y0_22)**2 - (-cz_22*t + z - z0_22)**2)/b_22**2) + A_23**2*exp((-(-cx_23*t + x - x0_23)**2 - (-cy_23*t + y - y0_23)**2 - (-cz_23*t + z - z0_23)**2)/b_23**2) + A_24**2*exp((-(-cx_24*t + x - x0_24)**2 - (-cy_24*t + y - y0_24)**2 - (-cz_24*t + z - z0_24)**2)/b_24**2) + A_25**2*exp((-(-cx_25*t + x - x0_25)**2 - (-cy_25*t + y - y0_25)**2 - (-cz_25*t + z - z0_25)**2)/b_25**2) + A_26**2*exp((-(-cx_26*t + x - x0_26)**2 - (-cy_26*t + y - y0_26)**2 - (-cz_26*t + z - z0_26)**2)/b_26**2) + A_27**2*exp((-(-cx_27*t + x - x0_27)**2 - (-cy_27*t + y - y0_27)**2 - (-cz_27*t + z - z0_27)**2)/b_27**2) + A_28**2*exp((-(-cx_28*t + x - x0_28)**2 - (-cy_28*t + y - y0_28)**2 - (-cz_28*t + z - z0_28)**2)/b_28**2) + A_29**2*exp((-(-cx_29*t + x - x0_29)**2 - (-cy_29*t + y - y0_29)**2 - (-cz_29*t + z - z0_29)**2)/b_29**2) + A_3**2*exp((-(-cx_3*t + x - x0_3)**2 - (-cy_3*t + y - y0_3)**2 - (-cz_3*t + z - z0_3)**2)/b_3**2) + A_30**2*exp((-(-cx_30*t + x - x0_30)**2 - (-cy_30*t + y - y0_30)**2 - (-cz_30*t + z - z0_30)**2)/b_30**2) + A_31**2*exp((-(-cx_31*t + x - x0_31)**2 - (-cy_31*t + y - y0_31)**2 - (-cz_31*t + z - z0_31)**2)/b_31**2) + A_32**2*exp((-(-cx_32*t + x - x0_32)**2 - (-cy_32*t + y - y0_32)**2 - (-cz_32*t + z - z0_32)**2)/b_32**2) + A_33**2*exp((-(-cx_33*t + x - x0_33)**2 - (-cy_33*t + y - y0_33)**2 - (-cz_33*t + z - z0_33)**2)/b_33**2) + A_34**2*exp((-(-cx_34*t + x - x0_34)**2 - (-cy_34*t + y - y0_34)**2 - (-cz_34*t + z - z0_34)**2)/b_34**2) + A_35**2*exp((-(-cx_35*t + x - x0_35)**2 - (-cy_35*t + y - y0_35)**2 - (-cz_35*t + z - z0_35)**2)/b_35**2) + A_36**2*exp((-(-cx_36*t + x - x0_36)**2 - (-cy_36*t + y - y0_36)**2 - (-cz_36*t + z - z0_36)**2)/b_36**2) + A_37**2*exp((-(-cx_37*t + x - x0_37)**2 - (-cy_37*t + y - y0_37)**2 - (-cz_37*t + z - z0_37)**2)/b_37**2) + A_38**2*exp((-(-cx_38*t + x - x0_38)**2 - (-cy_38*t + y - y0_38)**2 - (-cz_38*t + z - z0_38)**2)/b_38**2) + A_39**2*exp((-(-cx_39*t + x - x0_39)**2 - (-cy_39*t + y - y0_39)**2 - (-cz_39*t + z - z0_39)**2)/b_39**2) + A_4**2*exp((-(-cx_4*t + x - x0_4)**2 - (-cy_4*t + y - y0_4)**2 - (-cz_4*t + z - z0_4)**2)/b_4**2) + A_40**2*exp((-(-cx_40*t + x - x0_40)**2 - (-cy_40*t + y - y0_40)**2 - (-cz_40*t + z - z0_40)**2)/b_40**2) + A_41**2*exp((-(-cx_41*t + x - x0_41)**2 - (-cy_41*t + y - y0_41)**2 - (-cz_41*t + z - z0_41)**2)/b_41**2) + A_42**2*exp((-(-cx_42*t + x - x0_42)**2 - (-cy_42*t + y - y0_42)**2 - (-cz_42*t + z - z0_42)**2)/b_42**2) + A_43**2*exp((-(-cx_43*t + x - x0_43)**2 - (-cy_43*t + y - y0_43)**2 - (-cz_43*t + z - z0_43)**2)/b_43**2) + A_44**2*exp((-(-cx_44*t + x - x0_44)**2 - (-cy_44*t + y - y0_44)**2 - (-cz_44*t + z - z0_44)**2)/b_44**2) + A_45**2*exp((-(-cx_45*t + x - x0_45)**2 - (-cy_45*t + y - y0_45)**2 - (-cz_45*t + z - z0_45)**2)/b_45**2) + A_46**2*exp((-(-cx_46*t + x - x0_46)**2 - (-cy_46*t + y - y0_46)**2 - (-cz_46*t + z - z0_46)**2)/b_46**2) + A_47**2*exp((-(-cx_47*t + x - x0_47)**2 - (-cy_47*t + y - y0_47)**2 - (-cz_47*t + z - z0_47)**2)/b_47**2) + A_48**2*exp((-(-cx_48*t + x - x0_48)**2 - (-cy_48*t + y - y0_48)**2 - (-cz_48*t + z - z0_48)**2)/b_48**2) + A_49**2*exp((-(-cx_49*t + x - x0_49)**2 - (-cy_49*t + y - y0_49)**2 - (-cz_49*t + z - z0_49)**2)/b_49**2) + A_5**2*exp((-(-cx_5*t + x - x0_5)**2 - (-cy_5*t + y - y0_5)**2 - (-cz_5*t + z - z0_5)**2)/b_5**2) + A_50**2*exp((-(-cx_50*t + x - x0_50)**2 - (-cy_50*t + y - y0_50)**2 - (-cz_50*t + z - z0_50)**2)/b_50**2) + A_51**2*exp((-(-cx_51*t + x - x0_51)**2 - (-cy_51*t + y - y0_51)**2 - (-cz_51*t + z - z0_51)**2)/b_51**2) + A_52**2*exp((-(-cx_52*t + x - x0_52)**2 - (-cy_52*t + y - y0_52)**2 - (-cz_52*t + z - z0_52)**2)/b_52**2) + A_53**2*exp((-(-cx_53*t + x - x0_53)**2 - (-cy_53*t + y - y0_53)**2 - (-cz_53*t + z - z0_53)**2)/b_53**2) + A_54**2*exp((-(-cx_54*t + x - x0_54)**2 - (-cy_54*t + y - y0_54)**2 - (-cz_54*t + z - z0_54)**2)/b_54**2) + A_55**2*exp((-(-cx_55*t + x - x0_55)**2 - (-cy_55*t + y - y0_55)**2 - (-cz_55*t + z - z0_55)**2)/b_55**2) + A_56**2*exp((-(-cx_56*t + x - x0_56)**2 - (-cy_56*t + y - y0_56)**2 - (-cz_56*t + z - z0_56)**2)/b_56**2) + A_57**2*exp((-(-cx_57*t + x - x0_57)**2 - (-cy_57*t + y - y0_57)**2 - (-cz_57*t + z - z0_57)**2)/b_57**2) + A_58**2*exp((-(-cx_58*t + x - x0_58)**2 - (-cy_58*t + y - y0_58)**2 - (-cz_58*t + z - z0_58)**2)/b_58**2) + A_59**2*exp((-(-cx_59*t + x - x0_59)**2 - (-cy_59*t + y - y0_59)**2 - (-cz_59*t + z - z0_59)**2)/b_59**2) + A_6**2*exp((-(-cx_6*t + x - x0_6)**2 - (-cy_6*t + y - y0_6)**2 - (-cz_6*t + z - z0_6)**2)/b_6**2) + A_60**2*exp((-(-cx_60*t + x - x0_60)**2 - (-cy_60*t + y - y0_60)**2 - (-cz_60*t + z - z0_60)**2)/b_60**2) + A_61**2*exp((-(-cx_61*t + x - x0_61)**2 - (-cy_61*t + y - y0_61)**2 - (-cz_61*t + z - z0_61)**2)/b_61**2) + A_62**2*exp((-(-cx_62*t + x - x0_62)**2 - (-cy_62*t + y - y0_62)**2 - (-cz_62*t + z - z0_62)**2)/b_62**2) + A_63**2*exp((-(-cx_63*t + x - x0_63)**2 - (-cy_63*t + y - y0_63)**2 - (-cz_63*t + z - z0_63)**2)/b_63**2) + A_64**2*exp((-(-cx_64*t + x - x0_64)**2 - (-cy_64*t + y - y0_64)**2 - (-cz_64*t + z - z0_64)**2)/b_64**2) + A_65**2*exp((-(-cx_65*t + x - x0_65)**2 - (-cy_65*t + y - y0_65)**2 - (-cz_65*t + z - z0_65)**2)/b_65**2) + A_66**2*exp((-(-cx_66*t + x - x0_66)**2 - (-cy_66*t + y - y0_66)**2 - (-cz_66*t + z - z0_66)**2)/b_66**2) + A_67**2*exp((-(-cx_67*t + x - x0_67)**2 - (-cy_67*t + y - y0_67)**2 - (-cz_67*t + z - z0_67)**2)/b_67**2) + A_68**2*exp((-(-cx_68*t + x - x0_68)**2 - (-cy_68*t + y - y0_68)**2 - (-cz_68*t + z - z0_68)**2)/b_68**2) + A_69**2*exp((-(-cx_69*t + x - x0_69)**2 - (-cy_69*t + y - y0_69)**2 - (-cz_69*t + z - z0_69)**2)/b_69**2) + A_7**2*exp((-(-cx_7*t + x - x0_7)**2 - (-cy_7*t + y - y0_7)**2 - (-cz_7*t + z - z0_7)**2)/b_7**2) + A_70**2*exp((-(-cx_70*t + x - x0_70)**2 - (-cy_70*t + y - y0_70)**2 - (-cz_70*t + z - z0_70)**2)/b_70**2) + A_71**2*exp((-(-cx_71*t + x - x0_71)**2 - (-cy_71*t + y - y0_71)**2 - (-cz_71*t + z - z0_71)**2)/b_71**2) + A_72**2*exp((-(-cx_72*t + x - x0_72)**2 - (-cy_72*t + y - y0_72)**2 - (-cz_72*t + z - z0_72)**2)/b_72**2) + A_73**2*exp((-(-cx_73*t + x - x0_73)**2 - (-cy_73*t + y - y0_73)**2 - (-cz_73*t + z - z0_73)**2)/b_73**2) + A_74**2*exp((-(-cx_74*t + x - x0_74)**2 - (-cy_74*t + y - y0_74)**2 - (-cz_74*t + z - z0_74)**2)/b_74**2) + A_75**2*exp((-(-cx_75*t + x - x0_75)**2 - (-cy_75*t + y - y0_75)**2 - (-cz_75*t + z - z0_75)**2)/b_75**2) + A_76**2*exp((-(-cx_76*t + x - x0_76)**2 - (-cy_76*t + y - y0_76)**2 - (-cz_76*t + z - z0_76)**2)/b_76**2) + A_77**2*exp((-(-cx_77*t + x - x0_77)**2 - (-cy_77*t + y - y0_77)**2 - (-cz_77*t + z - z0_77)**2)/b_77**2) + A_78**2*exp((-(-cx_78*t + x - x0_78)**2 - (-cy_78*t + y - y0_78)**2 - (-cz_78*t + z - z0_78)**2)/b_78**2) + A_79**2*exp((-(-cx_79*t + x - x0_79)**2 - (-cy_79*t + y - y0_79)**2 - (-cz_79*t + z - z0_79)**2)/b_79**2) + A_8**2*exp((-(-cx_8*t + x - x0_8)**2 - (-cy_8*t + y - y0_8)**2 - (-cz_8*t + z - z0_8)**2)/b_8**2) + A_80**2*exp((-(-cx_80*t + x - x0_80)**2 - (-cy_80*t + y - y0_80)**2 - (-cz_80*t + z - z0_80)**2)/b_80**2) + A_81**2*exp((-(-cx_81*t + x - x0_81)**2 - (-cy_81*t + y - y0_81)**2 - (-cz_81*t + z - z0_81)**2)/b_81**2) + A_82**2*exp((-(-cx_82*t + x - x0_82)**2 - (-cy_82*t + y - y0_82)**2 - (-cz_82*t + z - z0_82)**2)/b_82**2) + A_83**2*exp((-(-cx_83*t + x - x0_83)**2 - (-cy_83*t + y - y0_83)**2 - (-cz_83*t + z - z0_83)**2)/b_83**2) + A_84**2*exp((-(-cx_84*t + x - x0_84)**2 - (-cy_84*t + y - y0_84)**2 - (-cz_84*t + z - z0_84)**2)/b_84**2) + A_85**2*exp((-(-cx_85*t + x - x0_85)**2 - (-cy_85*t + y - y0_85)**2 - (-cz_85*t + z - z0_85)**2)/b_85**2) + A_86**2*exp((-(-cx_86*t + x - x0_86)**2 - (-cy_86*t + y - y0_86)**2 - (-cz_86*t + z - z0_86)**2)/b_86**2) + A_87**2*exp((-(-cx_87*t + x - x0_87)**2 - (-cy_87*t + y - y0_87)**2 - (-cz_87*t + z - z0_87)**2)/b_87**2) + A_88**2*exp((-(-cx_88*t + x - x0_88)**2 - (-cy_88*t + y - y0_88)**2 - (-cz_88*t + z - z0_88)**2)/b_88**2) + A_89**2*exp((-(-cx_89*t + x - x0_89)**2 - (-cy_89*t + y - y0_89)**2 - (-cz_89*t + z - z0_89)**2)/b_89**2) + A_9**2*exp((-(-cx_9*t + x - x0_9)**2 - (-cy_9*t + y - y0_9)**2 - (-cz_9*t + z - z0_9)**2)/b_9**2) + A_90**2*exp((-(-cx_90*t + x - x0_90)**2 - (-cy_90*t + y - y0_90)**2 - (-cz_90*t + z - z0_90)**2)/b_90**2) + A_91**2*exp((-(-cx_91*t + x - x0_91)**2 - (-cy_91*t + y - y0_91)**2 - (-cz_91*t + z - z0_91)**2)/b_91**2) + A_92**2*exp((-(-cx_92*t + x - x0_92)**2 - (-cy_92*t + y - y0_92)**2 - (-cz_92*t + z - z0_92)**2)/b_92**2) + A_93**2*exp((-(-cx_93*t + x - x0_93)**2 - (-cy_93*t + y - y0_93)**2 - (-cz_93*t + z - z0_93)**2)/b_93**2) + A_94**2*exp((-(-cx_94*t + x - x0_94)**2 - (-cy_94*t + y - y0_94)**2 - (-cz_94*t + z - z0_94)**2)/b_94**2) + A_95**2*exp((-(-cx_95*t + x - x0_95)**2 - (-cy_95*t + y - y0_95)**2 - (-cz_95*t + z - z0_95)**2)/b_95**2) + A_96**2*exp((-(-cx_96*t + x - x0_96)**2 - (-cy_96*t + y - y0_96)**2 - (-cz_96*t + z - z0_96)**2)/b_96**2) + A_97**2*exp((-(-cx_97*t + x - x0_97)**2 - (-cy_97*t + y - y0_97)**2 - (-cz_97*t + z - z0_97)**2)/b_97**2) + A_98**2*exp((-(-cx_98*t + x - x0_98)**2 - (-cy_98*t + y - y0_98)**2 - (-cz_98*t + z - z0_98)**2)/b_98**2) + A_99**2*exp((-(-cx_99*t + x - x0_99)**2 - (-cy_99*t + y - y0_99)**2 - (-cz_99*t + z - z0_99)**2)/b_99**2)
Lambdifying

In [4]:
help(dill.dump)


Help on function dump in module dill.dill:

dump(obj, file, protocol=None, byref=None, fmode=None, recurse=None)
    pickle an object to a file


In [ ]: