AnalyseMCMC
Analyse gravitational-wave parameter-estimation results from SPINspiral and lalinference_mcmc
 All Classes Files Functions Variables Pages
Functions/Subroutines
analyseMCMC_functions.f90 File Reference

(AnalyseMCMC version 0.7.1, revision 448, hash 2f54722 (2013-11-19))

General routines and functions for analyseMCMC. More...

Functions/Subroutines

real(double) function lon2ra (lon, GPSsec)
 Compute right ascension (in radians) from longitude (radians) and GPS time (seconds) More...
 
real(double) function ra2lon (ra, GPSsec)
 Compute longitude (in radians) from right ascension (radians) and GPS time (seconds) More...
 
real(double) function gmst (GPSsec)
 Compute the 'Greenwich Mean Sidereal Time' (in radians) from GPS time (in seconds) More...
 
subroutine savgol (c, np, nl, nr, ld, m)
 Uses lubksb,ludcmp. More...
 
subroutine lubksb (a, n, np, indx, b)
 
subroutine ludcmp (a, n, np, indx, d)
 
real(double) function drev2pi (x)
 Returns angle in radians between 0 and 2pi (double precision) More...
 
real function revper (x, per)
 Returns periodic value x between 0 and per. More...
 
real function revpipi (x)
 Returns angle in radians between -pi and pi. More...
 
real function rev360 (x)
 Returns angle in degrees between 0 and 360. More...
 
real function rev180 (x)
 Returns angle in degrees between 0 and 180. More...
 
real function rev24 (x)
 Returns angle in hours between 0 and 24. More...
 
real function rev2pi (x)
 Returns angle in radians between 0 and 2pi. More...
 
real(double) function drevpi (x)
 Returns angle in radians between 0 and pi - double. More...
 
real function rrevpi (x)
 Returns angle in radians between 0 and pi - real. More...
 
character function, dimension(8) tms (a1)
 Print angle as mm:ss.s string, input in hours. More...
 
integer function getos ()
 Determine the operating system type: 1-Linux, 2-MacOSX. More...
 
real(double) function timestamp ()
 Get time stamp in seconds since 1970-01-01 00:00:00 UTC, mod countmax. More...
 
subroutine lbr2vec (l, b, r, vec)
 Transforms longitude l, latitude b and radius r into a vector with length r. Use r=1 for a unit vector. More...
 
real(double) function veclen (vec)
 Compute the length of a 3D cartesian vector. More...
 
subroutine normvec (vec)
 Create a unit vector from a 3D cartesian vector. More...
 
subroutine mc_q_2_m1_m2 (mc, q, m1, m2)
 Convert chirp mass and q to m1 and m2 - double precision. More...
 
subroutine mc_q_2_m1_m2r (mcr, qr, m1r, m2r)
 Convert chirp mass and eta to m1 and m2 - single precision. More...
 
real(double) function eta2q (eta)
 Convert symmetric mass ratio eta to asymmetric mass ratio q (0 - 1) More...
 
real function eta2qr (eta)
 Convert symmetric mass ratio eta to asymmetric mass ratio q (0 - 1) More...
 
real(double) function q2eta (q)
 Convert asymmetric mass ratio q (0 - 1) to symmetric mass ratio eta (0 - 0.25) More...
 
real function q2etar (q)
 Convert asymmetric mass ratio q (0 - 1) to symmetric mass ratio eta (0 - 0.25) More...
 
subroutine mc_eta_2_m1_m2 (mc, eta, m1, m2)
 Convert chirp mass and eta to m1 and m2 - double precision. More...
 
subroutine mc_eta_2_m1_m2r (mcr, etar, m1r, m2r)
 Convert chirp mass and eta to m1 and m2 - single precision. More...
 
real(double) function m1m2_2_mc (m1, m2)
 Convert M1,M2 to Mchirp. More...
 
real function m1m2_2_mcr (m1, m2)
 Convert M1,M2 to Mchirp - single precision. More...
 
subroutine m1_m2_2_mc_eta (m1, m2, mc, eta)
 Convert M1,M2 to Mchirp, eta (double precision) More...
 
subroutine m1_m2_2_mc_etar (m1r, m2r, mcr, etar)
 Convert M1,M2 to Mchirp, eta (single precision) More...
 
subroutine ang2vec (l, b, vec)
 Convert longitude, latitude (rad) to a 3D unit vector. More...
 
subroutine vec2ang (vec, l, b)
 Convert a 3D vector to longitude, latitude (rad) More...
 
