Commit 653149ea authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Update to examples and adds new macros

parent f2379bbd
...@@ -59,3 +59,18 @@ mcmc = pyfstat.MCMCSearch( ...@@ -59,3 +59,18 @@ mcmc = pyfstat.MCMCSearch(
mcmc.run(context='paper', subtractions=[30, -1e-10]) mcmc.run(context='paper', subtractions=[30, -1e-10])
mcmc.plot_corner(add_prior=True) mcmc.plot_corner(add_prior=True)
mcmc.print_summary() mcmc.print_summary()
from latex_macro_generator import write_to_macro
write_to_macro('BasicExampleF0', '{:1.0f}'.format(F0), '../macros.tex')
write_to_macro('BasicExampleF1', F1, '../macros.tex')
write_to_macro('BasicExampleh0', h0, '../macros.tex')
write_to_macro('BasicExampleSqrtSn', sqrtSX, '../macros.tex')
write_to_macro('BasicExampleDepth', depth, '../macros.tex')
write_to_macro('BasicExampleDeltaF0', DeltaF0, '../macros.tex')
write_to_macro('BasicExampleDeltaF1', DeltaF1, '../macros.tex')
write_to_macro('BasicExampleVF0', VF0, '../macros.tex')
write_to_macro('BasicExampleVF1', VF1, '../macros.tex')
write_to_macro('BasicExampleV', VF0*VF1, '../macros.tex')
write_to_macro('BasicExamplenburn', nsteps[0], '../macros.tex')
write_to_macro('BasicExamplenprod', nsteps[1], '../macros.tex')
...@@ -16,7 +16,7 @@ data_tstart = tstart - duration ...@@ -16,7 +16,7 @@ data_tstart = tstart - duration
data_tend = data_tstart + 3*duration data_tend = data_tstart + 3*duration
tref = .5*(data_tstart+data_tend) tref = .5*(data_tstart+data_tend)
h0 = 1e-23 h0 = 5e-24
sqrtSX = 1e-22 sqrtSX = 1e-22
transient = pyfstat.Writer( transient = pyfstat.Writer(
...@@ -26,9 +26,7 @@ transient = pyfstat.Writer( ...@@ -26,9 +26,7 @@ transient = pyfstat.Writer(
transient.make_data() transient.make_data()
print transient.predict_fstat() print transient.predict_fstat()
DeltaF0 = 1e-7
DeltaF0 = 6e-7
DeltaF1 = 1e-13 DeltaF1 = 1e-13
VF0 = (np.pi * duration * DeltaF0)**2 / 3.0 VF0 = (np.pi * duration * DeltaF0)**2 / 3.0
VF1 = (np.pi * duration**2 * DeltaF1)**2 * 4/45. VF1 = (np.pi * duration**2 * DeltaF1)**2 * 4/45.
...@@ -48,7 +46,7 @@ theta_prior = {'F0': {'type': 'unif', ...@@ -48,7 +46,7 @@ theta_prior = {'F0': {'type': 'unif',
ntemps = 3 ntemps = 3
log10temperature_min = -1 log10temperature_min = -1
nwalkers = 100 nwalkers = 100
nsteps = [750, 250] nsteps = [100, 100]
mcmc = pyfstat.MCMCSearch( mcmc = pyfstat.MCMCSearch(
label='transient_search_initial_stage', outdir='data', label='transient_search_initial_stage', outdir='data',
......
\def\DirectedMCNoiseOnlyMaximum{52.4}
\def\DirectedMCNoiseN{10000}
\def\AllSkyMCNoiseOnlyMaximum{59.8}
\def\AllSkyMCNoiseN{10000} \def\AllSkyMCNoiseN{10000}
\def\AllSkyMCNoiseOnlyMaximum{59.8}
\def\BasicExampleDeltaFone{1.0{\times}10^{-13}}
\def\BasicExampleDeltaFzero{1.0{\times}10^{-7}}
\def\BasicExampleDepth{10.0}
\def\BasicExampleFone{-1.0{\times}10^{-10}}
\def\BasicExampleFzero{30}
\def\BasicExampleSqrtSn{1.0{\times}10^{-23}}
\def\BasicExampleV{120.0}
\def\BasicExampleVFone{49.0}
\def\BasicExampleVFzero{2.5}
\def\BasicExamplehzero{1.0{\times}10^{-24}}
\def\BasicExamplenburn{50.0}
\def\BasicExamplenprod{50.0}
\def\DirectedMCNoiseN{10000}
\def\DirectedMCNoiseOnlyMaximum{52.4}
...@@ -672,11 +672,12 @@ metric-mismatch of unity.} ...@@ -672,11 +672,12 @@ metric-mismatch of unity.}
In order to familiarise the reader with the features of an MCMC search, we will In order to familiarise the reader with the features of an MCMC search, we will
now describe a simple directed search (over $f$ and $\dot{f}$) for a simulated now describe a simple directed search (over $f$ and $\dot{f}$) for a simulated
signal in Gaussian noise. The signal will have a frequency of $30$~Hz and a signal in Gaussian noise. The signal will have a frequency of
spin-down of $-1{\times}10^{-10}$~Hz/s, all other Doppler parameters are $\BasicExampleFzero$~Hz and a spin-down of $\BasicExampleFone$~Hz/s, all other
`known' and so are irrelevant. Moreover, the signal has an amplitude Doppler parameters are known and so are irrelevant. Moreover, the signal has an
$h_0=10^{-24}$~Hz$^{-1/2}$ while the Gaussian noise has amplitude $\BasicExamplehzero$~Hz$^{-1/2}$ while the Gaussian noise has
$\Sn=10^{-23}$~Hz$^{-1/2}$ such that the signal has a depth of 10. $\sqrt{\Sn}=\BasicExampleSqrtSn$~Hz$^{-1/2}$ such that the signal has a depth
of $\BasicExampleDepth$.
First, we must define a prior for each search parameter Typically, we recommend First, we must define a prior for each search parameter Typically, we recommend
either a uniform prior bounding the area of interest, or a normal distribution either a uniform prior bounding the area of interest, or a normal distribution
...@@ -684,23 +685,23 @@ centered on the target and with some well defined width. However, to ensure ...@@ -684,23 +685,23 @@ centered on the target and with some well defined width. However, to ensure
that the MCMC simulation has a reasonable chance at finding a peak, one should that the MCMC simulation has a reasonable chance at finding a peak, one should
consider the corresponding metric-volume given in consider the corresponding metric-volume given in
Equation~\eqref{eqn_metric_volume}. For this example, we will use a uniform Equation~\eqref{eqn_metric_volume}. For this example, we will use a uniform
prior with a frequency range of $\Delta f = 10^{-7}$~Hz and a spin-down range prior with a frequency range of $\Delta f=\BasicExampleDeltaFzero$~Hz and a
of $\Delta \fdot=10^{-13}$~Hz/s both centered on the simulated signal frequency spin-down range of $\Delta \fdot=\BasicExampleDeltaFone$~Hz/s both centered on
and spin-down rate. We set the reference time to coincide with the middle of the simulated signal frequency and spin-down rate. We set the reference time to
the data span, therefore the metric volume can be decomposed into the frequency coincide with the middle of the data span, therefore the metric volume can be
contribution and spin-down contribution: decomposed into the frequency contribution and spin-down contribution:
frequency, frequency,
\begin{align} \begin{align}
\Vpe^{(0)} = \frac{(\pi\Tcoh\Delta f)^2}{3} \approx 2.46 \Vpe^{(0)} = \frac{(\pi\Tcoh\Delta f)^2}{3} \approx \BasicExampleVFzero
\end{align} \end{align}
and and
\begin{align} \begin{align}
\Vpe^{(1)} = \frac{4(\pi\Delta \fdot)^2\Tcoh^{4}}{45} \approx 48.9 \Vpe^{(1)} = \frac{4(\pi\Delta \fdot)^2\Tcoh^{4}}{45} \approx \BasicExampleVFone
\end{align} \end{align}
such that $\V\approx120$ (note that $\Vsky$ does not contribute since we do such that $\V\approx\BasicExampleV$ (note that $\Vsky$ does not contribute
not search over the sky parameters). This metric volume indicates that the since we do not search over the sky parameters). This metric volume indicates
signal will occupy about 1\% of the prior volume, therefore the MCMC is that the signal will occupy about 1\% of the prior volume, therefore the MCMC
expected to work. Alternative priors will need careful thought about how to is expected to work. Alternative priors will need careful thought about how to
translate them into a metric volume: for example using a Gaussian one could use translate them into a metric volume: for example using a Gaussian one could use
the standard deviation as a proxy for the allowed search region. the standard deviation as a proxy for the allowed search region.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment