How to use the celerite.kernels 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[0:orlength]
                        model=np.append(model,rawmodel[orlength:])
                        nexpp+=100
                        data['ptime']=np.append(data['ptime'],np.zeros(100)+np.mean(data['ptime'][closefilter]))
                        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)
github captain-exoplanet / misttborn / misttbornplotter.py View on Github external
if args.binary and modelstruc['photmodflag'] == 'batman': modelstruc['aors'] = aors[i]*(1.+parstruc['rprs'+str(i+1)]) #PRIMARY eclipse, so PRIMARY in background, R*=R1, Rp=R2
        oflux=np.array(data['pflux'])
        mresid=np.array(data['pflux'])
        if args.gp: mresidgp=np.array(data['pflux'])
        if pnfilters > 1:
            fig=pl.figure(figsize=(8.0,6.0+2.0*pnfilters))
        if args.plotresids: 
            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]))
github captain-exoplanet / misttborn / misttborn.py View on Github external
nexpp+=100
                        data['ptime']=np.append(data['ptime'],np.zeros(100)+np.mean(data['ptime'][closefilter]))
                        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]))
github captain-exoplanet / misttborn / misttbornplotter.py View on Github external
else:
            modelstruc['photmodflag']='batman'
        if args.binary and modelstruc['photmodflag'] == 'batman': modelstruc['aors'] = aors[i]*(1.+parstruc['rprs'+str(i+1)]) #PRIMARY eclipse, so PRIMARY in background, R*=R1, Rp=R2
        oflux=np.array(data['pflux'])
        mresid=np.array(data['pflux'])
        if args.gp: mresidgp=np.array(data['pflux'])
        if pnfilters > 1:
            fig=pl.figure(figsize=(8.0,6.0+2.0*pnfilters))
        if args.plotresids: 
            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)