brief explanation of mcmc implementation in lalsuite hyung won lee, inje university with chunglee...

36
Brief Explanation of MCMC implementation in lalsuite Hyung Won Lee, Inje University with Chunglee Kim(KHU&KISTI) and Jeongcho Kim(Inje) 6 Feb. 2015, KAGRA f2f meeting, Hongo Campus 11th KAGRA f2f Meeting, 4-7 February 2015 1 2015-2-6

Upload: maxim-sanders

Post on 16-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

11th KAGRA f2f Meeting, 4-7 February 2015

1

Brief Explanation of MCMC implementation

in lalsuiteHyung Won Lee, Inje University

with Chunglee Kim(KHU&KISTI) and Jeongcho Kim(Inje)

6 Feb. 2015, KAGRA f2f meeting, Hongo Campus

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

2

Motivation CBC gravitational wave sources Parameter Estimation with Bayesian

Inference Implementation in lalsuite Suggestions for KAGALI Discussions

Contents

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

3

How does it work parameter estima-tion

Understanding Bayesian inference/MCMC

Which physical parameters How it was implemented in lalsuite How it could be implemented for

KAGALI Get practical work out items

Motivation

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

4

Neutron star(NS) + Black hole(BH) binary

Mass range : Frequency range : Waveform : Inspiral, Merger, Ring-

down

CBC GW sources

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

5

CBC Inspiral GW Waveform

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

6

TaylorT1, 2, 3, 4 PadeT1 : P-approximation EOB : effective one body SpinTaylorT1, 2, 3, 4, 5 IMRPhenomA, B, C

Time Domain Template

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

7

TaylorF1 TaylorF2 : standard for detection pipe-

line, SPA approximation TaylorF2Amp : include higher harmon-

ics due to amplitude corrections up to 2.5 pN

PadeF1 BCV BCVSpin

Frequency Domain Tem-plate

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

8

Arun et.al., PRD79, 104023(2009) Amplitude corrections up to n=5

(2.5pN)

TaylorF2Amp Waveform

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

9

Phase corrections up to 3.5PN (s-tandard in LAL)

SPA phase factor

+

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

10

SPA phase factor(Code)

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

11

Individual masses Luminosity distance Inclination angle Coalescence phase Coalescence time at geocenter Declination Right ascension Polarization Spins, quadrupole deformations

2015-2-6

Physical Parameters

11th KAGRA f2f Meeting, 4-7 February 2015

12

Bayesian Inference

• : unobservable model parameters• : observable data• : Joint probability observing data with

model parameter

Metropolis-Hasting Algorithm, samples

Parameter Estimation with Bayesian in-ference

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

13

Parameter Estimation with Bayesian in-ference

2015-2-6

MCMC Samples

PTMCMCOutput.00PTMCMCOutput.nn

Post Process

cbcByesPostProc.py

11th KAGRA f2f Meeting, 4-7 February 2015

14

Network SNR

Overlap CalculationDataTemplate

One-sided power spectral density of noise

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

15

ℒ (𝑠∨𝜃)∝exp [−2∫0

∞ |~𝑠 ( 𝑓 )−~h(𝜃 , 𝑓 )|2

𝑆𝑛 ( 𝑓 )𝑑𝑓 ]

Likelihood Calculation

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

16

Unnormalized

Normalized

Various Overlaps

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

17

Accept next state with probability

Metropolis-Hasting smapling

MCMC Process

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

18

Use few chains with different tem-perature

Use likelihood Improve convergence Improve mixing The higher temperature, the

smoother distribution

Parallel Tempering

2015-2-6

𝑇 >1

11th KAGRA f2f Meeting, 4-7 February 2015

19

LAL MCMC Pipeline Directory structure of lalsuite

Implementation in lalsuite

2015-2-6

Post Processing python script

Basic entities of LALSuite

LAL applications

Simulation related functions and waveforms

Likelihood, proposal and prior functions

11th KAGRA f2f Meeting, 4-7 February 2015

