Commit bf5f951c authored by Adam Mercer's avatar Adam Mercer
Browse files

Merge branch 'lalinference-point-release' into 'o3-release'

Lalinference point release

See merge request !840
parents 9a9e0c1c 6fab02a2
Pipeline #68058 passed with stages
in 73 minutes and 15 seconds
AC_PREREQ([2.63])
AC_INIT([LALSuite],[6.57],[lal-discuss@ligo.org])
AC_INIT([LALSuite],[6.58],[lal-discuss@ligo.org])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_AUX_DIR([gnuscripts])
AC_CONFIG_MACRO_DIR([gnuscripts])
......
AC_PREREQ([2.63])
AC_INIT([LALInference],[1.11.0.1],[lal-discuss@ligo.org])
AC_INIT([LALInference],[1.11.1],[lal-discuss@ligo.org])
AC_CONFIG_HEADERS([src/config.h src/LALInferenceConfig.h])
AC_CONFIG_SRCDIR([src/LALInference.h])
AC_CONFIG_AUX_DIR([gnuscripts])
......@@ -83,9 +83,9 @@ LALSUITE_DISTCHECK_CONFIGURE_FLAGS
# then increment age.
# 6. if any interfaces have been removed since the last public release,
# then set age to 0.
AC_SUBST([LIBCURRENT],[17])
AC_SUBST([LIBCURRENT],[18])
AC_SUBST([LIBREVISION],[0])
AC_SUBST([LIBAGE],[0])
AC_SUBST([LIBAGE],[1])
AC_SUBST([LIBVERSION],[${LIBCURRENT}:${LIBREVISION}:${LIBAGE}])
# nightly build
......
lalinference (1.11.1-1) unstable; urgency=low
* O3 point release
-- Adam Mercer <adam.mercer@ligo.org> Fri, 21 Jun 2019 11:06:11 -0700
lalinference (1.11.0-1) unstable; urgency=low
* O3 point release
......
......@@ -225,6 +225,9 @@ rm -Rf ${RPM_BUILD_DIR}/%{name}-%{version}%{?nightly:-%{nightly}}
# dates should be formatted using: 'date +"%a %b %d %Y"'
%changelog
* Fri Jun 21 2019 Adam Mercer <adam.mercer@ligo.org> 1.11.1-1
- O3 point release
* Tue May 21 2019 Adam Mercer <adam.mercer@ligo.org> 1.11.0-1
- O3 point release
......
......@@ -102,7 +102,7 @@ def compute_mass_parameterizations(samples):
mc = samples['mchirp']
if not has_eta:
if has_q:
eta = bppu.q2eta(mc, samples['q'])
eta = bppu.q2eta(samples['q'])
else:
raise ValueError("Chirp mass given with no mass ratio.")
else:
......
......@@ -136,15 +136,15 @@ spinParamsAli=['spin1','spin2','a1z','a2z']
spinParamsEff=['chi','effectivespin','chi_eff','chi_tot','chi_p']
spinParams=spinParamsPrec+spinParamsEff+spinParamsAli
# Source frame params
cosmoParam=['m1_source','m2_source','mtotal_source','mc_source','redshift','mf_source']
cosmoParam=['m1_source','m2_source','mtotal_source','mc_source','redshift','mf_source','m1_source_maxldist','m2_source_maxldist','mtotal_source_maxldist','mc_source_maxldist','redshift_maxldist','mf_source_maxldist']
#Strong Field
ppEParams=['ppEalpha','ppElowera','ppEupperA','ppEbeta','ppElowerb','ppEupperB','alphaPPE','aPPE','betaPPE','bPPE']
tigerParams=['dchi%i'%(i) for i in range(8)] + ['dchi%il'%(i) for i in [5,6] ] + ['dxi%d'%(i+1) for i in range(6)] + ['dalpha%i'%(i+1) for i in range(5)] + ['dbeta%i'%(i+1) for i in range(3)] + ['dsigma%i'%(i+1) for i in range(4)]
bransDickeParams=['omegaBD','ScalarCharge1','ScalarCharge2']
massiveGravitonParams=['lambdaG']
tidalParams=['lambda1','lambda2','lam_tilde','dlam_tilde','lambdat','dlambdat']
tidalParams=['lambda1','lambda2','lam_tilde','dlam_tilde','lambdat','dlambdat','lambdas','bluni']
eosParams=['logp1','gamma1','gamma2','gamma3']
energyParams=['e_rad', 'l_peak']
energyParams=['e_rad', 'l_peak','e_rad_maxldist']
strongFieldParams=ppEParams+tigerParams+bransDickeParams+massiveGravitonParams+tidalParams+eosParams+energyParams
#Extrinsic
......@@ -163,7 +163,7 @@ calibParams=['calpha_l1','calpha_h1','calpha_v1','calamp_l1','calamp_h1','calamp
## Greedy bin sizes for cbcBPP and confidence leves used for the greedy bin intervals
confidenceLevels=[0.67,0.9,0.95,0.99]
greedyBinSizes={'mc':0.025,'m1':0.1,'m2':0.1,'mass1':0.1,'mass2':0.1,'mtotal':0.1,'mc_source':0.025,'m1_source':0.1,'m2_source':0.1,'mtotal_source':0.1,'eta':0.001,'q':0.01,'asym_massratio':0.01,'iota':0.01,'cosiota':0.02,'time':1e-4,'time_mean':1e-4,'distance':1.0,'dist':1.0,'redshift':0.01,'mchirp':0.025,'chirpmass':0.025,'spin1':0.04,'spin2':0.04,'a1z':0.04,'a2z':0.04,'a1':0.02,'a2':0.02,'phi1':0.05,'phi2':0.05,'theta1':0.05,'theta2':0.05,'ra':0.05,'dec':0.05,'chi':0.05,'chi_eff':0.05,'chi_tot':0.05,'chi_p':0.05,'costilt1':0.02,'costilt2':0.02,'thatas':0.05,'costheta_jn':0.02,'beta':0.05,'omega':0.05,'cosbeta':0.02,'ppealpha':1.0,'ppebeta':1.0,'ppelowera':0.01,'ppelowerb':0.01,'ppeuppera':0.01,'ppeupperb':0.01,'polarisation':0.04,'rightascension':0.05,'declination':0.05,'massratio':0.001,'inclination':0.01,'phase':0.05,'tilt1':0.05,'tilt2':0.05,'phi_jl':0.05,'theta_jn':0.05,'phi12':0.05,'flow':1.0,'phase_maxl':0.05,'calamp_l1':0.01,'calamp_h1':0.01,'calamp_v1':0.01,'calpha_h1':0.01,'calpha_l1':0.01,'calpha_v1':0.01,'logdistance':0.1,'psi':0.1,'costheta_jn':0.1,'mf':0.1,'mf_source':0.1,'af':0.02,'e_rad':0.1,'l_peak':0.1}
greedyBinSizes={'mc':0.025,'m1':0.1,'m2':0.1,'mass1':0.1,'mass2':0.1,'mtotal':0.1,'mc_source':0.025,'m1_source':0.1,'m2_source':0.1,'mtotal_source':0.1,'mc_source_maxldist':0.025,'m1_source_maxldist':0.1,'m2_source_maxldist':0.1,'mtotal_source_maxldist':0.1,'eta':0.001,'q':0.01,'asym_massratio':0.01,'iota':0.01,'cosiota':0.02,'time':1e-4,'time_mean':1e-4,'distance':1.0,'dist':1.0,'distance_maxl':1.0,'redshift':0.01,'redshift_maxldist':0.01,'mchirp':0.025,'chirpmass':0.025,'spin1':0.04,'spin2':0.04,'a1z':0.04,'a2z':0.04,'a1':0.02,'a2':0.02,'phi1':0.05,'phi2':0.05,'theta1':0.05,'theta2':0.05,'ra':0.05,'dec':0.05,'chi':0.05,'chi_eff':0.05,'chi_tot':0.05,'chi_p':0.05,'costilt1':0.02,'costilt2':0.02,'thatas':0.05,'costheta_jn':0.02,'beta':0.05,'omega':0.05,'cosbeta':0.02,'ppealpha':1.0,'ppebeta':1.0,'ppelowera':0.01,'ppelowerb':0.01,'ppeuppera':0.01,'ppeupperb':0.01,'polarisation':0.04,'rightascension':0.05,'declination':0.05,'massratio':0.001,'inclination':0.01,'phase':0.05,'tilt1':0.05,'tilt2':0.05,'phi_jl':0.05,'theta_jn':0.05,'phi12':0.05,'flow':1.0,'phase_maxl':0.05,'calamp_l1':0.01,'calamp_h1':0.01,'calamp_v1':0.01,'calpha_h1':0.01,'calpha_l1':0.01,'calpha_v1':0.01,'logdistance':0.1,'psi':0.1,'costheta_jn':0.1,'mf':0.1,'mf_source':0.1,'mf_source_maxldist':0.1,'af':0.02,'e_rad':0.1,'e_rad_maxldist':0.1,'l_peak':0.1}
for s in snrParams:
greedyBinSizes[s]=0.05
for derived_time in ['h1_end_time','l1_end_time','v1_end_time','h1l1_delay','l1v1_delay','h1v1_delay']:
......@@ -293,10 +293,17 @@ def get_prior(name):
'mtotal_source':None,
'mc_source':None,
'redshift':None,
'm1_source_maxldist':None,
'm2_source_maxldist':None,
'mtotal_source_maxldist':None,
'mc_source_maxldist':None,
'redshift_maxldist':None,
'mf':None,
'mf_source':None,
'mf_source_maxldist':None,
'af':None,
'e_rad':None,
'e_rad_maxldist':None,
'l_peak':None,
'spin1':'uniform',
'spin2':'uniform',
......@@ -320,6 +327,7 @@ def get_prior(name):
'time':'uniform',
'time_mean':'uniform',
'dist':'x**2',
'distance_maxl':'x**2',
'ra':'uniform',
'dec':'np.cos',
'phase':'uniform',
......@@ -343,6 +351,8 @@ def get_prior(name):
'lambda2': 'uniform',
'lam_tilde' : None,
'dlam_tilde': None,
'lambdas':'uniform',
'bluni':'uniform',
'logp1':None,
'gamma1':None,
'gamma2':None,
......@@ -391,10 +401,17 @@ def plot_label(param):
'mtotal_source':r'$M_\mathrm{total}^\mathrm{source}\,(\mathrm{M}_\odot)$',
'mc_source':r'$\mathcal{M}^\mathrm{source}\,(\mathrm{M}_\odot)$',
'redshift':r'$z$',
'm1_source_maxldist':r'$m_{1}^\mathrm{source - maxLdist}\,(\mathrm{M}_\odot)$',
'm2_source_maxldist':r'$m_{2}^\mathrm{source - maxLdist}\,(\mathrm{M}_\odot)$',
'mtotal_source_maxldist':r'$M_\mathrm{total}^\mathrm{source - maxLdist}\,(\mathrm{M}_\odot)$',
'mc_source_maxldist':r'$\mathcal{M}^\mathrm{source - maxLdist}\,(\mathrm{M}_\odot)$',
'redshift_maxldist':r'$z^\mathrm{maxLdist}$',
'mf':r'$M_\mathrm{final}\,(\mathrm{M}_\odot)$',
'mf_source':r'$M_\mathrm{final}^\mathrm{source}\,(\mathrm{M}_\odot)$',
'mf_source_maxldist':r'$M_\mathrm{final}^\mathrm{source - maxLdist}\,(\mathrm{M}_\odot)$',
'af':r'$a_\mathrm{final}$',
'e_rad':r'$E_\mathrm{rad}\,(\mathrm{M}_\odot)$',
'e_rad_maxldist':r'$E_\mathrm{rad}^\mathrm{maxLdist}\,(\mathrm{M}_\odot)$',
'l_peak':r'$L_\mathrm{peak}\,(10^{56}\,\mathrm{ergs}\,\mathrm{s}^{-1})$',
'spin1':r'$S_1$',
'spin2':r'$S_2$',
......@@ -418,9 +435,11 @@ def plot_label(param):
'time':r'$t_\mathrm{c}\,(\mathrm{s})$',
'time_mean':r'$<t>\,(\mathrm{s})$',
'dist':r'$d_\mathrm{L}\,(\mathrm{Mpc})$',
'distance_maxl':r'$d_\mathrm{L}^\mathrm{maxL}\,(\mathrm{Mpc})$',
'ra':r'$\alpha$',
'dec':r'$\delta$',
'phase':r'$\phi\,(\mathrm{rad})$',
'phase_maxl':r'$\phi^\mathrm{maxL}\,(\mathrm{rad})$',
'psi':r'$\psi\,(\mathrm{rad})$',
'theta_jn':r'$\theta_\mathrm{JN}\,(\mathrm{rad})$',
'costheta_jn':r'$\mathrm{cos}(\theta_\mathrm{JN})$',
......@@ -484,7 +503,9 @@ def plot_label(param):
'h1_optimal_snr':r'$\rho^{opt}_{H1}$',
'l1_optimal_snr':r'$\rho^{opt}_{L1}$',
'v1_optimal_snr':r'$\rho^{opt}_{V1}$',
'matched_filter_snr':r'$\rho^{MF}$'
'matched_filter_snr':r'$\rho^{MF}$',
'lambdas':r'$\Lambda_S$',
'bluni' : r'$BL_{uniform}$'
}
# Handle cases where multiple names have been used
......@@ -917,7 +938,7 @@ class Posterior(object):
('mass2' not in pos.names or 'm2' not in pos.names):
pos.append_mapping(('m1','m2'),q2ms,(mchirp_name,q_name))
pos.append_mapping('eta',q2eta,(mchirp_name,q_name))
pos.append_mapping('eta',q2eta,q_name)
if ('m1' in pos.names and 'm2' in pos.names and not 'mtotal' in pos.names ):
pos.append_mapping('mtotal', lambda m1,m2: m1+m2, ('m1','m2') )
......@@ -995,31 +1016,6 @@ class Posterior(object):
except KeyError:
print("Warning: Cannot find spin parameters. Skipping spin angle calculations.")
#Calculate effective precessing spin magnitude
if ('a1' in pos.names and 'tilt1' in pos.names and 'm1' in pos.names ) and ('a2' in pos.names and 'tilt2' in pos.names and 'm2' in pos.names):
pos.append_mapping('chi_p', chi_precessing, ['a1', 'tilt1', 'm1', 'a2', 'tilt2', 'm2'])
# Calculate redshift from luminosity distance measurements
if('distance' in pos.names):
pos.append_mapping('redshift', calculate_redshift, 'distance')
elif('dist' in pos.names):
pos.append_mapping('redshift', calculate_redshift, 'dist')
# Calculate source mass parameters
if ('m1' in pos.names) and ('redshift' in pos.names):
pos.append_mapping('m1_source', source_mass, ['m1', 'redshift'])
if ('m2' in pos.names) and ('redshift' in pos.names):
pos.append_mapping('m2_source', source_mass, ['m2', 'redshift'])
if ('mtotal' in pos.names) and ('redshift' in pos.names):
pos.append_mapping('mtotal_source', source_mass, ['mtotal', 'redshift'])
if ('mc' in pos.names) and ('redshift' in pos.names):
pos.append_mapping('mc_source', source_mass, ['mc', 'redshift'])
#Store signed spin magnitudes in separate parameters and make a1,a2 magnitudes
if 'a1' in pos.names:
if 'tilt1' in pos.names:
......@@ -1060,6 +1056,11 @@ class Posterior(object):
# Calculate redshift from luminosity distance measurements
if('distance' in pos.names):
pos.append_mapping('redshift', calculate_redshift, 'distance')
elif('dist' in pos.names):
pos.append_mapping('redshift', calculate_redshift, 'dist')
# If using the DistanceMarginalisation, compute the maxL redshift distribution from the maxL d_L
elif('distance_maxl' in pos.names):
pos.append_mapping('redshift_maxldist', calculate_redshift, 'distance_maxl')
# Calculate source mass parameters
if ('m1' in pos.names) and ('redshift' in pos.names):
......@@ -1074,9 +1075,22 @@ class Posterior(object):
if ('mc' in pos.names) and ('redshift' in pos.names):
pos.append_mapping('mc_source', source_mass, ['mc', 'redshift'])
# Calculate source mass parameters if DistanceMarginalisation was used, using the maxL distance and redshift
if ('m1' in pos.names) and ('redshift_maxldist' in pos.names):
pos.append_mapping('m1_source_maxldist', source_mass, ['m1', 'redshift_maxldist'])
if ('m2' in pos.names) and ('redshift_maxldist' in pos.names):
pos.append_mapping('m2_source_maxldist', source_mass, ['m2', 'redshift_maxldist'])
if ('mtotal' in pos.names) and ('redshift_maxldist' in pos.names):
pos.append_mapping('mtotal_source_maxldist', source_mass, ['mtotal', 'redshift_maxldist'])
if ('mc' in pos.names) and ('redshift_maxldist' in pos.names):
pos.append_mapping('mc_source_maxldist', source_mass, ['mc', 'redshift_maxldist'])
#Calculate new tidal parameters
new_tidal_params = ['lam_tilde','dlam_tilde']
old_tidal_params = ['lambda1','lambda2','eta']
old_tidal_params = ['lambda1','lambda2','q']
if 'lambda1' in pos.names or 'lambda2' in pos.names:
try:
pos.append_mapping(new_tidal_params, symm_tidal_params, old_tidal_params)
......@@ -1156,6 +1170,12 @@ class Posterior(object):
except Exception as e:
print("Could not calculate final source frame mass. The error was: %s"%(str(e)))
if ('mf' in pos.names) and ('redshift_maxldist' in pos.names):
try:
pos.append_mapping('mf_source_maxldist', source_mass, ['mf', 'redshift_maxldist'])
except Exception as e:
print("Could not calculate final source frame mass. The error was: %s"%(str(e)))
# Calculate radiated energy and peak luminosity
if ('mtotal_source' in pos.names) and ('mf_source' in pos.names):
try:
......@@ -1163,6 +1183,12 @@ class Posterior(object):
except Exception as e:
print("Could not calculate radiated energy. The error was: %s"%(str(e)))
if ('mtotal_source_maxldist' in pos.names) and ('mf_source_maxldist' in pos.names):
try:
pos.append_mapping('e_rad_maxldist', lambda mtot_s, mf_s: mtot_s-mf_s, ['mtotal_source_maxldist', 'mf_source_maxldist'])
except Exception as e:
print("Could not calculate radiated energy. The error was: %s"%(str(e)))
if ('q' in pos.names) and ('a1z' in pos.names) and ('a2z' in pos.names):
try:
pos.append_mapping('l_peak', bbh_aligned_Lpeak_6mode_SHXJDK, ['q', 'a1z', 'a2z'])
......@@ -3567,14 +3593,13 @@ def q2ms(mc,q):
#
#
def q2eta(mc,q):
def q2eta(q):
"""
Utility function for converting mchirp,q to eta. The
Utility function for converting q to eta. The
rvalue is eta.
"""
m1,m2 = q2ms(mc,q)
eta = m1*m2/( (m1+m2)*(m1+m2) )
return eta
eta = q/((1+q)*(1+q))
return np.clip(eta,0,0.25) # Explicitly cap eta at 0.25, in case it exceeds this slightly due to floating-point issues
#
#
......@@ -3721,12 +3746,24 @@ def component_momentum(m, a, theta, phi):
#
#
def symm_tidal_params(lambda1,lambda2,eta):
def symm_tidal_params(lambda1,lambda2,q):
"""
Calculate best tidal parameters
Calculate best tidal parameters [Eqs. (5) and (6) in Wade et al. PRD 89, 103012 (2014)]
Requires q <= 1
"""
lam_tilde = (8./13.)*((1.+7.*eta-31.*eta*eta)*(lambda1+lambda2) + np.sqrt(1.-4.*eta)*(1.+9.*eta-11.*eta*eta)*(lambda1-lambda2))
dlam_tilde = (1./2.)*(np.sqrt(1.-4.*eta)*(1.-13272.*eta/1319.+8944.*eta*eta/1319.)*(lambda1+lambda2) + (1.-15910.*eta/1319.+32850.*eta*eta/1319.+3380.*eta*eta*eta/1319.)*(lambda1-lambda2))
lambdap = lambda1 + lambda2
lambdam = lambda1 - lambda2
# Check that q <= 1, as expected
if np.any(q > 1):
raise ValueError("q > 1, while this function requires q <= 1.")
dmbym = (1. - q)/(1. + q) # Equivalent to sqrt(1 - 4*eta) for q <= 1
eta = q2eta(q)
lam_tilde = (8./13.)*((1.+7.*eta-31.*eta*eta)*lambdap + dmbym*(1.+9.*eta-11.*eta*eta)*lambdam)
dlam_tilde = (1./2.)*(dmbym*(1.-13272.*eta/1319.+8944.*eta*eta/1319.)*lambdap + (1.-15910.*eta/1319.+32850.*eta*eta/1319.+3380.*eta*eta*eta/1319.)*lambdam)
return lam_tilde, dlam_tilde
def spin_angles(fref,mc,eta,incl,a1,theta1,phi1,a2=None,theta2=None,phi2=None):
......@@ -5408,15 +5445,15 @@ def find_ndownsample(samples, nDownsample):
splineParams=["spcal_npts", "spcal_active","constantcal_active"]
for i in np.arange(25):
for k in lal.cached_detector_by_prefix:
splineParams.append(k+'_spcal_freq_'+str(i))
splineParams.append(k+'_spcal_logfreq_'+str(i))
splineParams.append(k.lower()+'_spcal_freq_'+str(i))
splineParams.append(k.lower()+'_spcal_logfreq_'+str(i))
nonParams = ["logpost", "post", "cycle", "timestamp", "snrh1", "snrl1", "snrv1",
"margtime","margtimephi","margtime","time_max","time_min",
"time_mean", "time_maxl","sky_frame","psdscaleflag","logdeltaf","flow","f_ref",
"lal_amporder","lal_pnorder","lal_approximant","tideo","spino","signalmodelflag",
"temperature","nifo","nlocaltemps","ntemps","randomseed","samplerate","segmentlength","segmentstart",
"t0", "phase_maxl", "azimuth", "cosalpha", "lal_amporder"] + logParams + snrParams + splineParams
"t0", "phase_maxl", "azimuth", "cosalpha", "lal_amporder", "bluni"] + logParams + snrParams + splineParams
fixedParams = [p for p in samples.colnames if all(x==samples[p][0] for x in samples[p])]
print("Fixed parameters: "+str(fixedParams))
nonParams.extend(fixedParams)
......
......@@ -1218,6 +1218,17 @@ class LALInferencePipelineDAG(pipeline.CondorDAG):
zipfilename='postproc_'+evstring+'.tar.gz'
else:
zipfilename=None
if "summarypages" not in self.config.get('condor','resultspage'):
respagenode=self.add_results_page_node(resjob=self.cotest_results_page_job,outdir=pagedir,parent=mergenode,gzip_output=zipfilename,ifos=enginenodes[0].ifos)
respagenode.set_psd_files(enginenodes[0].get_psd_files())
respagenode.set_snr_file(enginenodes[0].get_snr_file())
if os.path.exists(self.basepath+'/coinc.xml'):
try:
gid = self.config.get('input','gid')
except:
gid = None
respagenode.set_coinc_file(os.path.join(self.basepath, 'coinc.xml'), gid)
par_mergenodes=[]
for ifo in enginenodes[0].ifos:
co_merge_job = MergeJob(self.config,os.path.join(self.basepath,'merge_runs_%s.sub'%(ifo)),self.logpath,dax=self.is_dax(),engine='nest')
......@@ -1250,23 +1261,7 @@ class LALInferencePipelineDAG(pipeline.CondorDAG):
else:
pzipfilename=None
if "summarypages" not in self.config.get('condor','resultspage'):
respagenode=self.add_results_page_node(resjob=self.cotest_results_page_job,outdir=pagedir,parent=mergenode,gzip_output=zipfilename,ifos=enginenodes[0].ifos)
respagenode.set_psd_files(enginenodes[0].get_psd_files())
respagenode.set_snr_file(enginenodes[0].get_snr_file())
if os.path.exists(self.basepath+'/coinc.xml'):
try:
gid = self.config.get('input','gid')
except:
gid = None
respagenode.set_coinc_file(os.path.join(self.basepath, 'coinc.xml'), gid)
mkdirs(os.path.join(self.basepath,'coherence_test'))
respagenode=self.add_results_page_node(resjob=self.cotest_results_page_job,outdir=pagedir,parent=mergenode,gzip_output=zipfilename,ifos=enginenodes[0].ifos)
respagenode.set_psd_files(enginenodes[0].get_psd_files())
respagenode.set_snr_file(enginenodes[0].get_snr_file())
if os.path.exists(self.basepath+'/coinc.xml'):
respagenode.set_coinc_file(self.basepath+'/coinc.xml',self.config.get('input','gid'))
subresnode=self.add_results_page_node(outdir=presultsdir,parent=pmergenode, gzip_output=pzipfilename,ifos=ifo)
subresnode.set_psd_files(cotest_nodes[0].get_psd_files())
subresnode.set_snr_file(cotest_nodes[0].get_snr_file())
......@@ -1284,12 +1279,53 @@ class LALInferencePipelineDAG(pipeline.CondorDAG):
coherence_node.add_coherent_parent(mergenode)
for parmergenode in par_mergenodes:
coherence_node.add_incoherent_parent(parmergenode)
self.add_node(coherence_node)
respagenode.add_parent(coherence_node)
respagenode.set_bayes_coherent_incoherent(coherence_node.get_output_files()[0])
elif "summarypages" in self.config.get('condor','resultspage'):
par_mergenodes=[]
for ifo in enginenodes[0].ifos:
co_merge_job = MergeJob(self.config,os.path.join(self.basepath,'merge_runs_%s.sub'%(ifo)),self.logpath,dax=self.is_dax(),engine='nest')
co_merge_job.set_grid_site('local')
cotest_nodes=[]
for i in range(Npar):
cot_node,bwpsdnodes,bwpostnodes=self.add_engine_node(event,bwpsd=bwpsdnodes,bwpost=bwpostnodes,ifos=[ifo],co_test=True)
if cot_node is not None:
if i>0:
cot_node.add_var_arg('--dont-dump-extras')
cotest_nodes.append(cot_node)
if len(cotest_nodes)==0:
return False
for co in cotest_nodes:
co.set_psdstart(enginenodes[0].GPSstart)
co.set_psdlength(enginenodes[0].psdlength)
if co!=cotest_nodes[0]:
co.add_var_arg('--dont-dump-extras')
else:
co.set_psd_files()
co.set_snr_file()
pmergenode=MergeNode(co_merge_job,parents=cotest_nodes,engine='nest')
pmergenode.set_pos_output_file(os.path.join(self.posteriorpath,'posterior_%s_%s.hdf5'%(ifo,evstring)))
self.add_node(pmergenode)
par_mergenodes.append(pmergenode)
presultsdir=os.path.join(pagedir,ifo)
mkdirs(presultsdir)
if self.site!='local':
pzipfilename='postproc_'+evstring+'_'+ifo+'.tar.gz'
else:
pzipfilename=None
if "summarypages" in self.config.get('condor','resultspage'):
respagenode=self.add_results_page_node_pesummary(outdir=pagedir,parent=mergenode,gzip_output=None,ifos=enginenodes[0].ifos,
evstring=evstring, coherence=True)
respagenode.set_psd_files(enginenodes[0].get_psd_files())
respagenode.set_psd_files(enginenodes[0].ifos, enginenodes[0].get_psd_files())
if os.path.exists(self.basepath+'/coinc.xml'):
try:
gid = self.config.get('input','gid')
except:
gid = None
respagenode.set_coinc_file(os.path.join(self.basepath, 'coinc.xml'), gid)
else:
if self.site!='local':
zipfilename='postproc_'+evstring+'.tar.gz'
......@@ -1300,7 +1336,13 @@ class LALInferencePipelineDAG(pipeline.CondorDAG):
if "summarypages" in self.config.get('condor','resultspage'):
respagenode=self.add_results_page_node_pesummary(outdir=pagedir,parent=mergenode,gzip_output=None,ifos=enginenodes[0].ifos,
evstring=evstring, coherence=False)
respagenode.set_psd_files(enginenodes[0].get_psd_files())
respagenode.set_psd_files(enginenodes[0].ifos, enginenodes[0].get_psd_files())
if os.path.exists(self.basepath+'/coinc.xml'):
try:
gid = self.config.get('input','gid')
except:
gid = None
respagenode.set_coinc_file(os.path.join(self.basepath, 'coinc.xml'), gid)
else:
respagenode=self.add_results_page_node(outdir=pagedir,parent=mergenode,gzip_output=None,ifos=enginenodes[0].ifos)
respagenode.set_psd_files(enginenodes[0].get_psd_files())
......@@ -1309,7 +1351,7 @@ class LALInferencePipelineDAG(pipeline.CondorDAG):
try:
gid = self.config.get('input','gid')
except:
gid = None
gid = none
respagenode.set_coinc_file(os.path.join(self.basepath, 'coinc.xml'), gid)
if self.config.has_option('input','injection-file') and event.event_id is not None:
respagenode.set_injection(self.config.get('input','injection-file'),event.event_id)
......@@ -1405,7 +1447,13 @@ class LALInferencePipelineDAG(pipeline.CondorDAG):
if "summarypages" in self.config.get('condor','resultspage'):
respagenode=self.add_results_page_node_pesummary(outdir=pagedir,parent=mergenode,gzip_output=None,ifos=enginenodes[0].ifos, evstring=evstring, coherence=self.config.getboolean('analysis','coherence-test'))
respagenode.set_psd_files(enginenodes[0].get_psd_files())
respagenode.set_psd_files(enginenodes[0].ifos, enginenodes[0].get_psd_files())
if os.path.exists(self.basepath+'/coinc.xml'):
try:
gid = self.config.get('input','gid')
except:
gid = None
respagenode.set_coinc_file(os.path.join(self.basepath, 'coinc.xml'), gid)
else:
respagenode=self.add_results_page_node(outdir=pagedir,parent=mergenode,gzip_output=None,ifos=enginenodes[0].ifos)
respagenode.set_psd_files(enginenodes[0].get_psd_files())
......@@ -1879,7 +1927,8 @@ class LALInferencePipelineDAG(pipeline.CondorDAG):
calibration = []
for ifo in ifos:
try:
calibration.append(self.config.get("engine", "%s-spcal-envelope" %(ifo)))
calibration_envelope = self.config.get("engine", "%s-spcal-envelope" %(ifo))
calibration.append("%s:%s" %(ifo, calibration_envelope))
except:
pass
if len(calibration) > 0:
......@@ -2059,7 +2108,54 @@ class LALInferencePipelineDAG(pipeline.CondorDAG):
self.add_node(node)
return node
class SingularityJob(pipeline.CondorDAGJob):
class LALInferenceDAGJob(pipeline.CondorDAGJob):
"""
Class to define DAG Jobs for lalinference pipeline.
Handles some common condor settings like requirements, accounting groups,
and queues.
Parameters:
cp : configparser object
"""
def __init__(self, cp=None):
self.requirements=[]
if not cp:
# Create dummy empty config
from configparser import ConfigParser
cp = ConfigParser()
# Add requirements from the configparser condor section
if cp.has_option('condor','requirements'):
self.add_requirement(cp.get('condor','requirements'))
# Add accounting group information if present
if cp.has_option('condor','accounting_group'):
self.add_condor_cmd('accounting_group',cp.get('condor','accounting_group'))
if cp.has_option('condor','accounting_group_user'):
self.add_condor_cmd('accounting_group_user',cp.get('condor','accounting_group_user'))
if cp.has_option('condor','queue'):
self.add_condor_cmd('+'+cp.get('condor','queue'),'True')
self.add_requirement('(TARGET.'+cp.get('condor','queue')+' =?= True)')
def add_requirement(self,requirement):
"""
Add a requirement to the condor submit file
"""
# Check that string isn't empty
if requirement:
self.requirements.append(requirement)
def write_sub_file(self):
"""
Over-load CondorDAGJob.write_sub_file to write the requirements
"""
if self.requirements:
self.add_condor_cmd('requirements','&&'.join('({0})'.format(r) for r in self.requirements))
# Call the parent method to do the rest
super(LALInferenceDAGJob,self).write_sub_file()
class SingularityJob(LALInferenceDAGJob):
"""
Wrapper class for running jobs via a singularity image
"""
......@@ -2067,7 +2163,7 @@ class SingularityJob(pipeline.CondorDAGJob):
CVMFS_FRAMES="/cvmfs/oasis.opensciencegrid.org/ligo/frames/"
image=None
def __init__(self, cp, *args, **kwargs):
self.requirements=[]
super(SingularityJob, self).__init__(cp)
# Dir in which the DAG will run
# Execute from the basedir so all paths can be resolved
if cp.has_option('analysis','singularity'):
......@@ -2102,33 +2198,24 @@ class SingularityJob(pipeline.CondorDAGJob):
extra_paths="--bind {cvmfs_frames}".format(cvmfs_frames = self.CVMFS_FRAMES)
self.add_condor_cmd('+SingularityBindCVMFS','True')
self.add_condor_cmd('use_x509userproxy','True')
self.requirements.append('HAS_LIGO_FRAMES =?= TRUE')
self.add_requirement('HAS_LIGO_FRAMES =?= TRUE')
if cp.has_option('analysis','roq') and cp.getboolean('analysis','roq'):
extra_paths+=" --bind {roqpath}".format(roqpath=cp.get('paths','roq_b_matrix_directory'))
if self.osg:
self.add_condor_cmd('+OpenScienceGrid','True')
self.requirements.append('IS_GLIDEIN=?=True')
self.add_requirement('IS_GLIDEIN=?=True')
# Add requested sites if specified
if cp.has_option('condor','desired-sites'):
self.add_condor_cmd('+DESIRED_Sites',cp.get('condor','desired-sites'))
if self.singularity:
self.requirements.append('HAS_SINGULARITY =?= TRUE')
self.add_requirement('HAS_SINGULARITY =?= TRUE')