Commit aa575244 authored by Duncan Macleod's avatar Duncan Macleod

Merge branch 'remove_deprecated_pulsar_codes' into 'master'

Remove deprecated LALApps pulsar codes

See merge request lscsoft/lalsuite!1197
parents 34985b91 50a79f4a
......@@ -156,7 +156,6 @@ test:
- lalapps_power_plot_burst --help
- lalapps_power_veto --help
- lalapps_pulsar_frequency_evolution --help
- lalapps_pulsar_parameter_estimation --help
- lalapps_pulsar_parameter_estimation_nested --help
- lalapps_randombank --help
- lalapps_run_sqlite --help
......
......@@ -10,7 +10,6 @@ include $(top_srcdir)/gnuscripts/lalsuite_help2man.am
if LALFRAME
frame_progs = \
lalapps_heterodyne_pulsar \
lalapps_pulsar_parameter_estimation \
lalapps_create_pulsar_signal_frame \
lalapps_SplInter
......@@ -37,10 +36,6 @@ lalapps_heterodyne_pulsar_SOURCES = \
heterodyne_pulsar.c \
heterodyne_pulsar.h
lalapps_pulsar_parameter_estimation_SOURCES = \
pulsar_parameter_estimation.c \
pulsar_parameter_estimation.h
lalapps_pulsar_parameter_estimation_nested_SOURCES = \
ppe_models.c \
ppe_models.h \
......
; configuration file for the time domain pulsar heterodyne code
; Matt Pitkin 30/03/06
[exec]
heterodyne = /archive/home/matthew/lscsoft/lalapps/src/pulsar/TDS_isolated/lalapps_heterodyne_pulsar
[datafind]
server = ldas.ligo-wa.caltech.edu
type = RDS_R_L3
[condor]
universe = standard
datafind = /opt/lscsoft/glue/bin/LSCdataFind
[data]
pulsar_param_dir = /archive/home/matthew/analyses/test/pulsars/injections
pulsar_update_dir =
seg_list =
data_cache =
[ephem]
path = /archive/home/matthew/lscsoft/lal/packages/pulsar/test
[input]
starttime = 793130413
endtime = 795679213
detector = H1
filter_knee = 1.5
sample_rate = 16384
resample_rate = 1
channel = H1:LSC-AS_Q
stddev_thresh =
freq_factor = 2.0
high_pass =
scale_fac =
[fine]
fine_input = /archive/home/matthew/analyses/test/coarse
[calibration]
response_file =
coefficient_file =
open_loop_gain =
sensing_function =
[output]
output_path = /archive/home/matthew/analyses/test/coarse
#!/usr/bin/python
"""
script to run the pulsar parameter estimation code many times by generating
fake noise, choosing a pulsar at random to use, generating condor_submit
files and running the code in grid-based, 4-parameter MCMC, and
multi-parameter MCMC modes
"""
from __future__ import print_function
# import required modules
import sys
import os
import re
import random
import math
count = 1000
i = 0
# get a list of the pulsars in the par file directory
parlist = os.listdir('/home/matthew/analyses/S5/pulsars/fine')
parlist.sort()
covlist = os.listdir('/home/matthew/analyses/S5/pulsars/covariance')
covlist.sort()
# set default values
iterations = 200000
burnin = 200000
temperature = 0.001
det = 'H1'
begin = 815184013 # start time of S5
end = 877824013 # end time of S5
numsteps = 1440
dt = 60 # interval between point in the fake fine heterodyne file
stddev = 1 # standard deviation of the fake data
# set random seed
random.seed()
# create three condor submit files - one for grid-based mode, one for 4
# parameter MCMC mode and on for multi-parameter MCMC mode
# subfiles
try:
f1 = open('/home/matthew/test/grid_based.sub', 'w')
f2 = open('/home/matthew/test/mcmc_four.sub', 'w')
f3 = open('/home/matthew/test/mcmc_multi.sub', 'w')
except Exception as e:
print("Can't open subfiles!", file=sys.stderr)
sys.exit(1)
univ = 'universe = standard\n'
f1.write(univ)
f2.write(univ)
f3.write(univ)
execu = 'executable = \
/home/matthew/lscsoft/lalapps/src/pulsar/TDS_isolated/\
lalapps_pulsar_parameter_estimation\n'
f1.write(execu)
f2.write(execu)
f3.write(execu)
noti = 'notification = never\n'
f1.write(noti)
f2.write(noti)
f3.write(noti)
log = 'log = /local/matthew/logs/param_sim.dag.log\n'
f1.write(log)
f2.write(log)
f3.write(log)
err = 'error = /local/matthew/logs/param_sim-$(cluster).err\n'
f1.write(err)
f2.write(err)
f3.write(err)
out = 'output = /local/matthew/logs/param_sim-$(cluster).out\n'
f1.write(out)
f2.write(out)
f3.write(out)
args1 = 'arguments = --pulsar $(macropulsar) --detectors %s --par-file \
$(macropar) --input-dir /home/matthew/test --output-dir $(macroout) --maxh0 0'\
% det
f1.write(args1)
args2 = args1 + ' --mcmc --iterations %d --burn-in %d --temperature %f \
--h0-width 0' % (iterations, burnin, temperature)
f2.write(args2)
args3 = args2 + ' --earth-ephem \
/home/matthew/lscsoft/lal/packages/pulsar/test/earth05-09-DE405.dat --sun-ephem\
/home/matthew/lscsoft/lal/packages/pulsar/test/sun05-09-DE405.dat --covariance\
$(macrocov)'
f3.write(args3)
f1.write('\n')
f2.write('\n')
f3.write('\n')
queue = 'queue 1\n'
f1.write(queue)
f2.write(queue)
f3.write(queue)
f1.close()
f2.close()
f3.close()
# open dag file
fdag = open('/home/matthew/test/parameter_estimation_sim.dag', 'w')
while i < count:
# create a fake pulsar name (leave RA part as 0000 and increment through dec)
psr = 'J0000+' + '%04d' % i
# generate a start time for the fake data
start = math.floor(begin + (end-begin)*random.random())
finefile = '/home/matthew/test/dataH1/finehet_%s_%s' % (psr, det)
try:
# open file for output
f = open(finefile, 'w')
except Exception as e:
print("Can't open file %s!" % finefile, file=sys.stderr)
sys.exit(1)
# generate real and imaginary noise and output to file
j = 0
while j < numsteps:
finedat = str(start+dt*j) + ' ' + str(random.gauss(0, stddev)) + ' ' +\
str(random.gauss(0, stddev)) + '\n'
f.write(finedat)
j += 1
f.close()
# pick a pulsar at random from parlist to use as parameters
numpars = len(parlist)
parname = parlist[int(math.floor(numpars*random.random()))]
parfile = '/home/matthew/analyses/S5/pulsars/fine/' + parname
# check whether theres a covariance file for that pulsar
# get .mat files associated with .par file
matfile = None
tempmatfile = re.sub(r'\.par',r'',parname) + '.mat'
k = 0
while k < len(covlist):
if tempmatfile in covlist[k]:
matfile = '/home/matthew/analyses/S5/pulsars/covariance/' + tempmatfile
break
k += 1
if matfile == None:
continue
# write jobs to dag
outfile = '/home/matthew/test/output'
job1 = 'JOB %d grid_based.sub\nRETRY %d 0\nVARS %d ' % ((3*i+1), (3*i+1),\
(3*i+1))
vars1 = 'macropulsar=\"%s\" macropar=\"%s\" macroout=\"%s\"\n' % (psr,\
parfile, outfile)
fdag.write(job1+vars1)
job2 = 'JOB %d mcmc_four.sub\nRETRY %d 0\nVARS %d ' % ((3*i+2), (3*i+2),\
(3*i+2))
fdag.write(job2+vars1)
outfile = '/home/matthew/test/output_mcmc'
job3 = 'JOB %d mcmc_multi.sub\nRETRY %d 0\nVARS %d ' % ((3*i+3), (3*i+3),\
(3*i+3))
vars3 = 'macropulsar=\"%s\" macropar=\"%s\" macrocov=\"%s\" \
macroout=\"%s\"\n' % (psr, parfile, matfile, outfile)
fdag.write(job3+vars3)
i += 1
fdag.close()
sys.exit(0)
; configuration file for the time domain pulsar parameter estimation code
; Matt Pitkin 07/03/08
[exec]
parameter =/archive/home/matthew/lscsoft/lalapps/src/pulsar/TDS_isolated/lalapps_pulsar_parameter_estimation
[condor]
universe = standard
[data]
pulsar_param_dir = /archive/home/matthew/analyses/test/pulsars/injections
input_dir = /archive/home/matthew/analyses/S5/fine
[input]
detectors = "H1 H2 L1"
minh0 = 0
maxh0 = 0
h0steps = 100
minphi0 =
maxphi0 =
phi0steps = 10
minpsi =
maxpsi =
psisteps = 10
minci =
maxci =
cisteps = 10
dob_ul = 95.0
psibins =
timebins =
[mcmc]
iterations = 100000
burn_in = 10000
temperature = 0.001
output_rate = 1
cov_dir =
ephem_path =
[output]
output_path = /archive/home/matthew/analyses/S5/results
"""
Classes needed for the time domain pulsar parameter estimation pipeline.
This has been greatly inspired (well blatently hacked together from) the stochastic pipeline by
Adam Mercer and the frequency domain binary pulsar search by Chris Messenger.
Matt Pitkin 07/03/08
"""
__author__ = 'Matt Pitkin <matthew@astro.gla.ac.uk>'
__date__ = '$Date$'
__version__ = '$Revision$'
from glue import pipeline
# And begin ...
class parameterJob(pipeline.CondorDAGJob, pipeline.AnalysisJob):
"""
A lalapps_heterodyne_pulsar job to coarse heterodyne the data.
"""
def __init__(self,cp):
# cp = ConfigParser object from which options are read.
self.__executable = cp.get('exec', 'parameter')#gets the executable from.ini
self.__universe = cp.get('condor', 'universe')
pipeline.CondorDAGJob.__init__(self, self.__universe, self.__executable)
pipeline.AnalysisJob.__init__(self, cp)
# set log files for job
self.set_stdout_file('logs/pulsar_parameter_estimation-$(cluster).out')
self.set_stderr_file('logs/pulsar_parameter_estimation-$(cluster).err')
self.set_sub_file('pulsar_parameter_estimation.sub')
class parameterNode(pipeline.CondorDAGNode, pipeline.AnalysisNode):
"""
A heterodyneNode runs an instance of lalapps_heterodyne_pulsar in coarse heterodyne mode in
a condor DAG.
"""
def __init__(self,job):
"""
job = A CondorDAGJob that can run an instance of lalapps_CalculateSensitivity.
"""
pipeline.CondorDAGNode.__init__(self,job)
pipeline.AnalysisNode.__init__(self)
# initilise job variables
self.__detectors = None
self.__param_file = None
self.__output_dir = None
self.__pulsar = None
self.__input_dir = None
self.__maxh0 = None
self.__minh0 = None
self.__h0steps = None
self.__maxphi0 = None
self.__minphi0 = None
self.__phi0steps = None
self.__maxci = None
self.__minci = None
self.__cisteps = None
self.__maxpsi = None
self.__minpsi = None
self.__psisteps = None
self.__iterations = None
self.__burnin = None
self.__temperature = None
self.__outputrate = None
self.__earthephem = None
self.__sunephem = None
self.__timeephem = None
self.__covfile = None
self.__ul = None
self.__h0prior = None
self.__phiprior = None
self.__psiprior = None
self.__iotaprior = None
self.__h0mean = None
self.__phimean = None
self.__psimean = None
self.__iotamean = None
self.__h0sig = None
self.__phisig = None
self.__psisig = None
self.__iotasig = None
self.__h0width = None
self.__phiwidth = None
self.__psiwidth = None
self.__ciwidth = None
self.__priorfile = None
def set_output_dir(self,output_dir):
# set output directory
self.add_var_opt('output-dir',output_dir)
self.__output_dir = output_dir
def set_priorfile(self,priorfile):
# set a file containing a h0 vs cos(iota) distribution to be used as a prior
self.add_var_opt('priorfile', priorfile)
self.__priorfile = priorfile
def set_detectors(self, detectors):
# set detectors
self.add_var_opt('detectors', detectors)
self.__detectors = detectors
def set_param_file(self, param_file):
# set pulsar parameter file
self.add_var_opt('par-file', param_file)
self.__param_file = param_file
def set_input_dir(self, input_dir):
# set the input directory
self.add_var_opt('input-dir', input_dir)
self.__input_dir = input_dir
def set_pulsar(self,pulsar):
# set pulsar name
self.add_var_opt('pulsar',pulsar)
self.__pulsar = pulsar
def set_ul(self,ul):
# set to output the upper limit
self.add_var_opt('dob-ul', ul) # no variable required
self.__ul = ul
def set_mcmc(self):
# set to perform posterior calculation via an MCMC
self.add_var_opt('mcmc', '')
def set_h0width(self,h0width):
# set width of h0 prior
self.add_var_opt('h0-width',h0width)
self.__h0width = h0width
def set_phiwidth(self,phiwidth):
# set width of phi0 prior
self.add_var_opt('phi0-width',phiwidth)
self.__phiwidth = phiwidth
def set_psiwidth(self,psiwidth):
# set width of psi prior
self.add_var_opt('psi-width',psiwidth)
self.__psiwidth = psiwidth
def set_ciwidth(self,ciwidth):
# set width of ci prior
self.add_var_opt('ci-width',ciwidth)
self.__ciwidth = ciwidth
def set_usepriors(self):
# set to use priors
self.add_var_opt('use-priors', '')
def set_h0prior(self,h0prior):
# set the h0 prior
self.add_var_opt('h0prior',h0prior)
self.__h0prior = h0prior
def set_phiprior(self,phiprior):
# set the phi0 prior
self.add_var_opt('phi0prior',phiprior)
self.__phiprior = phiprior
def set_psiprior(self,psiprior):
# set the psi prior
self.add_var_opt('psiprior',psiprior)
self.__psiprior = psiprior
def set_iotaprior(self,iotaprior):
# set the iota prior
self.add_var_opt('iotaprior',iotaprior)
self.__iotaprior = iotaprior
def set_h0mean(self,h0mean):
# set mean of h0 prior
self.add_var_opt('h0mean',h0mean)
self.__h0mean = h0mean
def set_phimean(self,phimean):
# set mean of phi0 prior
self.add_var_opt('phi0mean',phimean)
self.__phimean = phimean
def set_psimean(self,psimean):
# set mean of psi prior
self.add_var_opt('psimean',psimean)
self.__psimean = psimean
def set_iotamean(self,iotamean):
# set mean of iota prior
self.add_var_opt('iotamean',iotamean)
self.__iotamean = iotamean
def set_h0sig(self,h0sig):
# set sigma of h0 prior
self.add_var_opt('h0sig',h0sig)
self.__h0sig = h0sig
def set_phisig(self,phisig):
# set sigma of phi0 prior
self.add_var_opt('phi0sig',phisig)
self.__phisig = phisig
def set_psisig(self,psisig):
# set sigma of psi prior
self.add_var_opt('psisig',psisig)
self.__psisig = psisig
def set_iotasig(self,iotasig):
# set sigma of iota prior
self.add_var_opt('iotasig',iotasig)
self.__iotasig = iotasig
def set_covfile(self,covfile):
# set the covariance matrix file
self.add_var_opt('covariance',covfile)
self.__covfile = covfile
def set_usecov(self):
# set to use a covariance matrix for prior/proposal
self.add_var_opt('use-cov', '')
def set_verbose(self):
# set verbose flag
self.add_var_opt('verbose', '') # no variable required
def set_onlyjoint(self):
# only perform the joint posterior calculation for MCMC
self.add_var_opt('only-joint', '')
def set_maxh0(self, maxh0):
# set maximum h0 value in grid
self.add_var_opt('maxh0',maxh0)
self.__maxh0 = maxh0
def set_minh0(self, minh0):
# set minimum h0 value in grid
self.add_var_opt('minh0',minh0)
self.__minh0 = minh0
def set_h0steps(self, h0steps):
# set number of grid points in h0 grid
self.add_var_opt('h0steps',h0steps)
self.__h0steps = h0steps
def set_maxphi0(self, maxphi0):
# set maximum phi0 value in grid
self.add_var_opt('maxphi0',maxphi0)
self.__maxphi0 = maxphi0
def set_minphi0(self, minphi0):
# set minimum phi0 value in grid
self.add_var_opt('minphi0',minphi0)
self.__minphi0 = minphi0
def set_phi0steps(self, phi0steps):
# set number of grid points in phi0 grid
self.add_var_opt('phi0steps', phi0steps)
self.__phi0steps = phi0steps
def set_maxci(self, maxci):
# set maximum cos(iota) value in grid
self.add_var_opt('maxci',maxci)
self.__maxci = maxci
def set_minci(self, minci):
# set minimum cos(iota) value in grid
self.add_var_opt('minci',minci)
self.__minci = minci
def set_cisteps(self, cisteps):
# set number of grid points in cos(iota) grid
self.add_var_opt('cisteps', cisteps)
self.__cisteps = cisteps
def set_maxpsi(self, maxpsi):
# set maximum psi value in grid
self.add_var_opt('maxpsi',maxpsi)
self.__maxspi = maxspi
def set_minpsi(self, minpsi):
# set minimum psi value in grid
self.add_var_opt('minpsi',minpsi)
self.__minpsi = minpsi
def set_psisteps(self, psisteps):
# set number of grid points in psi grid
self.add_var_opt('psisteps', psisteps)
self.__psisteps = psisteps
def set_iterations(self, iterations):
# set the number of MCMC iterations
self.add_var_opt('iterations', iterations)
self.__iterations = iterations
def set_burnin(self, burnin):
# set the number of burn in iterations
self.add_var_opt('burn-in', burnin)
self.__burnin = burnin
def set_temperature(self, temperature):
# set the burn in temperature
self.add_var_opt('temperature', temperature)
self.__temperature = temperature
def set_outputrate(self, outputrate):
# set the MCMC output rate
self.add_var_opt('output-rate', outputrate)
self.__outputrate = outputrate
def set_earth(self, earthephem):
# set the earth ephemeris file
self.add_var_opt('earth-ephem', earthephem)
self.__earthephem = earthephem
def set_sun(self, sunephem):
# set the sun ephemeris file
self.add_var_opt('sun-ephem', sunephem)
self.__sunephem = sunephem
def set_ephem_time(self, timeephem):
# set the time correction ephemeris file
self.add_var_opt('time-ephem',timeephem)
self.__timeephem = timeephem
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