20

LAL MCMC PipelineStart

End

Initialization

MPI synchro-nize

PT MCMC

Clearance

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

21

ProcessParamsTable *commandLine; /** A ProcessParamsTable with command line arguments */

LALInferenceInitModelFunction initModel; /** A function that returns a new set of variables for the model */

LALInferenceAlgorithm algorithm; /** The algorithm function */ LALInferenceEvolveOneStepFunction evolve;

/** The algorithm's single iteration function */ LALInferencePriorFunction prior; /** The prior for the parameters */ LALInferenceCubeToPriorFunction CubeToPrior;

/** MultiNest prior for the parameters */ LALInferenceLikelihoodFunction likelihood;

/** The likelihood function */ LALInferenceProposalFunction proposal; /** The proposal function */ LALInferenceLogFunction logsample; /** Log sample, i.e. to disk */ LALInferenceTemplateFunction templt;

/** The template generation function */ … more

2015-2-6

LALInferenceRunState

11th KAGRA f2f Meeting, 4-7 February 2015

22

LAL MCMC pipeline in a glance

MCMC main main(start)

end

PTMCMCAlgorithm

parseCommandLine OptionsInitialize Rusnstate

initializeMCMCaddVariablesInitializeCBC

Initialize likelihoodInitialize MCMC state

MPI_Barrierwait synchronization

runState ->alogorithmmain MCMC routine

DeinitializeClean resources

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

23

PTMCMCAlgorithm

end

PTMCMCAlgo-rithm(start)

PTMCMCOneStep

MPI setup, runComplete = 0Ladder setup for parallel tempering Ladder[i] = Min

Set temperature for this chainif(MPI_rank == 0) output

Anealing related setupDebug related setup

runState ->evolveOneStep MCMC routine

If(MPI_rank≠0) non-blocking re-ceive

MPI_Barrier

!runCom-plete

Ladder update if needCalculate ACL(autocorrelation length) If( i>Neff) runCom-

plete=1Anealing

post-anealing

Save for every Nskip stepIf(i>Niter) runComplete=1

If(MPI_rank==0 && runComplete==1) send run complete value to all other paral-lel process

MPI_BarrierXLALFree() resource

free

Receive runComplete state from root process

NoYes

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

24

PTMCMCOneStep

PTMCMCOn-eStep(start)

MPI setup

runState ->proposal

Compute prior & likelihooddetermine acceptance probability

Accept

end

LALInferenceCyclicProposal

LALInferenceCyclicProposal LALInferenceCyclicPro-posal(start)

LALInferenceProposalFunction *cycle = NULL

Must have cycle array and cycle array length in propArgs

(cycle[i])(runState, proposedParams)Call proposal

end

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

25

Call TaylorF2Amp in MCMC

Mcmc main

PTMCMCAlgorithm()

PTMCMCOn-eStep()

LALInferenceUndecom-posed

FreqDomainLogLikelihood()

LALInferenceTemplateXLALSimInspiralChooseWave-

form()

XLALSimInspiralChooseFDWaveformFromCache()

XLALSimInspiralChooseFDWave-form()

XLALSimInspiralTaylor-F2Amp()

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

26

1. waveform library [LALSimulation]

2. PE library [LALInference & LALapps]

3. basic libraries are scattered, but most basic ones are in [LAL]

LAL parameter estimation(PE) pipeline

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

27

LALSimulation/src/ ..

LALSimInspiral.h -> protocol definitionsXLALSimInspiralF2AmpPlus() -> XLALSimInspiralF2AmpCross() ->

LALSimInspiral.c -> XLALSimInspiralChooseFDWaveform() call a waveform model XLALSimInspiralF2AmpPlus()XLALSimInspiralF2AmpCross()

LALSimInspiralTaylorF2Amp.c -> example of a FD waveform

XLALSimInspiralF2AmpPlus()XLALSimInspiralF2AmpCross()

waveform library [LALSimulation]

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

28

LALInference/src/..

LALInference.h LALInferenceReadData.cLALInferecneTemplate.c

LALInference.h -> collections of structures

typedef tagLALInferenceRunState signal/parameters{

∙∙∙ -> Structure to contain inference run state} LALInferenceRunState;

typedef struct tagLALInferenceIFOData data for detector including sensitivity{

∙∙∙ -> Structure to contain IFOdata} LALInferenceIFOData;

PE library [LALInference]

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

29

LALInference/src/..

LALInference.h LALInferenceReadData.cLALInferecneTemplate.c

reads injection parameters from an xml file reads PSD for each detector reads data for each detector generate noise for each detector

LALInferenceIFOData *LALInferenceReadData(ProcessParamsTable *commandLine)-> Read in the data and store it in a LALInferenceIFOData structure

PE library [LALInference]

2015-2-6

11th KAGRA f2f Meeting, 4-7 February 2015

302015-2-6

PE library [LALInference]

LALInference/src/..

LALInference.h LALInferenceReadData.cLALInferecneTemplate.c

- Jump around parameter space generate template signal

LALInferenceTemplate.c -> template calls to LAL template functions

LALInferenceTemplateXLALSimInspiralChooseWaveform() Wrapper for LALSimulation waveforms : XLALSimInspiralChooseFDWaveform()

XLALSimInspiralChooseTDWaveform()- Parameters of non-spinning waveform in LALInferencePrior.c

11th KAGRA f2f Meeting, 4-7 February 2015

312015-2-6

PE library [LALInference]LALInference/src/..

LALInference.h LALInferenceLikelihood.cLALInferecneTemplate.c

LALInferenceLikelihood.c -> Bayesian Followup likelihood function

LALInferenceUndeomposedFreqDomainLogLikelihood()Required (`currentParams') parameters are:

"rightascension" (REAL8, radian, 0 <= RA <= 2pi) "declination" (REAL8, radian, -pi/2 <= dec <=pi/2) "polarisation” (REAL8, radian, 0 <= psi <= pi) "time" (REAL8, GPS sec.)

11th KAGRA f2f Meeting, 4-7 February 2015

322015-2-6

PE library [LALapps]

LALapps/src/inspiral/posterior/..

LALInferenceMCMC.cLALInferenceMCMCSampler.c

LALInferenceMCMC.c -> Bayesian Followup function testing site

main() 1. Set up structures for MCMC 2. Choose the likelihood function -> ex) student-T , Undecomposed. 3. Call MCMC algorithm -> sampling posterior function

11th KAGRA f2f Meeting, 4-7 February 2015

332015-2-6

PE library [LALapps]

LALapps/src/inspiral/poste-rior/..

LALInferenceMCMC.cLALInferenceMCMCSampler.c

LALInferenceMCMCSampler.c -> Bayesian Followup, MCMC algorithm

PTMCMCAlgorithm() PTMCMCOneStep() -> Metropolis-Hasting algorithm implemented

11th KAGRA f2f Meeting, 4-7 February 2015

342015-2-6

basic functions, librarieslal/FrequencySeries.h -> dataStructurelal/LALDatatypes.h ->Primitive datatypes

Aggregate datatypes Store arbitrarily large sets or collections of primi-

tive datatypes. aggregate datatypes are defines

Structured datatypes : embed primitive and ag-gregate datatypes

inside structures that define their physical mean-ing.

lal/LALConstants.h -> physical constants, Pi, h, G, etc.

11th KAGRA f2f Meeting, 4-7 February 2015

35

Directory structure by functionality• MCMC chain generation• Waveform generation• Input output functions

Notes to consider• Waveform function call parameter• Post process language• Python• Haskell• C and gnuplot

2015-2-6

Suggestions for KAGALI

11th KAGRA f2f Meeting, 4-7 February 2015

36

Bayesian Parameter Estimation Optimal library structure How to post process? All from scratch?

Collaboration meeting from 9 to 11 February at Inje University

Discussions

2015-2-6