You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 7, 2018. It is now read-only.
For a full listing of all options run ``pycbc_inference --help``. In this subsection we reference documentation for Python classes that contain more information about choices for samplers, likelihood models, and priors.
40
+
For a full listing of all options run ``gwin --help``. In this subsection we reference documentation for Python classes that contain more information about choices for samplers, likelihood models, and priors.
41
41
42
42
The user specifies the sampler on the command line with the ``--sampler`` option.
43
-
A complete list of samplers is given in ``pycbc_inference --help``.
44
-
These samplers are described in :py:class:`gwin.sampler_kombine.KombineSampler`, :py:class:`gwin.sampler_emcee.EmceeEnsembleSampler`, and :py:class:`gwin.sampler_emcee.EmceePTSampler`.
43
+
A complete list of samplers is given in ``gwin --help``.
44
+
These samplers are described in :py:class:`gwin.sampler.KombineSampler`, :py:class:`gwin.sampler.EmceeEnsembleSampler`, and :py:class:`gwin.sampler.EmceePTSampler`.
45
45
In addition to ``--sampler`` the user will need to specify the number of walkers to use ``--nwalkers``, and for parallel-tempered samplers the number of temperatures ``--ntemps``. You also need to either specify the number of iterations to run for using ``--niterations`` **or** the number of independent samples to collect using ``--n-independent-samples``. For the latter, a burn-in function must be specified using ``--burn-in-function``. In this case, the program will run until the sampler has burned in, at which point the number of independent samples equals the number of walkers. If the number of independent samples desired is greater than the number of walkers, the program will continue to run until it has collected the specified number of independent samples (to do this, an autocorrelation length is computed at each checkpoint to determine how many iterations need to be skipped to obtain independent samples).
46
46
47
47
The user specifies the likelihood model on the command line with the ``--likelihood-evaluator`` option. Any choice that starts with ``test_`` is an analytic test distribution that requires no data or waveform generation; see the section below on running on an analytic distribution for more details. For running on data, use ``--likelihood-evaluator gaussian``; this uses :py:class:`gwin.likelihood.GaussianLikelihood` for evaluating posteriors. Examples of using this on a BBH injection and on GW150914 are given below.
@@ -62,10 +62,8 @@ To create a subsection use the ``-`` char, e.g. for one of the mass parameters d
62
62
63
63
Each prior subsection must have a ``name`` option that identifies what prior to use.
64
64
These distributions are described in :py:mod:`pycbc.distributions`.
65
-
A list of all distributions that can be used is found with
One or more of the ``variable_args`` may be transformed to a different parameter space for purposes of sampling. This is done by specifying a ``[sampling_parameters]`` section. This section specifies which ``variable_args`` to replace with which parameters for sampling. This must be followed by one or more ``[sampling_transforms-{sampling_params}]`` sections that provide the transform class to use. For example, the following would cause the sampler to sample in chirp mass (``mchirp``) and mass ratio (``q``) instead of ``mass1`` and ``mass2``::
71
69
@@ -100,10 +98,9 @@ Any class in the transforms module may be used. A useful transform for these pur
100
98
inputs = lambda1
101
99
dquad_mon1 = dquadmon_from_lambda(lambda1)
102
100
103
-
A list of all parameters that are understood by the CBC waveform generator can be found with:
101
+
The following table lists all parameters understood by the CBC waveform generator:
Some common transforms are pre-defined in the code. These are: the mass parameters ``mass1`` and ``mass2`` can be substituted with ``mchirp`` and ``eta`` or ``mchirp`` and ``q``.
109
106
The component spin parameters ``spin1x``, ``spin1y``, and ``spin1z`` can be substituted for polar coordinates ``spin1_a``, ``spin1_azimuthal``, and ``spin1_polar`` (ditto for ``spin2``).
@@ -136,7 +133,7 @@ This example demonstrates how to sample a 2D normal distribution with the ``emce
136
133
137
134
Then run::
138
135
139
-
pycbc_inference --verbose \
136
+
gwin --verbose \
140
137
--config-files normal2d.ini \
141
138
--output-file normal2d.hdf \
142
139
--sampler emcee \
@@ -148,7 +145,7 @@ This will run the ``emcee`` sampler on the 2D analytic normal distribution with
148
145
149
146
To plot the posterior distribution after the last iteration, run::
150
147
151
-
pycbc_inference_plot_posterior --verbose \
148
+
gwin_plot_posterior --verbose \
152
149
--input-file normal2d.hdf \
153
150
--output-file posterior-normal2d.png \
154
151
--plot-scatter \
@@ -157,11 +154,11 @@ To plot the posterior distribution after the last iteration, run::
157
154
--z-arg loglr \
158
155
--iteration -1
159
156
160
-
This will plot each walker's position as a single point colored by the log likelihood ratio at that point, with the 50th and 90th percentile contours drawn. See below for more information about using ``pycbc_inference_plot_posterior``.
157
+
This will plot each walker's position as a single point colored by the log likelihood ratio at that point, with the 50th and 90th percentile contours drawn. See below for more information about using ``gwin_plot_posterior``.
161
158
162
159
To make a movie showing how the walkers evolved, run::
163
160
164
-
pycbc_inference_plot_movie --verbose \
161
+
gwin_plot_movie --verbose \
165
162
--input-file normal2d.hdf \
166
163
--output-prefix frames-normal2d \
167
164
--movie-file normal2d_mcmc_evolution.mp4 \
@@ -172,11 +169,11 @@ To make a movie showing how the walkers evolved, run::
172
169
--z-arg loglr \
173
170
--frame-step 1
174
171
175
-
**Note:** you need ``ffmpeg`` installed for the mp4 to be created. See below for more information on using ``pycbc_inference_plot_movie``.
172
+
**Note:** you need ``ffmpeg`` installed for the mp4 to be created. See below for more information on using ``gwin_plot_movie``.
176
173
177
174
The number of dimensions of the distribution is set by the number of ``variable_args`` in the configuration file. The names of the ``variable_args`` do not matter, just that the prior sections use the same names (in this example ``x`` and ``y`` were used, but ``foo`` and ``bar`` would be equally valid). A higher (or lower) dimensional distribution can be tested by simply adding more (or less) ``variable_args``.
178
175
179
-
Which analytic distribution is used is set by the ``--likelihood-evaluator`` option. By setting to ``test_normal`` we used :py:class:`gwin.likelihood.TestNormal`. To see the list of available likelihood classes run ``pycbc_inference --help``; any choice for ``--likelihood-evaluator`` that starts with ``test_`` is analytic. The other analytic distributions available are: :py:class:`gwin.likelihood.TestEggbox`, :py:class:`gwin.likelihood.TestRosenbrock`, and :py:class:`gwin.likelihood.TestVolcano`. As with ``test_normal``, the dimensionality of these test distributions is set by the number of ``variable_args`` in the configuration file. The ``test_volcano`` distribution must be two dimensional, but all of the other distributions can have any number of dimensions. The configuration file syntax for the other test distributions is the same as in this example. Indeed, with this configuration file one only needs to change the ``--likelihood-evaluator`` argument to try (2D versions of) the other distributions.
176
+
Which analytic distribution is used is set by the ``--likelihood-evaluator`` option. By setting to ``test_normal`` we used :py:class:`gwin.likelihood.TestNormal`. To see the list of available likelihood classes run ``gwin --help``; any choice for ``--likelihood-evaluator`` that starts with ``test_`` is analytic. The other analytic distributions available are: :py:class:`gwin.likelihood.TestEggbox`, :py:class:`gwin.likelihood.TestRosenbrock`, and :py:class:`gwin.likelihood.TestVolcano`. As with ``test_normal``, the dimensionality of these test distributions is set by the number of ``variable_args`` in the configuration file. The ``test_volcano`` distribution must be two dimensional, but all of the other distributions can have any number of dimensions. The configuration file syntax for the other test distributions is the same as in this example. Indeed, with this configuration file one only needs to change the ``--likelihood-evaluator`` argument to try (2D versions of) the other distributions.
180
177
181
178
------------------------------
182
179
BBH software injection example
@@ -335,7 +332,7 @@ An example of generating an injection::
335
332
--taper-injection ${TAPER} \
336
333
--disable-spin
337
334
338
-
An example of running ``pycbc_inference`` to analyze the injection in fake data::
335
+
An example of running ``gwin`` to analyze the injection in fake data::
339
336
340
337
# injection parameters
341
338
TRIGGER_TIME=1126259462.0
@@ -371,9 +368,9 @@ An example of running ``pycbc_inference`` to analyze the injection in fake data:
371
368
# specifies the number of threads for OpenMP
372
369
# Running with OMP_NUM_THREADS=1 stops lalsimulation
373
370
# to spawn multiple jobs that would otherwise be used
374
-
# by pycbc_inference and cause a reduced runtime.
371
+
# by gwin and cause a reduced runtime.
375
372
OMP_NUM_THREADS=1 \
376
-
pycbc_inference --verbose \
373
+
gwin --verbose \
377
374
--seed 12 \
378
375
--instruments ${IFOS} \
379
376
--gps-start-time ${GPS_START_TIME} \
@@ -490,9 +487,9 @@ Now run::
490
487
# specifies the number of threads for OpenMP
491
488
# Running with OMP_NUM_THREADS=1 stops lalsimulation
492
489
# to spawn multiple jobs that would otherwise be used
The executable ``pycbc_inference`` will write a HDF file with all the samples from each walker along with the PSDs and some meta-data about the sampler.
533
-
There is a handler class ``pycbc.io.InferenceFile`` that extends ``h5py.File``.
534
-
To read the output file you can do::
535
-
536
-
from pycbc.io import InferenceFile
537
-
fp = InferenceFile("cbc_example-n1e4.hdf", "r")
538
-
539
-
To get all samples for ``distance`` from the first walker you can do::
540
-
541
-
samples = fp.read_samples("distance", walkers=0)
542
-
print samples.distance
543
-
544
-
The function ``InferenceFile.read_samples`` includes the options to thin the samples.
545
-
By default the function will return samples beginning at the end of the burn-in to the last written sample, and will use the autocorrelation length (ACL) calculated by ``pycbc_inference`` to select the indepdedent samples.
546
-
You can supply ``thin_start``, ``thin_end``, and ``thin_interval`` to override this. To read all samples you would do::
Some standard parameters that are derived from the variable arguments (listed via ``fp.variable_args``) can also be retrieved. For example, if ``fp.variable_args`` includes ``mass1`` and ``mass2``, then you can retrieve the chirp mass with::
552
-
553
-
samples = fp.read_samples("mchirp")
554
-
print samples.mchirp
555
-
556
-
In this case, ``fp.read_samples`` will retrieve ``mass1`` and ``mass2`` (since they are needed to compute chirp mass); ``samples.mchirp`` then returns an array of the chirp mass computed from ``mass1`` and ``mass2``.
557
-
558
-
For more information, including the list of predefined derived parameters, see :py:class:`pycbc.io.InferenceFile`.
0 commit comments