real(double) function dotproduct (vec1, vec2)
 Compute the dot product of two 3D cartesian vectors. More...
 
subroutine crossproduct (vec1, vec2, crpr)
 Compute the cross (outer) product of two cartesian vectors. More...
 
real(double) function polangle (p, o)
 Compute the polarisation angle of a source with position unit vector p and orientation normal vector o. More...
 
real(double) function posangle (p, o)
 Compute the position angle of a source with position unit vector p and orientation unit vector o. More...
 
subroutine compute_incli_polang (pl, pb, ol, ob, i, psi)
 Compute the inclination and polarisation angle for a source with position (pl,pb) and orientation (ol,ob) More...
 
subroutine compute_incli_polangr (plr, pbr, olr, obr, ir, psir)
 Compute the inclination and polarisation angle for a source with position (pl,pb) and orientation (ol,ob) - single prec. More...
 
subroutine compute_incli_posang (pl, pb, ol, ob, i, pa)
 Compute the inclination and position angle for a source with position (pl,pb) and orientation (ol,ob) More...
 
subroutine detectorvector (d1, d2, jd)
 Determine the sky position pointed at by the vector that connects two detectors. More...
 
subroutine findfiles (match, nff, all, fnames, nf)
 Find files in the current working directory. More...
 
subroutine compbitmapsize (bmpXSz, bmpYSz, scFac, bmpsz, bmprat)
 Compute the size needed for PGPlot to get the desired bitmap size in pixels. More...
 
subroutine print_rundata (op)
 Print a single output line to specify when and were AnalyseMCMC was run. More...
 
subroutine create_html_index_file ()
 Setup a index.html file for output. More...
 
subroutine create_html_2dpdf_file (op)
 Setup the 2dpdf.html file for output. More...
 
subroutine report_undefined_parameter (parName, parID, routine)
 Report an undefined parameter that the code tries to use. More...
 

Detailed Description

General routines and functions for analyseMCMC.

Function/Subroutine Documentation

real(double) function lon2ra ( real(double), intent(in)  lon,
real(double), intent(in)  GPSsec 
)

Compute right ascension (in radians) from longitude (radians) and GPS time (seconds)

Parameters
lonLongitude
GPSsecGPS time in seconds
  • Declination == latitude for equatorial coordinates

References gmst().

real(double) function ra2lon ( real(double), intent(in)  ra,
real(double), intent(in)  GPSsec 
)

Compute longitude (in radians) from right ascension (radians) and GPS time (seconds)

Parameters
raRight Ascension
GPSsecGPS time in seconds
  • Declination == latitude for equatorial coordinates.

References gmst().

real(double) function gmst ( real(double), intent(in)  GPSsec)

Compute the 'Greenwich Mean Sidereal Time' (in radians) from GPS time (in seconds)

Parameters
GPSsecGPS time in seconds
See Also
K.R. Lang (1999), p.80sqq.

Referenced by lon2ra(), mcmcruninfo(), and ra2lon().

subroutine savgol ( real, dimension(np), intent(out)  c,
integer, intent(in)  np,
integer, intent(in)  nl,
integer, intent(in)  nr,
integer, intent(in)  ld,
integer, intent(in)  m 
)

Uses lubksb,ludcmp.

References lubksb(), and ludcmp().

Referenced by smoothpdf1d().

subroutine lubksb ( real, dimension(np,np), intent(in)  a,
integer, intent(in)  n,
integer, intent(in)  np,
integer, dimension(n), intent(in)  indx,
real, dimension(n), intent(out)  b 
)

Referenced by savgol().

subroutine ludcmp ( real, dimension(np,np), intent(inout)  a,
integer, intent(in)  n,
integer, intent(in)  np,
integer, dimension(n), intent(out)  indx,
real, intent(out)  d 
)

Referenced by savgol().

real(double) function drev2pi ( real(double), intent(in)  x)

Returns angle in radians between 0 and 2pi (double precision)

Parameters
xAngle (rad)

Referenced by plotthesky().

real function revper ( real, intent(in)  x,
real, intent(in)  per 
)

Returns periodic value x between 0 and per.

Parameters
xInput value
perPeriod of cycle

Referenced by statistics().

real function revpipi ( real, intent(in)  x)

Returns angle in radians between -pi and pi.

Parameters
xAngle (rad)
real function rev360 ( real, intent(in)  x)

Returns angle in degrees between 0 and 360.

Parameters
xAngle (deg)

Referenced by pdfs1d(), plot_par_l(), and plot_parameter_chains().

real function rev180 ( real, intent(in)  x)

Returns angle in degrees between 0 and 180.

Parameters
xAngle (deg)

Referenced by pdfs1d(), plot_par_l(), and plot_parameter_chains().

real function rev24 ( real, intent(in)  x)

Returns angle in hours between 0 and 24.

Parameters
xAngle (hours)

Referenced by pdfs1d(), plot_par_l(), and plot_parameter_chains().

real function rev2pi ( real, intent(in)  x)

Returns angle in radians between 0 and 2pi.

Parameters
xAngle (rad)

Referenced by save_cbc_wiki_data().

real(double) function drevpi ( real(double), intent(in)  x)

Returns angle in radians between 0 and pi - double.

Parameters
xAngle (rad)

Referenced by compute_incli_polang().

real function rrevpi ( real, intent(in)  x)

Returns angle in radians between 0 and pi - real.

Parameters
xAngle (rad)

Referenced by save_cbc_wiki_data().

character function, dimension(8) tms ( real(double), intent(in)  a1)

Print angle as mm:ss.s string, input in hours.

a1 Angle (hours)

Referenced by animation().

integer function getos ( )

Determine the operating system type: 1-Linux, 2-MacOSX.

real(double) function timestamp ( )

Get time stamp in seconds since 1970-01-01 00:00:00 UTC, mod countmax.

Referenced by analysemcmc(), and animation().

subroutine lbr2vec ( real(double), intent(in)  l,
real(double), intent(in)  b,
real(double), intent(in)  r,
real(double), dimension(3), intent(out)  vec 
)

Transforms longitude l, latitude b and radius r into a vector with length r. Use r=1 for a unit vector.

Parameters
lLongitude (rad)
bLatitude (rad)
rRadius
Return values
vec3D vector with the same units as r
real(double) function veclen ( real(double), dimension(3), intent(in)  vec)

Compute the length of a 3D cartesian vector.

Parameters
vec3D vector

Referenced by normvec().

subroutine normvec ( real(double), dimension(3), intent(inout)  vec)

Create a unit vector from a 3D cartesian vector.

Parameters
vec3D vector (I/O)

References veclen().

Referenced by posangle(), and vec2ang().

subroutine mc_q_2_m1_m2 ( real(double), intent(in)  mc,
real(double), intent(in)  q,
real(double), intent(out)  m1,
real(double), intent(out)  m2 
)

Convert chirp mass and q to m1 and m2 - double precision.

Parameters
mcChirp mass (Mo)
qMass ratio q
Return values
m1M1 (Mo)
m2M2 (Mo)

Referenced by mc_q_2_m1_m2r().

subroutine mc_q_2_m1_m2r ( real, intent(in)  mcr,
real, intent(in)  qr,
real, intent(out)  m1r,
real, intent(out)  m2r 
)

Convert chirp mass and eta to m1 and m2 - single precision.

Parameters
mcrChirp mass (Mo)
qrMass ratio q
Return values
m1rM1 (Mo)
m2rM2 (Mo)

References mc_q_2_m1_m2().

Referenced by mcmcruninfo().

real(double) function eta2q ( real(double), intent(in)  eta)

Convert symmetric mass ratio eta to asymmetric mass ratio q (0 - 1)

Parameters
etaSymmetric mass ratio (0 - 0.25)
real function eta2qr ( real, intent(in)  eta)

Convert symmetric mass ratio eta to asymmetric mass ratio q (0 - 1)

Parameters
etaSymmetric mass ratio (0 - 0.25)

Referenced by mcmcruninfo().

real(double) function q2eta ( real(double), intent(in)  q)

Convert asymmetric mass ratio q (0 - 1) to symmetric mass ratio eta (0 - 0.25)

Parameters
qAsymmetric mass ratio (0 - 1)
real function q2etar ( real, intent(in)  q)

Convert asymmetric mass ratio q (0 - 1) to symmetric mass ratio eta (0 - 0.25)

Parameters
qAsymmetric mass ratio (0 - 1)
subroutine mc_eta_2_m1_m2 ( real(double), intent(in)  mc,
real(double), intent(in)  eta,
real(double), intent(out)  m1,
real(double), intent(out)  m2 
)

Convert chirp mass and eta to m1 and m2 - double precision.

Parameters
mcChirp mass (Mo)
etaEta
Return values
m1M1 (Mo)
m2M2 (Mo)

Referenced by mc_eta_2_m1_m2r().

subroutine mc_eta_2_m1_m2r ( real, intent(in)  mcr,
real, intent(in)  etar,
real, intent(out)  m1r,
real, intent(out)  m2r 
)

Convert chirp mass and eta to m1 and m2 - single precision.

Parameters
mcrChirp mass (Mo)
etarEta
Return values
m1rM1 (Mo)
m2rM2 (Mo)

References mc_eta_2_m1_m2().

real(double) function m1m2_2_mc ( real(double), intent(in)  m1,
real(double), intent(in)  m2 
)

Convert M1,M2 to Mchirp.

Parameters
m1M1 (Mo)
m2M2 (Mo)
Return values
mcChirp mass (Mo)
real function m1m2_2_mcr ( real, intent(in)  m1,
real, intent(in)  m2 
)

Convert M1,M2 to Mchirp - single precision.

Parameters
m1M1 (Mo)
m2M2 (Mo)
Return values
mcChirp mass (Mo)

Referenced by mcmcruninfo().

subroutine m1_m2_2_mc_eta ( real(double), intent(in)  m1,
real(double), intent(in)  m2,
real(double), intent(out)  mc,
real(double), intent(out)  eta 
)

Convert M1,M2 to Mchirp, eta (double precision)

Parameters
m1M1 (Mo)
m2M2 (Mo)
Return values
mcChirp mass (Mo)
etaEta

Referenced by m1_m2_2_mc_etar().

subroutine m1_m2_2_mc_etar ( real, intent(in)  m1r,
real, intent(in)  m2r,
real, intent(out)  mcr,
real, intent(out)  etar 
)

Convert M1,M2 to Mchirp, eta (single precision)

Parameters
m1rM1 (Mo)
m2rM2 (Mo)
Return values
mcrChirp mass (Mo)
etarEta

References m1_m2_2_mc_eta().

subroutine ang2vec ( real(double), intent(in)  l,
real(double), intent(in)  b,
real(double), dimension(3), intent(out)  vec 
)

Convert longitude, latitude (rad) to a 3D unit vector.

Parameters
lLongitude, in [0,2pi[
bLatitude, in [-pi,pi]
Return values
vec3D unit vector

Referenced by compute_incli_polang(), compute_incli_posang(), and detectorvector().

subroutine vec2ang ( real(double), dimension(3), intent(in)  vec,
real(double), intent(out)  l,
real(double), intent(out)  b 
)

Convert a 3D vector to longitude, latitude (rad)

Parameters
vec3D vector
Return values
lLongitude, in [0,2pi[
bLatitude, in [-pi,pi]

References normvec().

Referenced by detectorvector().

real(double) function dotproduct ( real(double), dimension(3), intent(in)  vec1,
real(double), dimension(3), intent(in)  vec2 
)

Compute the dot product of two 3D cartesian vectors.

Parameters
vec13D vector 1
vec23D vector 2

Referenced by compute_incli_polang(), compute_incli_posang(), polangle(), and posangle().

subroutine crossproduct ( real(double), dimension(3), intent(in)  vec1,
real(double), dimension(3), intent(in)  vec2,
real(double), dimension(3), intent(out)  crpr 
)

Compute the cross (outer) product of two cartesian vectors.

Parameters
vec13D vector 1
vec23D vector 2
Return values
crprCross/outer product (vec1 x vec2)

Referenced by polangle(), and posangle().

real(double) function polangle ( real(double), dimension(3), intent(in)  p,
real(double), dimension(3), intent(in)  o 
)

Compute the polarisation angle of a source with position unit vector p and orientation normal vector o.

Parameters
p3D position unit vector
o3D orientation unit vector
See Also
Apostolatos et al. 1994, Eq.5

References crossproduct(), and dotproduct().

Referenced by compute_incli_polang().

real(double) function posangle ( real(double), dimension(3), intent(in)  p,
real(double), dimension(3), intent(in)  o 
)

Compute the position angle of a source with position unit vector p and orientation unit vector o.

Parameters
p3D position unit vector
o3D orientation unit vector

References crossproduct(), dotproduct(), and normvec().

Referenced by compute_incli_posang().

subroutine compute_incli_polang ( real(double), intent(in)  pl,
real(double), intent(in)  pb,
real(double), intent(in)  ol,
real(double), intent(in)  ob,
real(double), intent(out)  i,
real(double), intent(out)  psi 
)

Compute the inclination and polarisation angle for a source with position (pl,pb) and orientation (ol,ob)

Parameters
plPosition: longtitude, in [0,2pi[ (rad)
pbPosition: latitude, in [0,pi] (rad)
olOrientation: longtitude, in [0,2pi[ (rad)
obOrientation: latitude, in [0,pi] (rad)
Return values
iInclination angle (rad)
psiPolarisation angle (rad)
Note
  • all variables are angles (no cos, sin)
  • pb,ob used to be in ([-pi/2,pi/2]) now [0,pi], conf John V. & Christian R.

References ang2vec(), dotproduct(), drevpi(), and polangle().

Referenced by compute_incli_polangr().

subroutine compute_incli_polangr ( real, intent(in)  plr,
real, intent(in)  pbr,
real, intent(in)  olr,
real, intent(in)  obr,
real, intent(out)  ir,
real, intent(out)  psir 
)

Compute the inclination and polarisation angle for a source with position (pl,pb) and orientation (ol,ob) - single prec.

Parameters
plrPosition: longtitude, in [0,2pi[ (rad)
pbrPosition: latitude, in [0,pi] (rad)
olrOrientation: longtitude, in [0,2pi[ (rad)
obrOrientation: latitude, in [0,pi] (rad)
Return values
irInclination angle (rad)
psirPolarisation angle (rad)
Note

References compute_incli_polang().

Referenced by mcmcruninfo().

subroutine compute_incli_posang ( real(double), intent(in)  pl,
real(double), intent(in)  pb,
real(double), intent(in)  ol,
real(double), intent(in)  ob,
real(double), intent(out)  i,
real(double), intent(out)  pa 
)

Compute the inclination and position angle for a source with position (pl,pb) and orientation (ol,ob)

Parameters
plPosition: longtitude, in [0,2pi[ (rad)
pbPosition: latitude, in (rad)
olOrientation: longtitude, in [0,2pi[ (rad)
obOrientation: latitude, in (rad)
Return values
iInclination angle (rad)
paPolarisation angle (rad)
Note
Position angle, not polarisation angle!

References ang2vec(), dotproduct(), and posangle().

subroutine detectorvector ( integer, intent(in)  d1,
integer, intent(in)  d2,
real(double), intent(inout)  jd 
)

Determine the sky position pointed at by the vector that connects two detectors.

Parameters
d1ID Detector 1
d2ID Detector 2
jdJulian day
Todo:
Finish and use

References ang2vec(), and vec2ang().

subroutine findfiles ( character, dimension(*), intent(in)  match,
integer, intent(in)  nff,
integer, intent(in)  all,
character, dimension(99), intent(out)  fnames,
integer, intent(out)  nf 
)

Find files in the current working directory.

Parameters
matchSearch string to match
nffMaximum number of files to return
allAll files? 0-select manually from list, 1-always return all files in list
Return values
fnamesArray that contains the files found; make sure it has the same length as the array in the calling programme
nfThe actual number of files returned in fnames ( = min(number found, nff))

Referenced by analysemcmc().

subroutine compbitmapsize ( integer, intent(in)  bmpXSz,
integer, intent(in)  bmpYSz,
real, intent(in)  scFac,
real, intent(out)  bmpsz,
real, intent(out)  bmprat 
)

Compute the size needed for PGPlot to get the desired bitmap size in pixels.

Parameters
bmpXSzDesired x-size in pixels
bmpYSzDesired y-size in pixels
scFacScale factor; produce a larger bitmap, the shrink to get smoother graphics
Return values
bmpszSize of the bitmap (x)
bmpratAspect ration of the bitmap

Referenced by analysemcmc(), pdfs2d(), and removeppm_createthumbnails_createhtml_2d_pdf().

subroutine print_rundata ( integer, intent(in)  op)

Print a single output line to specify when and were AnalyseMCMC was run.

Parameters
opOutput unit

Referenced by analysemcmc(), and removeppm_createthumbnails_createhtml_2d_pdf().

subroutine create_html_index_file ( )

Setup a index.html file for output.

Referenced by analysemcmc().

subroutine create_html_2dpdf_file ( integer, intent(in)  op)

Setup the 2dpdf.html file for output.

Referenced by pdfs2d().

subroutine report_undefined_parameter ( character, dimension(*), intent(in)  parName,
integer, intent(in)  parID,
character, dimension(*), intent(in)  routine 
)

Report an undefined parameter that the code tries to use.

Parameters
parNameName of the undefined parameter
parIDID of the undefined parameter
routineName of the caller routine

Referenced by pdfs1d(), pdfs2d(), plot_acorr_chains(), plot_jump_sizes(), plot_par_l(), and plot_parameter_chains().