How to use the celerite.kernels.ExpSine2Kernel function in celerite

To help you get started, we’ve selected a few celerite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github captain-exoplanet / misttborn / misttborn.py View on Github external
model[closefilter]+=rawmodel


                if args.gp:
                    if any('gpmodtypep' in s for s in data['gpmodtype']):
                        if data['gpmodtype']['gpmodtypep'] == 'Matern32':
                            pkern=gppack.kernels.Matern32Kernel(parstruc['gpppartau']**2)*parstruc['gppparamp']**2
                        elif data['gpmodtype']['gpmodtypep'] == 'Cosine':
                            pkern=gppack.kernels.CosineKernel(parstruc['gppparP'])*parstruc['gppparamp']**2
                        elif data['gpmodtype']['gpmodtypep'] == 'ExpSine2':
                            pkern=gppack.kernels.ExpSine2Kernel(parstruc['gpppartau'],parstruc['gppparP'])*parstruc['gppparamp']**2
                        elif data['gpmodtype']['gpmodtypep'] == 'Haywood14QP':
                            if instruc['gppackflag'] == 'celerite':
                                pkern=celeritekernel(np.log(parstruc['gppparamp']**2),np.log(parstruc['gppparGamma']),np.log(1./np.sqrt(2.)/parstruc['gpppartau']),np.log(parstruc['gppparP']*2.))
                            else:
                                pkern1=gppack.kernels.ExpSine2Kernel(parstruc['gppparGamma'],parstruc['gppparP'])
                                pkern2=gppack.kernels.ExpSquaredKernel(parstruc['gpppartau'])
                                pkern=pkern1*pkern2*parstruc['gppparamp']**2
                            
                        
                        gp=gppack.GP(pkern)
                        useforgp=np.where(data['gppuse'] == 1)
                        notforgp=np.where(data['gppuse'] == 0)
                        useforgp, notforgp = useforgp[0], notforgp[0]
                        gp.compute(np.array(data['ptime'][useforgp]),np.array(data['perror'][useforgp]))
                
                if args.plotstep or args.plotbest:
                    pl.plot(np.array(data['ptime'], dtype=float),np.array(data['pflux'], dtype=float),'ro')
                    pl.plot(np.array(data['ptime'], dtype=float),model+1.)
                    pl.show()
                    pl.clf()
                    pl.plot(np.array(data['ptime'], dtype=float),np.array(data['pflux'], dtype=float)-(model+1.),'ro')
github captain-exoplanet / misttborn / misttbornplotter.py View on Github external
import matplotlib.gridspec as gridspec
            gs=gridspec.GridSpec(2, 1, height_ratios=[4,1])
            ax1=pl.subplot(gs[0])
        if args.gp:
            if any('gpmodtypep' in s for s in data['gpmodtype']):
                if data['gpmodtype']['gpmodtypep'] == 'Matern32':
                    pkern=gppack.kernels.Matern32Kernel(parstruc['gpppartau']**2)*parstruc['gppparamp']**2
                elif data['gpmodtype']['gpmodtypep'] == 'Cosine':
                    pkern=gppack.kernels.CosineKernel(parstruc['gppparP'])*parstruc['gppparamp']**2
                elif data['gpmodtype']['gpmodtypep'] == 'ExpSine2':
                    pkern=gppack.kernels.ExpSine2Kernel(parstruc['gpppartau'],parstruc['gppparP'])*parstruc['gppparamp']**2
                elif data['gpmodtype']['gpmodtypep'] == 'Haywood14QP':
                    if struc1['gppackflag'] == 'celerite':
                        pkern=celeritekernel(np.log(parstruc['gppparamp']**2),np.log(parstruc['gppparGamma']),np.log(1./np.sqrt(2.)/parstruc['gpppartau']),np.log(parstruc['gppparP']*2.))
                    else:
                        pkern1=gppack.kernels.ExpSine2Kernel(parstruc['gppparGamma'],parstruc['gppparP'])
                        pkern2=gppack.kernels.ExpSquaredKernel(parstruc['gpppartau'])
                        pkern=pkern1*pkern2*parstruc['gppparamp']**2
                            
                        
                gp=gppack.GP(pkern)
                useforgp=np.where(data['gppuse'] == 1)
                notforgp=np.where(data['gppuse'] == 0)
                useforgp, notforgp = useforgp[0], notforgp[0]
                gp.compute(np.array(data['ptime'][useforgp]),np.array(data['perror'][useforgp]))

        for j in range (0,pndatasets):
            if any('q1p' in s for s in inposindex) and any('q1p' in s for s in inposindex):
                modelstruc['g1'], modelstruc['g2'] = 2.0*parstruc['q2p'+struc1['filternumber'+str(j+1)]]*np.sqrt(parstruc['q1p'+struc1['filternumber'+str(j+1)]]), np.sqrt(parstruc['q1p'+struc1['filternumber'+str(j+1)]])*(1.0-2.0*parstruc['q2p'+struc1['filternumber'+str(j+1)]])
            else:
                modelstruc['g1'], modelstruc['g2'] = parstruc['g1p'+struc1['filternumber'+str(j+1)]], parstruc['g2p'+struc1['filternumber'+str(j+1)]]
github captain-exoplanet / misttborn / misttborn.py View on Github external
data['pflux']=np.append(data['pflux'],np.zeros(100))
                        data['perror']=np.append(data['perror'],np.zeros(100))
                        data['pdataset']=np.append(data['pdataset'],np.zeros(100)-1)
                        data['pfilter']=np.append(data['pfilter'],np.zeros(100)+j)
                else:
                    model[closefilter]+=rawmodel


                if args.gp:
                    if any('gpmodtypep' in s for s in data['gpmodtype']):
                        if data['gpmodtype']['gpmodtypep'] == 'Matern32':
                            pkern=gppack.kernels.Matern32Kernel(parstruc['gpppartau']**2)*parstruc['gppparamp']**2
                        elif data['gpmodtype']['gpmodtypep'] == 'Cosine':
                            pkern=gppack.kernels.CosineKernel(parstruc['gppparP'])*parstruc['gppparamp']**2
                        elif data['gpmodtype']['gpmodtypep'] == 'ExpSine2':
                            pkern=gppack.kernels.ExpSine2Kernel(parstruc['gpppartau'],parstruc['gppparP'])*parstruc['gppparamp']**2
                        elif data['gpmodtype']['gpmodtypep'] == 'Haywood14QP':
                            if instruc['gppackflag'] == 'celerite':
                                pkern=celeritekernel(np.log(parstruc['gppparamp']**2),np.log(parstruc['gppparGamma']),np.log(1./np.sqrt(2.)/parstruc['gpppartau']),np.log(parstruc['gppparP']*2.))
                            else:
                                pkern1=gppack.kernels.ExpSine2Kernel(parstruc['gppparGamma'],parstruc['gppparP'])
                                pkern2=gppack.kernels.ExpSquaredKernel(parstruc['gpppartau'])
                                pkern=pkern1*pkern2*parstruc['gppparamp']**2
                            
                        
                        gp=gppack.GP(pkern)
                        useforgp=np.where(data['gppuse'] == 1)
                        notforgp=np.where(data['gppuse'] == 0)
                        useforgp, notforgp = useforgp[0], notforgp[0]
                        gp.compute(np.array(data['ptime'][useforgp]),np.array(data['perror'][useforgp]))
                
                if args.plotstep or args.plotbest: