B
    ß‹d¯v ã               @   sv  d Z ddlmZ dZdZdZddlZddlZddlZddl	Z	ddl
Z
ddlZddlmZ ddlmZ G d	d
„ d
eƒZG dd„ dejejƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd „ d eƒZG d!d"„ d"eƒZG d#d$„ d$eƒZG d%d&„ d&eƒZ G d'd(„ d(eƒZ!G d)d*„ d*eƒZ"G d+d,„ d,eƒZ#G d-d.„ d.eƒZ$G d/d0„ d0eƒZ%G d1d2„ d2eƒZ&G d3d4„ d4eƒZ'G d5d6„ d6eƒZ(G d7d8„ d8eƒZ)G d9d:„ d:eƒZ*G d;d<„ d<ej+ej,ƒZ-G d=d>„ d>e-ƒZ.G d?d@„ d@e-ƒZ/G dAdB„ dBe-ƒZ0G dCdD„ dDe-ƒZ1G dEdF„ dFe-ƒZ2G dGdH„ dHe-ƒZ3G dIdJ„ dJe-ƒZ4G dKdL„ dLe-ƒZ5G dMdN„ dNe-ƒZ6G dOdP„ dPe-ƒZ7G dQdR„ dRe-ƒZ8G dSdT„ dTe-ƒZ9G dUdV„ dVe-ƒZ:G dWdX„ dXe-ƒZ;G dYdZ„ dZe-ƒZ<G d[d\„ d\e-ƒZ=G d]d^„ d^e-ƒZ>G d_d`„ d`e-ƒZ?G dadb„ dbe-ƒZ@G dcdd„ dde-ƒZAG dedf„ dfe-ƒZBG dgdh„ dhe-ƒZCG didj„ dje-ƒZDG dkdl„ dleƒZEG dmdn„ dne.ƒZFG dodp„ dpeƒZGG dqdr„ dre.ƒZHG dsdt„ dteƒZIG dudv„ dve.ƒZJG dwdx„ dxeƒZKG dydz„ dze.ƒZLG d{d|„ d|eƒZMG d}d~„ d~e.ƒZNG dd€„ d€eƒZOG dd‚„ d‚e.ƒZPG dƒd„„ d„eƒZQG d…d†„ d†e.ƒZRG d‡dˆ„ dˆeƒZSG d‰dŠ„ dŠe.ƒZTG d‹dŒ„ dŒeƒZUG ddŽ„ dŽe.ƒZVG dd„ deƒZWG d‘d’„ d’e.ƒZXG d“d”„ d”eƒZYG d•d–„ d–e-ƒZZG d—d˜„ d˜eƒZ[G d™dš„ dše.ƒZ\G d›dœ„ dœej]ƒZ^G ddž„ džej_ƒZ`G dŸd „ d ej]ƒZaG d¡d¢„ d¢ej_ƒZbG d£d¤„ d¤ej]ƒZcG d¥d¦„ d¦ej_ƒZdG d§d¨„ d¨ej]ƒZeG d©dª„ dªej_ƒZfG d«d¬„ d¬ej]ƒZgG d­d®„ d®ej_ƒZhG d¯d°„ d°ej]ƒZiG d±d²„ d²ej_ƒZjG d³d´„ d´ej]ƒZkG dµd¶„ d¶ej_ƒZlG d·d¸„ d¸ej]ƒZmG d¹dº„ dºej_ƒZnG d»d¼„ d¼enƒZoG d½d¾„ d¾enƒZpG d¿dÀ„ dÀenƒZqG dÁdÂ„ dÂej]ƒZrG dÃdÄ„ dÄej_ƒZsG dÅdÆ„ dÆej]ƒZtG dÇdÈ„ dÈej_ƒZuG dÉdÊ„ dÊej]ƒZvG dËdÌ„ dÌej_ƒZwG dÍdÎ„ dÎej]ƒZxG dÏdÐ„ dÐej_ƒZydãdÑdÒ„ZzG dÓdÔ„ dÔej]ƒZ{G dÕdÖ„ dÖej_ƒZ|G d×dØ„ dØej]ƒZ}G dÙdÚ„ dÚej_ƒZ~G dÛdÜ„ dÜeƒZG dÝdÞ„ dÞe-ƒZ€G dßdà„ dàeƒZG dádâ„ dâe-ƒZ‚dS )äz¤
Classes needed for the inspiral analysis pipeline.
This script produced the necessary condor submit and dag files to run
the standalone inspiral code on LIGO data
é    )Úprint_functionz*Duncan Brown <duncan@gravity.phys.uwm.edu>z$Date$z
$Revision$N)Úpipeline)Úlalc               @   s   e Zd Zddd„ZdS )ÚInspiralErrorNc             C   s
   || _ d S )N)Úargs)Úselfr   © r   ú]/work/yifan.wang/ringdown/master-ringdown-env/lib/python3.7/site-packages/lalapps/inspiral.pyÚ__init__   s    zInspiralError.__init__)N)Ú__name__Ú
__module__Ú__qualname__r
   r   r   r   r	   r      s   r   c               @   sB   e Zd ZdZddd„Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dS )ÚInspiralAnalysisJoba0  
  An inspiral analysis job captures some of the common features of the specific
  inspiral jobs that appear below.  Specifically, the universe and exec_name
  are set, the stdout and stderr from the job are directed to the logs
  directory. The path to the executable is determined from the ini file.
  Úxmlc       	      C   sØ   || _ || _| dd¡}| d|¡}tj | ||¡ tj | |¡ |  dd¡ | dd¡| _	t
 |¡}x:|D ]2}| |¡rˆ|  ||¡ qltd| d tjd qlW |  d	| d
 ¡ |  d	| d ¡ |  |d ¡ dS )zµ
    cp = ConfigParser object from which options are read.
    sections = sections of the ConfigParser that get added to the opts
    exec_name = exec_name name in ConfigParser
    ÚcondorÚuniverseZcopy_to_spoolÚFalsezuse-gpusz)warning: config file is missing section [ú])Úfilezlogs/zB-$(macrogpsstarttime)-$(macrogpsendtime)-$(cluster)-$(process).outzB-$(macrogpsstarttime)-$(macrogpsendtime)-$(cluster)-$(process).errz.subN)Ú_InspiralAnalysisJob__exec_nameÚ_InspiralAnalysisJob__extensionÚgetr   ÚCondorDAGJobr
   ÚAnalysisJobÚadd_condor_cmdÚ
has_optionÚ_InspiralAnalysisJob__use_gpusÚcopyÚdeepcopyÚhas_sectionÚadd_ini_optsÚprintÚsysÚstderrÚset_stdout_fileÚset_stderr_fileÚset_sub_file)	r   ÚcpÚsectionsÚ	exec_nameÚ	extensionr   Ú
executableZmycpÚsecr   r   r	   r
   #   s$    




zInspiralAnalysisJob.__init__c             C   s
   || _ dS )z 
    Set the exec_name name
    N)r   )r   r)   r   r   r	   Úset_exec_nameA   s    z!InspiralAnalysisJob.set_exec_namec             C   s   | j S )z 
    Get the exec_name name
    )r   )r   r   r   r	   Úget_exec_nameG   s    z!InspiralAnalysisJob.get_exec_namec             C   s
   || _ dS )z 
    Set the file extension
    N)r   )r   r*   r   r   r	   Úset_extensionM   s    z!InspiralAnalysisJob.set_extensionc             C   s   | j S )z-
    Get the extension for the file name
    )r   )r   r   r   r	   Úget_extensionS   s    z!InspiralAnalysisJob.get_extensionc             C   s   | j S )zA
    Get whether this job was requested to run on a GPU node
    )r   )r   r   r   r	   Úget_use_gpusY   s    z InspiralAnalysisJob.get_use_gpusN)r   )
r   r   r   Ú__doc__r
   r-   r.   r/   r0   r1   r   r   r   r	   r      s   
r   c               @   s   e Zd ZdZddd„ZdS )ÚInspiralPlottingJobz{
  The InspiralPlottingJob class will assign options common to all plotting
  jobs. Currently this is only MPLCONFIGDIR.
  r   c             C   sJ   t  | ||||¡ |  dd¡ | dd¡rF| dd¡}|  dd| ¡ dS )zµ
    cp = ConfigParser object from which options are read.
    sections = sections of the ConfigParser that get added to the opts
    exec_name = exec_name name in ConfigParser
    ÚgetenvÚTruer   ZmatplotlibdirÚenvironmentzMPLCONFIGDIR=N)r   r
   r   r   r   )r   r'   r(   r)   r*   ZMPLConfigPathr   r   r	   r
   g   s
    zInspiralPlottingJob.__init__N)r   )r   r   r   r2   r
   r   r   r   r	   r3   b   s   r3   c               @   s   e Zd ZdZdd„ ZdS )ÚTmpltBankJobaT  
  A lalapps_tmpltbank job used by the inspiral pipeline. The static options
  are read from the sections [data] and [tmpltbank] in the ini file. The
  stdout and stderr from the job are directed to the logs directory. The job
  runs in the universe specfied in the ini file. The path to the executable
  is determined from the ini file.
  c             C   sX   d}d}ddg}d}|  dd¡r2d}| ddd	¡ t | ||||¡ |rT|  d
d¡ dS )z?
    cp = ConfigParser object from which options are read.
    Z	tmpltbankr   ÚdataFÚpycbcTr   r   Úvanillar4   r5   N)r   Úsetr   r
   r   )r   r'   r)   r*   r(   Ú
have_pycbcr   r   r	   r
   }   s    zTmpltBankJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r7   u   s   r7   c               @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	Ú
InspInjJobaI  
  A lalapps_inspinj job used by the grb inspiral pipeline. The static options
  are read from the section [inspinj] in the ini file. The
  stdout and stderr from the job are directed to the logs directory. The
  job runs in the universe specified in the ini file. The path to the
  executable is determined from the ini file.
  c             C   s:   d}dg}d}t  | ||||¡ |  d¡ g | _g | _dS )z?
    cp = ConfigParser object from which options are read.
    Zinspinjr   r:   N)r   r
   Zset_universeÚ_InspInjJob__listDoneÚ_InspInjJob__listNodes)r   r'   r)   r(   r*   r   r   r	   r
   ™   s    
zInspInjJob.__init__c             C   s   | j  |¡ | j |¡ d S )N)r>   Úappendr?   )r   ÚnumberÚnoder   r   r	   Úset_done¦   s    zInspInjJob.set_donec             C   s&   | j  |¡r"| j  |¡}| j| S d S )N)r>   ÚcountÚindexr?   )r   rA   rE   r   r   r	   Ú
check_nodeª   s    
zInspInjJob.check_nodeN)r   r   r   r2   r
   rC   rF   r   r   r   r	   r=   ‘   s   r=   c               @   s   e Zd ZdZdd„ ZdS )Ú	BbhInjJobaJ  
  A lalapps_bbhinj job used by the online inspiral pipeline. The static options
  are read from the section [bbhinj] in the ini file. The
  stdout and stderr from the job are directed to the logs directory. The
  job runs in the universe specified in the ini file. The path to the
  executable is determined from the ini file.
  c             C   s$   d}dg}d}t  | ||||¡ dS )z?
    cp = ConfigParser object from which options are read.
    Zbbhinjr   N)r   r
   )r   r'   r)   r(   r*   r   r   r	   r
   ¹   s    zBbhInjJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rG   ±   s   rG   c               @   s   e Zd ZdZdd„ ZdS )ÚRandomBankJobaJ  
  A lalapps_randombank job used by the inspiral pipeline. The static options
  are read from the section [randombank] in the ini file. The stdout and
  stderr from the job are directed to the logs directory. The job runs in the
  universe specfied in the ini file. The path to the executable is determined
  from the ini file.
  c             C   s$   d}dg}d}t  | ||||¡ dS )z?
    cp = ConfigParser object from which options are read.
    Z
randombankr   N)r   r
   )r   r'   r)   r(   r*   r   r   r	   r
   Ë   s    zRandomBankJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rH   Ã   s   rH   c               @   s   e Zd ZdZdd„ ZdS )ÚSplitBankJobaH  
  A lalapps_splitbank job used by the inspiral pipeline. The static options
  are read from the section [splitbank] in the ini file. The stdout and stderr
  from the job are directed to the logs directory. The job runs in the
  universe specfied in the ini file. The path to the executable is determined
  from the ini file.
  c             C   s$   d}dg}d}t  | ||||¡ dS )z?
    cp = ConfigParser object from which options are read.
    Z	splitbankr   N)r   r
   )r   r'   r)   r(   r*   r   r   r	   r
   Ý   s    zSplitBankJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rI   Õ   s   rI   c               @   s   e Zd ZdZdd„ ZdS )ÚInspiralJobaÕ  
  A lalapps_inspiral job used by the inspiral pipeline. The static options
  are read from the sections [data] and [inspiral] in the ini file. The
  stdout and stderr from the job are directed to the logs directory. The job
  runs in the universe specfied in the ini file. The path to the executable
  is determined from the ini file. If the user requested GPU utilization,
  checks are done to ensure a successful run and the necessary Condor
  commands are added.
  c             C   s2  d}ddg}d}d}|  dd¡r>d}| ddd	¡ | dd¡ t | ||||¡ |  d
d¡ |  dd¡ |rx|  dd¡ |  ¡ r.| dd¡}|d	kr¦td| d ƒ‚| d|¡}t	 
d¡}tjdd|gdtjd}	d}
x"|	jD ]}| |¡}|ràd}
P qàW |
s
tdƒ‚|  dd¡ |  dd¡ |  dd¡ dS )z?
    cp = ConfigParser object from which options are read.
    Úinspiralr8   r   Fr9   Tr   r   r:   r6   z!KMP_LIBRARY=serial;MKL_SERIAL=yesÚrequest_memoryZ1000r4   r5   z'Cannot run GPU inspiral jobs on Condor z universe. Please use vanilla.z'^\s*NEEDED\s*(libcufft\.|libcudart\.).*Úobjdumpz-pN)ÚstdinÚstdoutzNInspiral executable has no CUDA dependencies. Please use a CUDA-enabled build.zgpu-device-idÚ0z+WantGPUÚtrueZRequirementsz( GPU_PRESENT =?= true))r   r;   Úremove_optionr   r
   r   r1   r   ÚRuntimeErrorÚreÚcompileÚ
subprocessÚPopenÚPIPErO   ÚmatchÚadd_opt)r   r'   r)   r(   r*   r<   r   r+   Z
objdump_reÚprocZ	cuda_depsÚlineÚmr   r   r	   r
   ñ   sB    


zInspiralJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rJ   ç   s   	rJ   c               @   s   e Zd ZdZdd„ ZdS )ÚInspiralCkptJobaj  
  A lalapps_inspiral job used by the inspiral pipeline. The static options
  are read from the sections [data] and [inspiral] in the ini file. The
  stdout and stderr from the job are directed to the logs directory. The job
  runs in the universe specfied in the ini file. The path to the executable
  is determined from the ini file.
  This one checkpoints.
  c             C   s.   d}g }d}t  | ||||¡ |  dd¡ dS )z?
    cp = ConfigParser object from which options are read.
    rK   r   Z_condor_relocatableÚ N)r   r
   Zadd_short_opt)r   r'   r)   r(   r*   r   r   r	   r
   )  s
    zInspiralCkptJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r^      s   r^   c               @   s   e Zd ZdZdd„ ZdS )ÚPTFInspiralJobaR  
  A lalapps_inspiral job used by the inspiral pipeline. The static options
  are read from the sections [data] and [inspiral] in the ini file. The
  stdout and stderr from the job are directed to the logs directory. The job
  runs in the universe specfied in the ini file. The path to the executable
  is determined from the ini file.
  c             C   s^   d}dg}d}t  | ||||¡ d}| d¡rJ| dd¡rJt| dd¡ƒ}|  dd| ¡ dS )	z?
    cp = ConfigParser object from which options are read.
    Zcoh_PTF_inspiralr   in  zcoh_PTF_inspiral-metazminimum-ramrL   z%dN)r   r
   r   r   Úintr   r   )r   r'   r)   r(   r*   ZramValuer   r   r	   r
   <  s    
zPTFInspiralJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r`   4  s   r`   c               @   s   e Zd ZdZdd„ ZdS )ÚTrigbankJoba?  
  A lalapps_trigbank job used by the inspiral pipeline. The static
  options are read from the section [trigbank] in the ini file.  The
  stdout and stderr from the job are directed to the logs directory. The job
  always runs in the scheduler universe. The path to the executable is
  determined from the ini file.
  c             C   s$   d}dg}d}t  | ||||¡ dS )z?
    cp = ConfigParser object from which options are read.
    Ztrigbankr   N)r   r
   )r   r'   r)   r(   r*   r   r   r	   r
   S  s    zTrigbankJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rb   K  s   rb   c               @   s   e Zd ZdZdd„ ZdS )ÚIncaJoba  
  A lalapps_inca job used by the inspiral pipeline. The static options are
  read from the section [inca] in the ini file.  The stdout and stderr from
  the job are directed to the logs directory.  The path to the executable is
  determined from the ini file.
  c             C   s$   d}dg}d}t  | ||||¡ dS )z?
    cp = ConfigParser object from which options are read.
    Zincar   N)r   r
   )r   r'   r)   r(   r*   r   r   r	   r
   d  s    zIncaJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rc   ]  s   rc   c               @   s    e Zd ZdZdd„ Zdd„ ZdS )Ú	ThincaJoba  
  A lalapps_thinca job used by the inspiral pipeline. The static options are
  read from the section [thinca] in the ini file.  The stdout and stderr from
  the job are directed to the logs directory.  The path to the executable is
  determined from the ini file.
  c             C   s8   d}g }d}t  | ||||¡ | d¡r4|  |d¡ dS )z?
    cp = ConfigParser object from which options are read.
    Zthincar   N)r   r
   r   r    )r   r'   r)   r(   r*   r   r   r	   r
   u  s    
zThincaJob.__init__c             C   sÌ   xÆ|  |¡D ]¸}t | ||¡¡}|dd… dkr¸tj |¡d }|t d¡krªy(t |tj |¡d ¡ |  	||¡ W q¶   t
d| d tjd |  	||¡ Y q¶X qÄ|  	||¡ q|  ||¡ qW dS )	zè
    Parse command line options from a given section in an ini file and
    pass to the executable.
    @param cp: ConfigParser object pointing to the ini file.
    @param section: section of the ini file to add to the options.
    éüÿÿÿNr   éÿÿÿÿÚ.zsym link failed for z grid workflows might be broken)r   )ÚoptionsÚstringÚstripr   ÚosÚpathÚsplitÚlistdirÚsymlinkÚadd_file_optr!   r"   r#   rZ   )r   r'   ÚsectionÚoptÚargÚfnamer   r   r	   r    ‚  s    zThincaJob.add_ini_optsN)r   r   r   r2   r
   r    r   r   r   r	   rd   n  s   rd   c               @   s@   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dS )ÚThincaToCoincJobzl
  A ThincaToCoinc job. The static options are read from the
  section [thinca_to_coinc] in the ini file.
  c             C   s`   d}dg}d}t  | ||||¡ |  dd¡ d| _d| _|  d| d ¡ |  d| d ¡ dS )	zE
    @param cp: ConfigParser object from which options are read.
    Zthinca_to_coincr   r4   r5   Nzlogs/z-$(cluster)-$(process).outz-$(cluster)-$(process).err)r   r
   r   Ú(_ThincaToCoincJob__experiment_start_timeÚ&_ThincaToCoincJob__experiment_end_timer$   r%   )r   r'   r)   r(   r*   r   r   r	   r
      s    zThincaToCoincJob.__init__c             C   s   |   d|¡ || _dS )z±
    Sets the experiment-start-time option. This is a required option.
    @param experiment_start_time: gps start time of the experiment the thinca_to_coinc
    job is in.
    zexperiment-start-timeN)rZ   rv   )r   Úexperiment_start_timer   r   r	   Úset_experiment_start_time¯  s    z*ThincaToCoincJob.set_experiment_start_timec             C   s   |   d|¡ || _dS )z«
    Sets the experiment-end-time option. This is a required option.
    @param experiment_end_time: gps end time of the experiment the thinca_to_coinc
    job is in.
    zexperiment-end-timeN)rZ   rw   )r   Úexperiment_end_timer   r   r	   Úset_experiment_end_time¸  s    z(ThincaToCoincJob.set_experiment_end_timec             C   s   | j S )z@
    Returns the value of the experiment-start-time option.
    )rv   )r   rx   r   r   r	   Úget_experiment_start_timeÁ  s    z*ThincaToCoincJob.get_experiment_start_timec             C   s   | j S )z>
    Returns the value of the experiment-end-time option.
    )rv   )r   rz   r   r   r	   Úget_experiment_end_timeÇ  s    z(ThincaToCoincJob.get_experiment_end_timec             C   s   |   dd¡ dS )z2
    Adds the simulation argument to the job.
    Z
simulationr_   N)rZ   )r   r   r   r	   Úset_simulationÍ  s    zThincaToCoincJob.set_simulationN)
r   r   r   r2   r
   ry   r{   r|   r}   r~   r   r   r   r	   ru   ›  s   		ru   c               @   s   e Zd ZdZdd„ ZdS )ÚHWinjPageJobz]
  A HWinjPageJob, runs the hardware injection page script on the
  output of the pipeline
  c             C   s|   d}d}d}d}|  d|¡}tj | ||¡ tj | |¡ |  dd¡ |  d| d	 ¡ |  d| d
 ¡ |  |d ¡ dS )zE
    @param cp: ConfigParser object from which options are read.
    Zhardware_inj_pager:   z[hardware-injection-page]Úhtmlr   r4   r5   zlogs/z-$(cluster)-$(process).outz-$(cluster)-$(process).errz.subN)	r   r   r   r
   r   r   r$   r%   r&   )r   r'   r)   r   r(   r*   r+   r   r   r	   r
   Ø  s    zHWinjPageJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r   Ó  s   r   c               @   s   e Zd ZdZdd„ ZdS )ÚSireJobz¾
  A lalapps_sire job used by the inspiral pipeline. The stdout and stderr from
  the job are directed to the logs directory. The path to the executable is
  determined from the ini file.
  c             C   s8   d}dg}d}t  | ||||¡ |  d¡ |  d¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    Zsirer   z/logs/sire-$(macroifo)-$(cluster)-$(process).outz/logs/sire-$(macroifo)-$(cluster)-$(process).errN)r   r
   r$   r%   )r   r'   r)   r(   r*   r   r   r	   r
   î  s    
zSireJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r   è  s   r   c               @   s   e Zd ZdZdd„ ZdS )ÚCoireJobz¿
  A lalapps_coire job used by the inspiral pipeline. The stdout and stderr from
  the job are directed to the logs directory. The path to the executable is
  determined from the ini file.
  c             C   s8   d}dg}d}t  | ||||¡ |  d¡ |  d¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    Zcoirer   z0logs/coire-$(macroifo)-$(cluster)-$(process).outz0logs/coire-$(macroifo)-$(cluster)-$(process).errN)r   r
   r$   r%   )r   r'   r)   r(   r*   r   r   r	   r
     s    
zCoireJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r‚   ü  s   r‚   c               @   s   e Zd ZdZdd„ ZdS )Ú	FrJoinJobzw
  A lalapps_frjoin job used by the inspiral pipeline. The path to the
  executable is determined from the ini file.
  c             C   s6   d}g }d}t  | ||||¡ |  d¡ |  d¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    ZfrjoinZgwfz%logs/frjoin-$(cluster)-$(process).outz%logs/frjoin-$(cluster)-$(process).errN)r   r
   r$   r%   )r   r'   r)   r(   r*   r   r   r	   r
     s    
zFrJoinJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rƒ     s   rƒ   c               @   s   e Zd ZdZdd„ ZdS )Ú
CohBankJoba  
  A lalapps_coherent_inspiral job used by the inspiral pipeline. The static
  options are read from the section [cohbank] in the ini file.  The stdout and
  stderr from the job are directed to the logs directory.  The path to the
  executable is determined from the ini file.
  c             C   s$   d}dg}d}t  | ||||¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    Zcohbankr   N)r   r
   )r   r'   r)   r(   r*   r   r   r	   r
   *  s    zCohBankJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r„   #  s   r„   c               @   s   e Zd ZdZdd„ ZdS )ÚInspiralCoherentJobaR  
  A lalapps_inspiral job used by the inspiral pipeline. The static options
  are read from the sections [data] and [inspiral] in the ini file. The
  stdout and stderr from the job are directed to the logs directory. The job
  runs in the universe specfied in the ini file. The path to the executable
  is determined from the ini file.
  c             C   s0   d}dg}d}t  | ||||¡ |  dd¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    rK   r8   r   r6   z!KMP_LIBRARY=serial;MKL_SERIAL=yesN)r   r
   r   )r   r'   r)   r(   r*   r   r   r	   r
   <  s
    zInspiralCoherentJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r…   4  s   r…   c               @   s   e Zd ZdZdd„ ZdS )ÚCohInspBankJoba  
  A lalapps_coherent_inspiral job used by the inspiral pipeline. The static
  options are read from the section [cohinspbank] in the ini file.  The stdout and
  stderr from the job are directed to the logs directory.  The path to the
  executable is determined from the ini file.
  c             C   s$   d}dg}d}t  | ||||¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    Zcohinspbankr   N)r   r
   )r   r'   r)   r(   r*   r   r   r	   r
   N  s    zCohInspBankJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r†   G  s   r†   c               @   s   e Zd ZdZdd„ ZdS )ÚChiaJoba  
  A lalapps_coherent_inspiral job used by the inspiral pipeline. The static
  options are read from the section [chia] in the ini file.  The stdout and
  stderr from the job are directed to the logs directory.  The path to the
  executable is determined from the ini file.
  c             C   s$   d}dg}d}t  | ||||¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    Zchiar   N)r   r
   )r   r'   r)   r(   r*   r   r   r	   r
   _  s    zChiaJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r‡   X  s   r‡   c               @   s   e Zd ZdZdd„ ZdS )Ú	CohireJobzÀ
  A lalapps_cohire job used by the inspiral pipeline. The stdout and stderr from
  the job are directed to the logs directory. The path to the executable is
  determined from the ini file.
  c             C   s8   d}dg}d}t  | ||||¡ |  d¡ |  d¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    Zcohirer   z1logs/cohire-$(macroifo)-$(cluster)-$(process).outz1logs/cohire-$(macroifo)-$(cluster)-$(process).errN)r   r
   r$   r%   )r   r'   r)   r(   r*   r   r   r	   r
   o  s    
zCohireJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rˆ   i  s   rˆ   c               @   s   e Zd ZdZdd„ ZdS )Ú
InjFindJobz^
  An injfind job. The static options are read from the [injfind]
  section in the cp file.
  c             C   sT   d}dg}d}t  | ||||¡ |  dd¡ |  d| d ¡ |  d| d ¡ dS )	zK
    @param cp: a ConfigParser object from which the options are read.
    Zinjfindr   r4   r5   zlogs/z-$(cluster)-$(process).outz-$(cluster)-$(process).errN)r   r
   r   r$   r%   )r   r'   r)   r(   r*   r   r   r	   r
   ‚  s    zInjFindJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r‰   }  s   r‰   c               @   sh   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ ZdS )ÚInspiralAnalysisNodezL
  An InspiralNode runs an instance of the inspiral code in a Condor DAG.
  c             C   s\   t j | |¡ t j | ¡ | ¡ }d|krHt|d ƒrH|  t|d ƒ¡ d|k| _d| _dS )zL
    job = A CondorDAGJob that can run an instance of lalapps_inspiral.
    zpad-datazwrite-compressFN)	r   ÚCondorDAGNoder
   ÚAnalysisNodeZget_optsra   Zset_pad_dataÚ!_InspiralAnalysisNode__zip_outputÚ&_InspiralAnalysisNode__data_checkpoint)r   ÚjobÚoptsr   r   r	   r
   —  s    
zInspiralAnalysisNode.__init__c             C   s
   || _ dS )z!
    Set the zip output flag
    N)r   )r   Úzipr   r   r	   Úset_zip_output¥  s    z#InspiralAnalysisNode.set_zip_outputc             C   s   | j S )z!
    Set the zip output flag
    )r   )r   r   r   r	   Úget_zip_output«  s    z#InspiralAnalysisNode.get_zip_outputc             C   sœ   |   ¡ r|  ¡ r|  ¡ s tdƒ‚|  ¡ d |  ¡  ¡  ¡  }|  ¡ rT|d|  ¡  7 }|  ¡ rl|d|  ¡  7 }|dt	|   ¡ ƒ d t	|  ¡ |   ¡  ƒ 7 }|S )zº
    Returns the base file name of output from the inspiral code. This is
    assumed to follow the standard naming convention:

    IFO-EXECUTABLE_IFOTAG_USERTAG-GPS_START-DURATION
    z,Start time, end time or ifo has not been setú-Ú_)
Ú	get_startÚget_endÚget_ifor   r   r.   ÚupperÚget_ifo_tagÚget_user_tagÚstr)r   Zfilebaser   r   r	   Úget_output_base±  s    z$InspiralAnalysisNode.get_output_basec             C   sD   |   ¡ }|d|  ¡  ¡  7 }|  ¡ r,|d7 }| jdkr@|  |¡ |S )z›
    Returns the file name of output from the inspiral code. This is obtained
    from the get_output_base() method, with the correct extension added.
    rg   z.gzF)r   r   r0   r“   rŽ   Úadd_output_file)r   Úfilenamer   r   r	   Ú
get_outputÇ  s    

zInspiralAnalysisNode.get_outputc             C   s   |   ¡ }|d7 }|  |¡ |S )z¦
    Returns the file name of condor checkpoint from the inspiral code. This is
    obtained from the get_output_base() method, with the correct extension added.
    z.ckpt)r   rž   )r   rŸ   r   r   r	   Úget_checkpoint_image×  s    
z)InspiralAnalysisNode.get_checkpoint_imagec             C   s   |   dd¡ d| _dS )z9
    Lets it be known that data checkpointing exists
    zdata-checkpointr_   TN)Úadd_var_optrŽ   )r   r   r   r	   Úset_data_checkpointã  s    z(InspiralAnalysisNode.set_data_checkpointc             C   s   | j S )z9
    Lets it be known that data checkpointing exists
    )rŽ   )r   r   r   r	   Úget_data_checkpointê  s    z(InspiralAnalysisNode.get_data_checkpointc             C   s   |   ¡ }|d7 }dS )z³
    Returns the name of the cache file output from the inspiral analysis codes.
    This is obtained from the get_output_base() method, with the correct
    extension added.
    z.cacheN)r   )r   rŸ   r   r   r	   Úget_output_cacheð  s    z%InspiralAnalysisNode.get_output_cachec             C   s   |   ¡ }|d7 }|  |¡ |S )zG
    Returns the file name of output frame from the inspiral code.
    z.gwf)r   rž   )r   Zgwffiler   r   r	   Úget_froutputù  s    
z!InspiralAnalysisNode.get_froutputc             C   s8   |   ¡ r4|  |  ¡ |   ¡  ¡ |  |  ¡ |   ¡  ¡ dS )z3
    set the data_start_time and data_end_time
    N)Zget_pad_dataZset_data_startr–   Zset_data_endr—   )r   r   r   r	   Úfinalize  s
    

zInspiralAnalysisNode.finalizeN)r   r   r   r2   r
   r’   r“   r   r    r¡   r£   r¤   r¥   r¦   r§   r   r   r   r	   rŠ   “  s   	rŠ   c               @   s   e Zd ZdZdd„ ZdS )ÚInspiralPlottingNodez_
  An InspiralPlottingNode runas an instance of the inspiral plotting code in
  a Condor Dag
  c             C   s   t  | |¡ dS )zL
    job = A CondorDAGJob that can run an instance of the plotting code
    N)rŠ   r
   )r   r   r   r   r	   r
     s    zInspiralPlottingNode.__init__N)r   r   r   r2   r
   r   r   r   r	   r¨     s   r¨   c               @   s8   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ ZdS )ÚInspInjNodezU
  A InspInjNode runs an instance of the inspinj generation job in a
  Condor DAG.
  c             C   s   t  | |¡ d| _d| _dS )zK
    job = A CondorDAGJob that can run an instance of lalapps_inspinj.
    N)rŠ   r
   Ú_InspInjNode__outputNameÚ_InspInjNode__seed)r   r   r   r   r	   r
   "  s    zInspInjNode.__init__c             C   s   |   d|¡ || _dS )z
    Set the seed of the injection file by setting a --seed option to the
    node when it is executed.
    @param seed: seed of the job
    ÚseedN)r¢   r«   )r   r¬   r   r   r	   Úset_seed*  s    zInspInjNode.set_seedc             C   s   | j S )z
    return the seed
    )r«   )r   r   r   r	   Úget_seed3  s    zInspInjNode.get_seedc             C   s   |   d|¡ || _dS )zm
    Set the output name of the injection file
    @param outputName: name of the injection file created
    ÚoutputN)r¢   rª   )r   Ú
outputNamer   r   r	   Ú
set_output9  s    zInspInjNode.set_outputc             C   s‚   | j r|  | j ¡ | j S dt|  ¡ ƒ }|  ¡ r@|d|  ¡  7 }|dt|  ¡ ƒ d t|  ¡ |  ¡  ƒ d 7 }|  |¡ |S dS )z|
    Return the manually-set output name if it exists, otherwise, derive the
    name like other InspiralAnalysisNodes.
    zHL-INJECTIONS_r•   r”   z.xmlN)rª   rž   rœ   r®   r›   r–   r—   )r   Z
outputFiler   r   r	   r    A  s    .
zInspInjNode.get_outputN)	r   r   r   r2   r
   r­   r®   r±   r    r   r   r   r	   r©     s   	r©   c               @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	Ú
BbhInjNodezS
  A BbhInjNode runs an instance of the bbhinj generation job in a
  Condor DAG.
  c             C   s   t  | |¡ dS )zJ
    job = A CondorDAGJob that can run an instance of lalapps_bbhinj.
    N)rŠ   r
   )r   r   r   r   r	   r
   X  s    zBbhInjNode.__init__c             C   s   |   d|¡ || _dS )z
    Set the seed of the injection file by setting a --seed option to the
    node when it is executed.
    @param seed: seed of the job
    r¬   N)r¢   Ú_BbhInjNode__seed)r   r¬   r   r   r	   r­   ^  s    zBbhInjNode.set_seedc             C   sê   |   ¡ r|  ¡ stdƒ‚|  ¡ rbd|  ¡  d }|t|   ¡ ƒ d }|t|  ¡ |   ¡  ƒ d }nz| jr¬dt| jƒ d }|t|   ¡ ƒ d }|t|  ¡ |   ¡  ƒ d }n0dt|   ¡ ƒ d }|t|  ¡ |   ¡  ƒ d }|  |¡ |S )zž
    Returns the file name of output from the injection generation code. This
    must be kept synchronized with the name of the output file in bbhinj.c.
    z'Start time or end time has not been setzHL-INJECTIONS_r”   z.xmlzHL-INJECTIONS-)r–   r—   r   r›   rœ   r³   rž   )r   Z	bbhinjectr   r   r	   r    g  s    
zBbhInjNode.get_outputN)r   r   r   r2   r
   r­   r    r   r   r   r	   r²   S  s   	r²   c               @   s   e Zd ZdZdd„ ZdS )ÚTmpltBankNodez]
  A TmpltBankNode runs an instance of the template bank generation job in a
  Condor DAG.
  c             C   s   t  | |¡ dS )zM
    job = A CondorDAGJob that can run an instance of lalapps_tmpltbank.
    N)rŠ   r
   )r   r   r   r   r	   r
   „  s    zTmpltBankNode.__init__N)r   r   r   r2   r
   r   r   r   r	   r´     s   r´   c               @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚRandomBankNodez\
  A RandomBankNode runs an instance of the random bank generation job in a
  Condor DAG.
  c             C   s   t  | |¡ dS )zN
    job = A CondorDAGJob that can run an instance of lalapps_randombank.
    N)rŠ   r
   )r   r   r   r   r	   r
     s    zRandomBankNode.__init__c             C   s€   |   ¡ r|  ¡ stdƒ‚|  ¡ rBd|  ¡  d }|t|   ¡ ƒ }ndt|   ¡ ƒ }|d t|  ¡ |   ¡  ƒ d }|  |¡ |S )z›
    Returns the file name of output from the template bank code. This must
    be kept synchronized with the name of the output file in randombank.c.
    z'Start time or end time has not been setzP-TMPLTBANK_r”   zP-TMPLTBANK-z.xml)r–   r—   r   r›   rœ   rž   )r   Úbankr   r   r	   r    –  s     
zRandomBankNode.get_outputN)r   r   r   r2   r
   r    r   r   r   r	   rµ   ‹  s   rµ   c               @   s@   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dS )ÚSplitBankNodezX
  A SplitBankNode runs an instance of the split template bank job in a
  Condor DAG.
  c             C   s   t  | |¡ d| _d| _dS )zM
    job = A CondorDAGJob that can run an instance of lalapps_tmpltbank.
    N)rŠ   r
   Ú_SplitBankNode__bankfileÚ_SplitBankNode__numbanks)r   r   r   r   r	   r
   ®  s    zSplitBankNode.__init__c             C   s    |   d|¡ |  |¡ || _d S )Nz	bank-file)r¢   Úadd_input_filer¸   )r   r¶   r   r   r	   Úset_bank¶  s    
zSplitBankNode.set_bankc             C   s   | j S )N)r¸   )r   r   r   r	   Úget_bank»  s    zSplitBankNode.get_bankc             C   s   |   d|¡ t|ƒ| _d S )Nznumber-of-banks)r¢   ra   r¹   )r   Znumbanksr   r   r	   Úset_num_banks¾  s    zSplitBankNode.set_num_banksc             C   s   | j S )N)r¹   )r   r   r   r	   Úget_num_banksÂ  s    zSplitBankNode.get_num_banksc          
   C   sp   |   ¡ r|  ¡ stdƒ‚g }| j d¡}xBtdt|  ¡ ƒƒD ],}| d|d |d ||d |d f ¡ q<W |S )z
    Returns a list of the file names of split banks. This must be kept
    synchronized with the name of the output files in splitbank.c.
    z-Bank file or number of banks has not been setr”   r   z%s-%s_%2.2d-%s-%sé   é   é   )r¼   r¾   r   r¸   rm   Úrangera   r@   )r   ZbanksÚxÚir   r   r	   r    Å  s    ,zSplitBankNode.get_outputN)
r   r   r   r2   r
   r»   r¼   r½   r¾   r    r   r   r   r	   r·   ©  s   r·   c               @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ÚInspiralNodezL
  An InspiralNode runs an instance of the inspiral code in a Condor DAG.
  c             C   s   t  | |¡ d| _dS )zL
    job = A CondorDAGJob that can run an instance of lalapps_inspiral.
    N)rŠ   r
   Ú_InspiralNode__injections)r   r   r   r   r	   r
   Ù  s    zInspiralNode.__init__c             C   s   |   d|¡ |  |¡ d S )Nz	bank-file)r¢   rº   )r   r¶   r   r   r	   r»   à  s    zInspiralNode.set_bankc             C   s    || _ |  d|¡ |  |¡ dS )z.
    Set the injection file for this node
    zinjection-fileN)rÆ   r¢   rº   )r   Ú
injectionsr   r   r	   Úset_injectionsä  s    zInspiralNode.set_injectionsc             C   s   | j S )z$
    Returns the injection file
    )rÆ   )r   r   r   r	   Úget_injectionsì  s    zInspiralNode.get_injectionsN)r   r   r   r2   r
   r»   rÈ   rÉ   r   r   r   r	   rÅ   Õ  s
   rÅ   c               @   s@   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dS )ÚInspiralCkptNodez…
  An InspiralCkptNode runs an instance of the inspiral code in a Condor DAG.
  It then checkpoints to a file. This sets the file.
  c             C   s   t  | |¡ d| _d| _dS )zL
    job = A CondorDAGJob that can run an instance of lalapps_inspiral.
    N)rŠ   r
   Ú_InspiralCkptNode__outfileÚ_InspiralCkptNode__injections)r   r   r   r   r	   r
   ø  s    zInspiralCkptNode.__init__c             C   s
   || _ dS )z‰
    Sets a placeholder output name which we can use to pass through the
    name of the output file from the original inspiral job.
    N)rË   )r   Úoutfiler   r   r	   r±      s    zInspiralCkptNode.set_outputc             C   s   | j r|  | j ¡ | j S )z1
    Returns the filename from set_output().
    )rË   rž   )r   r   r   r	   r      s    zInspiralCkptNode.get_outputc             C   s
   || _ dS )z.
    Set the injection file for this node
    N)rÌ   )r   rÇ   r   r   r	   rÈ     s    zInspiralCkptNode.set_injectionsc             C   s   | j S )z$
    Returns the injection file
    )rÌ   )r   r   r   r	   rÉ     s    zInspiralCkptNode.get_injectionsc             C   s   |   |¡ | jd|dd dS )zÈ
    Adds the argument -_condor_restart for the
    cases in which we want to checkpoint and grabs the
    checkpoint image name from get_checkpoint_image in
    the InspiralAnalysisCode section.
    Z_condor_restartT)ÚshortN)rº   r¢   )r   Zckptinr   r   r	   Úset_checkpoint_image  s    
z%InspiralCkptNode.set_checkpoint_imageN)
r   r   r   r2   r
   r±   r    rÈ   rÉ   rÏ   r   r   r   r	   rÊ   ó  s   rÊ   c               @   sH   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dS )ÚPTFInspiralNodezL
  An InspiralNode runs an instance of the inspiral code in a Condor DAG.
  c             C   s    t  | |¡ d| _|  d¡ dS )zL
    job = A CondorDAGJob that can run an instance of lalapps_inspiral.
    NT)rŠ   r
   Ú_PTFInspiralNode__injectionsr’   )r   r   r   r   r	   r
   *  s    zPTFInspiralNode.__init__c             C   s   |   d|¡ |  |¡ d S )Nz	spin-bank)r¢   rº   )r   r¶   r   r   r	   Úset_spin_bank2  s    zPTFInspiralNode.set_spin_bankc             C   s   |   d|¡ |  |¡ d S )Nznon-spin-bank)r¢   rº   )r   r¶   r   r   r	   Úset_no_spin_bank6  s    z PTFInspiralNode.set_no_spin_bankc             C   s   |   d|  ¡ d ¡ d S )Nzoutput-filez.xml.gz)r¢   r   )r   r   r   r	   r±   :  s    zPTFInspiralNode.set_outputc             C   s    || _ |  d|¡ |  |¡ dS )z.
    Set the injection file for this node
    zinjection-fileN)rÑ   r¢   rº   )r   rÇ   r   r   r	   rÈ   =  s    zPTFInspiralNode.set_injectionsc             C   s   | j S )z$
    Returns the injection file
    )rÑ   )r   r   r   r	   rÉ   E  s    zPTFInspiralNode.get_injectionsc             C   s   |   d|¡ d S )Nzrandom-seed)r¢   )r   r¬   r   r   r	   r­   K  s    zPTFInspiralNode.set_seedN)r   r   r   r2   r
   rÒ   rÓ   r±   rÈ   rÉ   r­   r   r   r   r	   rÐ   &  s   rÐ   c               @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ÚPTFSpinCheckerNodezL
  An InspiralNode runs an instance of the inspiral code in a Condor DAG.
  c             C   s   t  | |¡ d| _dS )zL
    job = A CondorDAGJob that can run an instance of lalapps_inspiral.
    N)rŠ   r
   Z_PTFSpinCheckerNode__injections)r   r   r   r   r	   r
   S  s    zPTFSpinCheckerNode.__init__c             C   s   |   d|¡ |  |¡ d S )Nz	bank-file)r¢   rº   )r   r¶   r   r   r	   r»   Z  s    zPTFSpinCheckerNode.set_bankc             C   s   |   d|¡ d S )Nz	spin-bank)r¢   )r   ZspinBankr   r   r	   Úset_spin_output^  s    z"PTFSpinCheckerNode.set_spin_outputc             C   s   |   d|¡ d S )Nznon-spin-bank)r¢   )r   Z
noSpinBankr   r   r	   Úset_nospin_outputa  s    z$PTFSpinCheckerNode.set_nospin_outputN)r   r   r   r2   r
   r»   rÕ   rÖ   r   r   r   r	   rÔ   O  s
   rÔ   c               @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ÚTrigbankNodezX
  A TrigbankNode runs an instance of the triggered bank generator in a
  Condor DAG.
  c             C   s   t  | |¡ d| _dS )zD
    job = A CondorDAGJob that can run an instance of trigbank.
    N)rŠ   r
   Ú_TrigbankNode__input_ifo)r   r   r   r   r	   r
   j  s    zTrigbankNode.__init__c             C   s   |   d|¡ || _d S )Nz	input-ifo)r¢   rØ   )r   Úifor   r   r	   Úset_input_ifoq  s    zTrigbankNode.set_input_ifoc             C   s   | j S )N)rØ   )r   r   r   r	   Úget_input_ifou  s    zTrigbankNode.get_input_ifoc             C   s   |   d|¡ |  |¡ d S )Nz
output-ifo)r¢   Úset_ifo)r   rÙ   r   r   r	   Úset_output_ifox  s    zTrigbankNode.set_output_ifoN)r   r   r   r2   r
   rÚ   rÛ   rÝ   r   r   r   r	   r×   e  s
   r×   c               @   sP   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ ZdS )ÚIncaNodezV
  An IncaNode runs an instance of the inspiral coincidence code in a Condor
  DAG.
  c             C   s   t  | |¡ d| _d| _dS )zH
    job = A CondorDAGJob that can run an instance of lalapps_inca.
    N)rŠ   r
   Ú_IncaNode__ifo_aÚ_IncaNode__ifo_b)r   r   r   r   r	   r
   ‚  s    zIncaNode.__init__c             C   s   |   d|¡ || _dS )z^
    Set the interferometer code to use as IFO A.
    ifo = IFO code (e.g. L1, H1 or H2).
    zifo-aN)r¢   rß   )r   rÙ   r   r   r	   Ú	set_ifo_aŠ  s    zIncaNode.set_ifo_ac             C   s   | j S )z=
    Returns the IFO code of the primary interferometer.
    )rß   )r   r   r   r	   Ú	get_ifo_a’  s    zIncaNode.get_ifo_ac             C   s   |   d|¡ || _dS )z^
    Set the interferometer code to use as IFO B.
    ifo = IFO code (e.g. L1, H1 or H2).
    zifo-bN)r¢   rà   )r   rÙ   r   r   r	   Ú	set_ifo_b˜  s    zIncaNode.set_ifo_bc             C   s   | j S )z=
    Returns the IFO code of the primary interferometer.
    )rà   )r   r   r   r	   Ú	get_ifo_b   s    zIncaNode.get_ifo_bc             C   sª   |   ¡ r|  ¡ r|  ¡ s tdƒ‚|  ¡ d }|  ¡ rD|d|  ¡  7 }|  ¡ r\|d|  ¡  7 }|d t|   ¡ ƒ d t|  ¡ |   ¡  ƒ d }|  ¡ rœ|d7 }|  |¡ |S )z
    Returns the file name of output from inca for ifo a. This must be kept
    synchronized with the name of the output file in inca.c.
    z.Start time, end time or ifo a has not been setz-INCAr•   r”   z.xmlz.gz)	r–   r—   râ   r   rš   r›   rœ   r“   rž   )r   ÚbasenamerŸ   r   r   r	   Úget_output_a¦  s    0
zIncaNode.get_output_ac             C   s   |   ¡ S )N)ræ   )r   r   r   r	   r    ¾  s    zIncaNode.get_outputc             C   sª   |   ¡ r|  ¡ r|  ¡ s tdƒ‚|  ¡ d }|  ¡ rD|d|  ¡  7 }|  ¡ r\|d|  ¡  7 }|d t|   ¡ ƒ d t|  ¡ |   ¡  ƒ d }|  ¡ rœ|d7 }|  |¡ |S )z
    Returns the file name of output from inca for ifo b. This must be kept
    synchronized with the name of the output file in inca.c.
    z.Start time, end time or ifo a has not been setz-INCAr•   r”   z.xmlz.gz)	r–   r—   rä   r   rš   r›   rœ   r“   rž   )r   rå   rŸ   r   r   r	   Úget_output_bÁ  s    0
zIncaNode.get_output_bN)r   r   r   r2   r
   rá   râ   rã   rä   ræ   r    rç   r   r   r   r	   rÞ   }  s   rÞ   c               @   sr   e Zd ZdZdd„ Zddd„Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ ZdS )Ú
ThincaNodezW
  A ThincaNode runs an instance of the inspiral coincidence code in a Condor
  DAG.
  c             C   s:   t  | |¡ d| _d| _d| _d| _d| _d| _d| _dS )zH
    job = A CondorDAGJob that can run an instance of lalapps_inca.
    N)	rŠ   r
   Ú_ThincaNode__ifo_g1Ú_ThincaNode__ifo_h1Ú_ThincaNode__ifo_h2Ú_ThincaNode__ifo_l1Ú_ThincaNode__ifo_t1Ú_ThincaNode__ifo_v1Ú_ThincaNode__num_slides)r   r   r   r   r	   r
   ß  s    zThincaNode.__init__Tc             C   sÂ   |dkr |r|   dd¡ d| _nž|dkr@|r8|   dd¡ d| _n~|dkr`|rX|   dd¡ d| _n^|dkr€|rx|   d	d¡ d| _n>|d
kr |r˜|   dd¡ d
| _n|dkr¾|r¸|   dd¡ d| _dS )zµ
    Add the interferometer to the list of ifos
    ifo = IFO code (e.g. G1,L1,V1,T1, H1 or H2).
    pass_to_command_line = boolean for adding ifo-triggers as a variable option
    ÚG1zg1-triggersr_   ÚH1zh1-triggersÚH2zh2-triggersÚL1zl1-triggersÚT1zt1-triggersÚV1zv1-triggersN)r¢   ré   rê   rë   rì   rí   rî   )r   rÙ   Zpass_to_command_liner   r   r	   rÜ   ì  s0    zThincaNode.set_ifoc             C   s   | j S )z%
    Returns the IFO code of g1.
    )ré   )r   r   r   r	   Ú
get_ifo_g1  s    zThincaNode.get_ifo_g1c             C   s   | j S )z%
    Returns the IFO code of h1.
    )rê   )r   r   r   r	   Ú
get_ifo_h1  s    zThincaNode.get_ifo_h1c             C   s   | j S )z%
    Returns the IFO code of h2.
    )rë   )r   r   r   r	   Ú
get_ifo_h2  s    zThincaNode.get_ifo_h2c             C   s   | j S )z%
    Returns the IFO code of l1.
    )rì   )r   r   r   r	   Ú
get_ifo_l1  s    zThincaNode.get_ifo_l1c             C   s   | j S )z%
    Returns the IFO code of t1.
    )rí   )r   r   r   r	   Ú
get_ifo_t1%  s    zThincaNode.get_ifo_t1c             C   s   | j S )z%
    Returns the IFO code of v1.
    )rî   )r   r   r   r	   Ú
get_ifo_v1+  s    zThincaNode.get_ifo_v1c             C   s€   d}|   ¡ r||   ¡ 7 }|  ¡ r,||  ¡ 7 }|  ¡ r@||  ¡ 7 }|  ¡ rT||  ¡ 7 }|  ¡ rh||  ¡ 7 }|  ¡ r|||  ¡ 7 }|S )z+
    Returns the ordered list of ifos.
    r_   )rö   r÷   rø   rù   rú   rû   )r   Úifosr   r   r	   Úget_ifos1  s    zThincaNode.get_ifosc             C   s   |   d|¡ || _dS )z0
    Set number of time slides to undertake
    z
num-slidesN)r¢   rï   )r   Ú
num_slidesr   r   r	   Úset_num_slidesE  s    zThincaNode.set_num_slidesc             C   s   | j S )zF
    Returns the num_slides from .ini (>0 => time slides desired)
    )rï   )r   r   r   r	   Úget_num_slidesL  s    zThincaNode.get_num_slidesc             C   sâ   |   ¡ r|  ¡ r|  ¡ s tdƒ‚| jrH|  ¡ d |  ¡  ¡  ¡  d }n|  ¡ d |  ¡  ¡  ¡  }|  ¡ r||d|  ¡  7 }|  	¡ r”|d|  	¡  7 }|d t
|   ¡ ƒ d t
|  ¡ |   ¡  ƒ d }|  ¡ rÔ|d7 }|  |¡ |S )zˆ
    Returns the file name of output from thinca.  This must be kept
    synchronized with the name of the output file in thinca.c.
    z.Start time, end time or ifos have not been setr”   Ú_SLIDEr•   z.xmlz.gz)r–   r—   rý   r   rï   r   r.   r™   rš   r›   rœ   r“   rž   )r   rå   rŸ   r   r   r	   r    R  s    "0
zThincaNode.get_outputN)T)r   r   r   r2   r
   rÜ   rö   r÷   rø   rù   rú   rû   rý   rÿ   r   r    r   r   r   r	   rè   Ú  s   
!rè   c               @   s€   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZdS )ÚThincaToCoincNodezL
  A ThincaToCoincNode runs an instance of a ThincaToCoincJob
  in a DAG.
  c             C   s4   t  | |¡ d| _d| _d| _d| _d| _d| _dS )z)
    @param job: A ThincaToCoincJob.
    N)rŠ   r
   Ú_ThincaToCoincNode__input_cacheÚ_ThincaToCoincNode__instrumentsÚ!_ThincaToCoincNode__zero_lag_fileÚ#_ThincaToCoincNode__time_slide_fileÚ!_ThincaToCoincNode__veto_segmentsÚ&_ThincaToCoincNode__veto_segments_name)r   r   r   r   r	   r
   t  s    zThincaToCoincNode.__init__c             C   s   |   d|¡ || _dS )zP
    @param input_cache_name: cache file for thinca_to_coinc to
      read.
    zihope-cacheN)rp   r  )r   Úinput_cache_namer   r   r	   Úset_input_cache€  s    z!ThincaToCoincNode.set_input_cachec             C   s   | j S )z1
    Returns input cache file for this node.
    )r  )r   r   r   r	   Úget_input_cacheˆ  s    z!ThincaToCoincNode.get_input_cachec             C   sB   | j stdƒ‚t| j dƒ}t ¡  |¡j|d}dd„ |D ƒ}|S )aJ  
    Returns a list of files that this node will generate using the input_cache.
    The output file names are the same as the input urls, but with the
    zero_lag 'THINCA' file replaced with 'THINCA_TO_COINC', and with the
    filepaths  pointing to the current directory in which the
    thinca_to_coinc node is being run.
    zno input-cache specifiedÚr)Údescriptionc             S   s2   g | ]*}d   t ¡ t ddtj |j¡¡g¡‘qS )ú/ZINCAZINCA_TO_COINC)Újoinrk   ÚgetcwdrT   Úsubrl   rå   Úurl)Ú.0Úentryr   r   r	   ú
<listcomp>œ  s   z;ThincaToCoincNode.get_output_from_cache.<locals>.<listcomp>)r  Ú
ValueErrorÚopenr   ÚCacheÚfromfileÚsieve)r   Zcoinc_file_tagÚfpÚinput_cacheZoutput_filesr   r   r	   Úget_output_from_cacheŽ  s    z'ThincaToCoincNode.get_output_from_cachec             C   s   |   d|¡ || _dS )zp
    @param instruments: instruments that are on for the
     THINCA files thinca_to_coinc is operating on.
    ÚinstrumentsN)r¢   r  )r   r  r   r   r	   Úset_instruments¡  s    z!ThincaToCoincNode.set_instrumentsc             C   s   | j S )z,
    Returns instruments for this node.
    )r  )r   r   r   r	   Úget_instruments©  s    z!ThincaToCoincNode.get_instrumentsc             C   s   |   d|¡ || _dS )zO
    @param veto_segments: name of xml file containing the vetoes to apply
    zveto-segmentsN)r¢   r  )r   Zveto_segmentsr   r   r	   Úset_veto_segments¯  s    z#ThincaToCoincNode.set_veto_segmentsc             C   s   | j S )zC
    Returns the name of the veto-segments file for this node.
    )r  )r   r   r   r	   Úget_veto_segments¶  s    z#ThincaToCoincNode.get_veto_segmentsc             C   s   |   d|¡ || _dS )zX
    @param veto_segments_name: name of vetoes in the vetoes xml file to
    apply.
    zveto-segments-nameN)r¢   r  )r   Zveto_segments_namer   r   r	   Úset_veto_segments_name¼  s    z(ThincaToCoincNode.set_veto_segments_namec             C   s   | j S )z?
    Returns the name of the vetoes applied for this node.
    )r  )r   r   r   r	   Úget_veto_segments_nameÄ  s    z(ThincaToCoincNode.get_veto_segments_namec             C   s   |   d|¡ || _dS )z'
    Sets zero_lag_file for input.
    zzero-lag-fileN)rp   r  )r   Zzero_lag_filer   r   r	   Úset_zero_lag_fileÊ  s    z#ThincaToCoincNode.set_zero_lag_filec             C   s   | j S )z 
    Returns zero_lag_file.
    )r  )r   r   r   r	   Úget_zero_lag_fileÑ  s    z#ThincaToCoincNode.get_zero_lag_filec             C   s   |   d|¡ || _dS )z-
    Sets the time_slide_file for input.
    ztime-slide-fileN)rp   r  )r   Ztime_slide_filer   r   r	   Úset_time_slide_file×  s    z%ThincaToCoincNode.set_time_slide_filec             C   s   | j S )z&
    Returns the time_slide_file.
    )r  )r   r   r   r	   Úget_time_slide_fileÞ  s    z%ThincaToCoincNode.get_time_slide_fileN)r   r   r   r2   r
   r
  r  r  r  r   r!  r"  r#  r$  r%  r&  r'  r(  r   r   r   r	   r  o  s   r  c               @   s@   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dS )ÚHWinjPageNodezD
  A HWinjPageNode runs an instance of a HWinjPageJob
  in a DAG.
  c             C   s.   t  | |¡ d| _d| _d| _d| _d| _dS )z%
    @param job: A HWinjPageJob.
    N)rŠ   r
   Ú_HWinjPageNode__input_cacheÚ_HWinjPageNode__cache_stringÚ_HWinjPageNode__outfileZ_HWinjPageNode__segment_dirÚ_HWinjPageNode__source_xml)r   r   r   r   r	   r
   é  s    zHWinjPageNode.__init__c             C   s   |   d|¡ || _dS )z[
    @param input_cache_name: cache file for ligolw_cbc_hardware_inj_page
    to read.
    z
cache-fileN)r¢   r*  )r   r	  r   r   r	   r
  ô  s    zHWinjPageNode.set_input_cachec             C   s   |   d|¡ || _dS )zP
    input_cache_name: cache file for ligolw_cbc_hardware_inj_page to read.
    z
source-xmlN)r¢   r-  )r   Z
source_xmlr   r   r	   Úset_source_xmlü  s    zHWinjPageNode.set_source_xmlc             C   s   |   d|¡ || _dS )zB
    @param cache_string: pattern to match files within cache
    zcache-patternN)r¢   r+  )r   Úcache_stringr   r   r	   Úset_cache_string  s    zHWinjPageNode.set_cache_stringc             C   s   |   d|¡ || _dS )z8
    @param outfile_name: Name of hw injection page
    rÍ   N)r¢   r,  )r   Zoutfile_namer   r   r	   Úset_output_file
  s    zHWinjPageNode.set_output_filec             C   s   |   d|¡ dS )z?
    @param dir: directory in which to find hwinj segments
    zsegment-dirN)r¢   )r   Údirr   r   r	   Úset_segment_dir  s    zHWinjPageNode.set_segment_dirN)
r   r   r   r2   r
   r
  r.  r0  r1  r3  r   r   r   r	   r)  ä  s   r)  c               @   s€   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZdS )ÚSireNodezW
  A SireNode runs an instance of the single inspiral reader code in a Condor
  DAG.
  c             C   s   t  | |¡ d| _d| _dS )zH
    job = A CondorDAGJob that can run an instance of lalapps_sire.
    N)rŠ   r
   Ú_SireNode__injection_fileÚ_SireNode__ifo_tag)r   r   r   r   r	   r
     s    zSireNode.__init__c             C   s   || _ |  d|¡ dS )z)
    Add the list of interferometers
    zifo-cutN)Ú_SireNode__ifor¢   )r   rÙ   r   r   r	   rÜ   $  s    zSireNode.set_ifoc             C   s   | j S )z8
    Returns the two letter IFO code for this node.
    )r7  )r   r   r   r	   r˜   +  s    zSireNode.get_ifoc             C   s   || _ |  d|¡ dS )z!
    Sets the injection file
    zinjection-fileN)r5  r¢   )r   r   r   r   r	   Úset_inj_file1  s    zSireNode.set_inj_filec             C   s   | j S )z!
    Gets the injection file
    )r5  )r   r   r   r	   Úget_inj_file8  s    zSireNode.get_inj_filec             C   s
   || _ dS )z
    Sets GPS start time
    N)Ú_SireNode__start)r   Ústartr   r   r	   Ú	set_start>  s    zSireNode.set_startc             C   s   | j S )z
    Gets GPS start time
    )r:  )r   r   r   r	   r–   D  s    zSireNode.get_startc             C   s
   || _ dS )z
    Sets GPS end time
    N)Ú_SireNode__end)r   Úendr   r   r	   Úset_endJ  s    zSireNode.set_endc             C   s   | j S )z
    Gets GPS end time
    )r=  )r   r   r   r	   r—   P  s    zSireNode.get_endc             C   s
   || _ dS )zx
    Set the ifo tag that is passed to the analysis code.
    @param ifo_tag: a string to identify one or more IFOs
    N)r6  )r   Úifo_tagr   r   r	   Úset_ifo_tagV  s    zSireNode.set_ifo_tagc             C   s   | j S )z$
    Returns the IFO tag string
    )r6  )r   r   r   r	   rš   ]  s    zSireNode.get_ifo_tagc             C   sâ   |   ¡ stdƒ‚|   ¡ d }|  ¡ rF|d|  ¡  d¡d  7 }|d7 }|  ¡ r^|d|  ¡  7 }|  ¡ rv|d|  ¡  7 }|  ¡ r†|  ¡ r–|  ¡ rž|  ¡ sžtdƒ‚|  ¡ rÖ|  ¡ |  ¡  }|dt|  ¡ ƒ d t|ƒ 7 }|d7 }|S )	z)
    get the name of the output file
    zifos have not been setz-SIREr•   r”   r¿   Ú_FOUNDz,If one of start and end is set, both must bez.xml)	r˜   r   r9  rm   rš   r›   r–   r—   rœ   )r   rt   Údurationr   r   r	   r    c  s$       zSireNode.get_outputc             C   s    |   ¡ r|  ¡  dd¡S dS dS )z)
    get the name of the missed file
    ÚFOUNDÚMISSEDN)r9  r    Úreplace)r   r   r   r	   Ú
get_missed~  s    zSireNode.get_missedc             C   s`   |   ¡ }| jd|dd | jd| dd¡dd |  ¡ r\|  d|  ¡ ¡ | jd|  ¡ dd d	S )
z 
    set the output options
    r¯   T)Úfile_is_output_fileÚsummaryr   Útxtzinjection-filezmissed-injectionsN)r    rp   rF  r9  rG  )r   r¯   r   r   r	   r§   ‡  s    zSireNode.finalizeN)r   r   r   r2   r
   rÜ   r˜   r8  r9  r<  r–   r?  r—   rA  rš   r    rG  r§   r   r   r   r	   r4    s   	r4  c               @   s    e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Zd&S )'Ú	CoireNodezP
  A CoireNode runs an instance of the inspiral coire code in a Condor
  DAG.
  c             C   s.   t  | |¡ d| _d| _d| _d| _d| _dS )zI
    job = A CondorDAGJob that can run an instance of lalapps_coire.
    N)rŠ   r
   Ú_CoireNode__ifosÚ_CoireNode__ifo_tagÚ_CoireNode__num_slidesÚ_CoireNode__injection_fileÚ_CoireNode__output_tag)r   r   r   r   r	   r
   ™  s    zCoireNode.__init__c             C   s
   || _ dS )z)
    Add the list of interferometers
    N)rL  )r   rü   r   r   r	   Úset_ifos¤  s    zCoireNode.set_ifosc             C   s   | j S )z
    Returns the ifos
    )rL  )r   r   r   r	   rý   ª  s    zCoireNode.get_ifosc             C   s   || _ |  d|¡ dS )z'
    Add the number of time slides
    z
num-slidesN)rN  r¢   )r   Úslidesr   r   r	   Ú
set_slides°  s    zCoireNode.set_slidesc             C   s   | j S )z&
    Returns the number of slides
    )rN  )r   r   r   r	   Ú
get_slides·  s    zCoireNode.get_slidesc             C   s   |r|| _ |  d|¡ dS )z!
    Sets the injection file
    zinjection-fileN)rO  r¢   )r   r   r   r   r	   r8  ½  s    zCoireNode.set_inj_filec             C   s   | j S )z!
    Gets the injection file
    )rO  )r   r   r   r	   r9  Å  s    zCoireNode.get_inj_filec             C   s
   || _ dS )z
    Sets GPS start time
    N)Ú_CoireNode__start)r   r;  r   r   r	   r<  Ë  s    zCoireNode.set_startc             C   s   | j S )z
    Gets GPS start time
    )rU  )r   r   r   r	   r–   Ñ  s    zCoireNode.get_startc             C   s
   || _ dS )z
    Sets GPS end time
    N)Ú_CoireNode__end)r   r>  r   r   r	   r?  ×  s    zCoireNode.set_endc             C   s   | j S )z
    Gets GPS end time
    )rV  )r   r   r   r	   r—   Ý  s    zCoireNode.get_endc             C   s
   || _ dS )zx
    Set the ifo tag that is passed to the analysis code.
    @param ifo_tag: a string to identify one or more IFOs
    N)rM  )r   r@  r   r   r	   rA  ã  s    zCoireNode.set_ifo_tagc             C   s   | j S )z$
    Returns the IFO tag string
    )rM  )r   r   r   r	   rš   ê  s    zCoireNode.get_ifo_tagc             C   s˜   |   ¡  ¡  ¡ }|  ¡ r |d7 }|  ¡ r^|d|  ¡  d¡d  d¡d  d¡d  7 }|d	7 }|  ¡ rv|d|  ¡  7 }|  ¡ rŽ|d|  ¡  7 }|| _d S )
Nr  r•   r  rf   rg   r   r”   r¿   rB  )	r   r.   r™   rT  r9  rm   rš   r›   rP  )r   rt   r   r   r	   Úset_output_tagð  s     *  zCoireNode.set_output_tagc             C   s   | j S )N)rP  )r   r   r   r	   Úget_output_tagû  s    zCoireNode.get_output_tagc             C   s˜   |   ¡ stdƒ‚|  ¡  |   ¡ d |  ¡  }|  ¡ r<|  ¡ rL|  ¡ rT|  ¡ sTtdƒ‚|  ¡ rŒ|  ¡ |  ¡  }|dt|  ¡ ƒ d t|ƒ 7 }|d7 }|S )z)
    get the name of the output file
    zifos have not been setr”   z,If one of start and end is set, both must bez.xml)rý   r   rW  rX  r–   r—   rœ   )r   rt   rC  r   r   r	   r    þ  s     zCoireNode.get_outputc             C   s    |   ¡ r|  ¡  dd¡S dS dS )z)
    get the name of the missed file
    rD  rE  N)r9  r    rF  )r   r   r   r	   rG    s    zCoireNode.get_missedc             C   s`   |   ¡ }| jd|dd | jd| dd¡dd |  ¡ r\|  d|  ¡ ¡ | jd|  ¡ dd d	S )
z 
    set the output options
    r¯   T)rH  rI  r   rJ  zinjection-filezmissed-injectionsN)r    rp   rF  r9  rG  )r   r¯   r   r   r	   r§     s    zCoireNode.finalizeN)r   r   r   r2   r
   rQ  rý   rS  rT  r8  r9  r<  r–   r?  r—   rA  rš   rW  rX  r    rG  r§   r   r   r   r	   rK  ”  s&   	rK  c               @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	Ú
FrJoinNodezE
  A FrJoinNode runs an instance of lalapps_frjoin in a Condor DAG
  c             C   s   t  | |¡ dS )zJ
    job = A CondorDAGJob that can run an instance of lalapps_frjoin.
    N)rŠ   r
   )r   r   r   r   r	   r
   0  s    zFrJoinNode.__init__c             C   s&   |   d|¡ | jd|dd || _dS )zi
    Set the output name of the frame file
    @param outputName: name of the injection file created
    r¯   T)rH  N)r¢   rp   Ú_FrJoinNode__outputName)r   r°   r   r   r	   r±   6  s    zFrJoinNode.set_outputc             C   s   | j S )z/
    Get the output name of the frame file
    )rZ  )r   r   r   r	   r    ?  s    zFrJoinNode.get_outputN)r   r   r   r2   r
   r±   r    r   r   r   r	   rY  ,  s   	rY  c               @   sP   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ ZdS )ÚCohBankNodezJ
  A CohBankNode runs an instance of the coherent code in a Condor DAG.
  c             C   s   t  | |¡ d| _d| _dS )zU
    job = A CondorDAGJob that can run an instance of lalapps_coherent_inspiral.
    N)rŠ   r
   Ú_CohBankNode__bankÚ_CohBankNode__ifos)r   r   r   r   r	   r
   J  s    zCohBankNode.__init__c             C   s    |   d|¡ |  |¡ || _d S )Nz	bank-file)r¢   rº   r\  )r   r¶   r   r   r	   r»   R  s    
zCohBankNode.set_bankc             C   s   | j S )N)r\  )r   r   r   r	   r¼   W  s    zCohBankNode.get_bankc             C   sª   |dkr|   dd¡ d| _nŠ|dkr8|   dd¡ d| _nn|dkrT|   dd¡ d| _nR|dkrp|   d	d¡ d| _n6|d
krŒ|   dd¡ d
| _n|dkr¦|   dd¡ d| _dS )z_
    Add the interferometer to the list of ifos
    ifo = IFO code (e.g. G1,L1, H1 or H2).
    rð   zg1-triggersr_   rñ   zh1-triggersrò   zh2-triggersró   zl1-triggersrô   zt1-triggersrõ   zv1-triggersN)r¢   Z_CohBankNode__ifo_g1Z_CohBankNode__ifo_h1Z_CohBankNode__ifo_h2Z_CohBankNode__ifo_l1Z_CohBankNode__ifo_t1Z_CohBankNode__ifo_v1)r   rÙ   r   r   r	   rÜ   Z  s$    zCohBankNode.set_ifoc             C   s   |   d|¡ || _d S )Nrü   )r¢   r]  )r   rü   r   r   r	   rQ  r  s    zCohBankNode.set_ifosc             C   s   | j S )N)r]  )r   r   r   r	   rý   v  s    zCohBankNode.get_ifosc             C   s   |   d|¡ || _dS )z0
    Set number of time slides to undertake
    z
num-slidesN)r¢   Z_CohBankNode__num_slides)r   rþ   r   r   r	   rÿ   y  s    zCohBankNode.set_num_slidesc             C   s‚   |   ¡ stdƒ‚|   ¡ d }|  ¡ r4|d|  ¡  7 }|d t|  ¡ ƒ d t|  ¡ |  ¡  ƒ d }|  ¡ rt|d7 }|  |¡ |S )zA
    Returns the file name of output from the coherent bank.
    zIfos have not been setz-COHBANKr•   r”   z.xmlz.gz)rý   r   r›   rœ   r–   r—   r“   rž   )r   rå   rŸ   r   r   r	   r    €  s    0
zCohBankNode.get_outputN)r   r   r   r2   r
   r»   r¼   rÜ   rQ  rý   rÿ   r    r   r   r   r	   r[  F  s   r[  c               @   sH   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dS )ÚCohInspBankNodezJ
  A CohBankNode runs an instance of the coherent code in a Condor DAG.
  c             C   s   t  | |¡ d| _d| _dS )zU
    job = A CondorDAGJob that can run an instance of lalapps_coherent_inspiral.
    N)rŠ   r
   Ú_CohInspBankNode__bankÚ_CohInspBankNode__ifos)r   r   r   r   r	   r
   œ  s    zCohInspBankNode.__init__c             C   s    |   d|¡ |  |¡ || _d S )Nz	bank-file)r¢   rº   r_  )r   r¶   r   r   r	   r»   ¤  s    
zCohInspBankNode.set_bankc             C   s   | j S )N)r_  )r   r   r   r	   r¼   ©  s    zCohInspBankNode.get_bankc             C   s   |   d|¡ || _d S )Nrü   )r¢   r`  )r   rü   r   r   r	   rQ  ¬  s    zCohInspBankNode.set_ifosc             C   s   | j S )N)r`  )r   r   r   r	   rý   °  s    zCohInspBankNode.get_ifosc             C   s   |   d|¡ || _dS )z0
    Set number of time slides to undertake
    z
num-slidesN)r¢   Z_CohInspBankNode__num_slides)r   rþ   r   r   r	   rÿ   ³  s    zCohInspBankNode.set_num_slidesc             C   s‚   |   ¡ stdƒ‚|   ¡ d }|  ¡ r4|d|  ¡  7 }|d t|  ¡ ƒ d t|  ¡ |  ¡  ƒ d }|  ¡ rt|d7 }|  |¡ |S )
zA
    Returns the file name of output from the coherent bank.
    zIfos have not been setz-COHINSPBANKr•   r”   z.xmlz.gzzlogs/z-$(cluster)-$(process).outz-$(cluster)-$(process).err)rý   r   r›   rœ   r–   r—   r“   rž   r$   r)   r%   )r   rå   rŸ   r   r   r	   r    º  s    0
 zCohInspBankNode.get_outputN)r   r   r   r2   r
   r»   r¼   rQ  rý   rÿ   r    r   r   r   r	   r^  ˜  s   r^  c               @   s8   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ ZdS )ÚChiaNodezR
  A ChiaNode runs an instance of the coherent_inspiral code in a Condor
  DAG.
  c             C   s   t  | |¡ dS )zU
    job = A CondorDAGJob that can run an instance of lalapps_coherent_inspiral.
    N)rŠ   r
   )r   r   r   r   r	   r
   Û  s    zChiaNode.__init__c             C   s   |   d|¡ |  |¡ d S )Nz	bank-file)r¢   rº   )r   r¶   r   r   r	   r»   á  s    zChiaNode.set_bankc             C   s
   || _ dS )zx
    Set the ifo tag that is passed to the analysis code.
    @param ifo_tag: a string to identify one or more IFOs
    N)Ú_ChiaNode__ifo_tag)r   r@  r   r   r	   rA  å  s    zChiaNode.set_ifo_tagc             C   s   | j S )z$
    Returns the IFO tag string
    )rb  )r   r   r   r	   rš   ì  s    zChiaNode.get_ifo_tagc             C   s’   |   ¡ r|  ¡ r|  ¡ s tdƒ‚|  ¡ d }|  ¡ rD|d|  ¡  7 }|d t|   ¡ ƒ d t|  ¡ |   ¡  ƒ d }|  ¡ r„|d7 }|  |¡ |S )zA
    Returns the file name of output from coherent inspiral.
    z.Start time, end time or ifos have not been setz-CHIAr•   r”   z.xmlz.gz)r–   r—   rš   r   r›   rœ   r“   rž   )r   rå   rŸ   r   r   r	   r    ò  s    0
zChiaNode.get_outputN)	r   r   r   r2   r
   r»   rA  rš   r    r   r   r   r	   ra  Ö  s   ra  c               @   s    e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Zd&S )'Ú
CohireNodezR
  A CohireNode runs an instance of the inspiral cohire code in a Condor
  DAG.
  c             C   s.   t  | |¡ d| _d| _d| _d| _d| _dS )zJ
    job = A CondorDAGJob that can run an instance of lalapps_cohire.
    N)rŠ   r
   Ú_CohireNode__ifosÚ_CohireNode__ifo_tagÚ_CohireNode__num_slidesÚ_CohireNode__injection_fileÚ_CohireNode__output_tag)r   r   r   r   r	   r
     s    zCohireNode.__init__c             C   s
   || _ dS )z)
    Add the list of interferometers
    N)rd  )r   rü   r   r   r	   rQ    s    zCohireNode.set_ifosc             C   s   | j S )z
    Returns the ifos
    )rd  )r   r   r   r	   rý     s    zCohireNode.get_ifosc             C   s   || _ |  d|¡ dS )z'
    Add the number of time slides
    z
num-slidesN)rf  r¢   )r   rR  r   r   r	   rS  $  s    zCohireNode.set_slidesc             C   s   | j S )z&
    Returns the number of slides
    )rf  )r   r   r   r	   rT  +  s    zCohireNode.get_slidesc             C   s   |r|| _ |  d|¡ dS )z!
    Sets the injection file
    zinjection-fileN)rg  r¢   )r   r   r   r   r	   r8  1  s    zCohireNode.set_inj_filec             C   s   | j S )z!
    Gets the injection file
    )rg  )r   r   r   r	   r9  9  s    zCohireNode.get_inj_filec             C   s
   || _ dS )z
    Sets GPS start time
    N)Ú_CohireNode__start)r   r;  r   r   r	   r<  ?  s    zCohireNode.set_startc             C   s   | j S )z
    Gets GPS start time
    )ri  )r   r   r   r	   r–   E  s    zCohireNode.get_startc             C   s
   || _ dS )z
    Sets GPS end time
    N)Ú_CohireNode__end)r   r>  r   r   r	   r?  K  s    zCohireNode.set_endc             C   s   | j S )z
    Gets GPS end time
    )rj  )r   r   r   r	   r—   Q  s    zCohireNode.get_endc             C   s
   || _ dS )zx
    Set the ifo tag that is passed to the analysis code.
    @param ifo_tag: a string to identify one or more IFOs
    N)re  )r   r@  r   r   r	   rA  W  s    zCohireNode.set_ifo_tagc             C   s   | j S )z$
    Returns the IFO tag string
    )re  )r   r   r   r	   rš   ^  s    zCohireNode.get_ifo_tagc             C   s˜   |   ¡  ¡  ¡ }|  ¡ r |d7 }|  ¡ r^|d|  ¡  d¡d  d¡d  d¡d  7 }|d	7 }|  ¡ rv|d|  ¡  7 }|  ¡ rŽ|d|  ¡  7 }|| _d S )
Nr  r•   r  rf   rg   r   r”   r¿   rB  )	r   r.   r™   rT  r9  rm   rš   r›   rh  )r   rt   r   r   r	   rW  d  s     *  zCohireNode.set_output_tagc             C   s   | j S )N)rh  )r   r   r   r	   rX  o  s    zCohireNode.get_output_tagc             C   s˜   |   ¡ stdƒ‚|  ¡  |   ¡ d |  ¡  }|  ¡ r<|  ¡ rL|  ¡ rT|  ¡ sTtdƒ‚|  ¡ rŒ|  ¡ |  ¡  }|dt|  ¡ ƒ d t|ƒ 7 }|d7 }|S )z)
    get the name of the output file
    zifos have not been setr”   z,If one of start and end is set, both must bez.xml)rý   r   rW  rX  r–   r—   rœ   )r   rt   rC  r   r   r	   r    r  s     zCohireNode.get_outputc             C   s    |   ¡ r|  ¡  dd¡S dS dS )z)
    get the name of the missed file
    rD  rE  N)r9  r    rF  )r   r   r   r	   rG  ‰  s    zCohireNode.get_missedc             C   s`   |   ¡ }| jd|dd | jd| dd¡dd |  ¡ r\|  d|  ¡ ¡ | jd|  ¡ dd d	S )
z 
    set the output options
    r¯   T)rH  rI  r   rJ  zinjection-filezmissed-injectionsN)r    rp   rF  r9  rG  )r   r¯   r   r   r	   r§   ’  s    zCohireNode.finalizeN)r   r   r   r2   r
   rQ  rý   rS  rT  r8  r9  r<  r–   r?  r—   rA  rš   rW  rX  r    rG  r§   r   r   r   r	   rc  	  s&   	rc  c               @   s   e Zd ZdZdd„ ZdS )ÚInspInjFindNodezN
  An InspInjFindNode runs an instance of the InspInjJob in a
  Condor DAG.
  c             C   s   t  | |¡ dS )zT
    @param job: A CondorDAGJob that can run an instance of ligolw_inspinjfind.
    N)rŠ   r
   )r   r   r   r   r	   r
   ¥  s    zInspInjFindNode.__init__N)r   r   r   r2   r
   r   r   r   r	   rk     s   rk  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotInspiralrangeJobzû
  A plotinspiralrange job. The static options are read from the section
  [plotinspiralrange] in the ini file.  The stdout and stderr from the job
  are directed to the logs directory.  The path to the executable is
  determined from the ini file.
  c             C   s$   d}dg}d}t  | ||||¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    Zplotinspiralranger€   N)r3   r
   )r   r'   r)   r(   r*   r   r   r	   r
   ¶  s    zPlotInspiralrangeJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rl  ¯  s   rl  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotInspiralrangeNodezZ
  A PlotInspiralrangeNode runs an instance of the plotinspiral code in a
  Condor DAG.
  c             C   s   t  | |¡ dS )zM
    job = A CondorDAGJob that can run an instance of plotinspiralrange.
    N)r¨   r
   )r   r   r   r   r	   r
   Ä  s    zPlotInspiralrangeNode.__init__N)r   r   r   r2   r
   r   r   r   r	   rm  ¿  s   rm  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotInspiralJobzñ
  A plotinspiral job. The static options are read from the section
  [plotinspiral] in the ini file.  The stdout and stderr from the job
  are directed to the logs directory.  The path to the executable is
  determined from the ini file.
  c             C   s$   d}dg}d}t  | ||||¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    Zplotinspiralr€   N)r3   r
   )r   r'   r)   r(   r*   r   r   r	   r
   Ó  s    zPlotInspiralJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rn  Ì  s   rn  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotInspiralNodezS
  A PlotInspiralNode runs an instance of the plotinspiral code in a Condor DAG.
  c             C   s   t  | |¡ dS )zH
    job = A CondorDAGJob that can run an instance of plotinspiral.
    N)r¨   r
   )r   r   r   r   r	   r
   à  s    zPlotInspiralNode.__init__N)r   r   r   r2   r
   r   r   r   r	   ro  Ü  s   ro  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotThincaJobzí
  A plotthinca job. The static options are read from the section
  [plotthinca] in the ini file.  The stdout and stderr from the job
  are directed to the logs directory.  The path to the executable is
  determined from the ini file.
  c             C   s0   d}dg}d}t  | ||||¡ |  dd¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    Z
plotthincar€   rL   Ú2500N)r3   r
   r   )r   r'   r)   r(   r*   r   r   r	   r
   ï  s
    zPlotThincaJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rp  è  s   rp  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotThincaNodezO
  A PlotThincaNode runs an instance of the plotthinca code in a Condor DAG.
  c             C   s   t  | |¡ dS )zF
    job = A CondorDAGJob that can run an instance of plotthinca.
    N)r¨   r
   )r   r   r   r   r	   r
   ý  s    zPlotThincaNode.__init__N)r   r   r   r2   r
   r   r   r   r	   rr  ù  s   rr  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotCohsnrJobzí
  A plotthinca job. The static options are read from the section
  [plotthinca] in the ini file.  The stdout and stderr from the job
  are directed to the logs directory.  The path to the executable is
  determined from the ini file.
  c             C   s$   d}dg}d}t  | ||||¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    Z
plotcohsnrr€   N)r3   r
   )r   r'   r)   r(   r*   r   r   r	   r
   	  s    zPlotCohsnrJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rs  	  s   rs  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotCohsnrNodezO
  A PlotThincaNode runs an instance of the plotthinca code in a Condor DAG.
  c             C   s   t  | |¡ dS )zF
    job = A CondorDAGJob that can run an instance of plotthinca.
    N)r¨   r
   )r   r   r   r   r	   r
   	  s    zPlotCohsnrNode.__init__N)r   r   r   r2   r
   r   r   r   r	   rt  	  s   rt  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotNumtemplatesJobzù
  A plotnumtemplates job. The static options are read from the section
  [plotnumtemplates] in the ini file.  The stdout and stderr from the job
  are directed to the logs directory.  The path to the executable is
  determined from the ini file.
  c             C   s$   d}dg}d}t  | ||||¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    Zplotnumtemplatesr€   N)r3   r
   )r   r'   r)   r(   r*   r   r   r	   r
   *	  s    zPlotNumtemplatesJob.__init__N)r   r   r   r2   r
   r   r   r   r	   ru  #	  s   ru  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotNumtemplatesNodezW
  A PlotNumtemplatesNode runs an instance of the plotinspiral code in a Condor DAG.
  c             C   s   t  | |¡ dS )zL
    job = A CondorDAGJob that can run an instance of plotnumtemplates.
    N)r¨   r
   )r   r   r   r   r	   r
   7	  s    zPlotNumtemplatesNode.__init__N)r   r   r   r2   r
   r   r   r   r	   rv  3	  s   rv  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotEthincaJobzï
  A plotethinca job. The static options are read from the section
  [plotethinca] in the ini file.  The stdout and stderr from the job
  are directed to the logs directory.  The path to the executable is
  determined from the ini file.
  c             C   s0   d}dg}d}t  | ||||¡ |  dd¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    Zplotethincar€   rL   rq  N)r3   r
   r   )r   r'   r)   r(   r*   r   r   r	   r
   F	  s
    zPlotEthincaJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rw  ?	  s   rw  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotEthincaNodezR
  A PlotEthincaNode runs an instance of the plotinspiral code in a Condor DAG.
  c             C   s   t  | |¡ dS )zG
    job = A CondorDAGJob that can run an instance of plotethinca.
    N)r¨   r
   )r   r   r   r   r	   r
   T	  s    zPlotEthincaNode.__init__N)r   r   r   r2   r
   r   r   r   r	   rx  P	  s   rx  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotInspmissedJobzõ
  A plotinspmissed job. The static options are read from the section
  [plotinspmissed] in the ini file.  The stdout and stderr from the job
  are directed to the logs directory.  The path to the executable is
  determined from the ini file.
  c             C   s$   d}dg}d}t  | ||||¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    Zplotinspmissedr€   N)r3   r
   )r   r'   r)   r(   r*   r   r   r	   r
   c	  s    zPlotInspmissedJob.__init__N)r   r   r   r2   r
   r   r   r   r	   ry  \	  s   ry  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotInspmissedNodezU
  A PlotInspmissedNode runs an instance of the plotinspiral code in a Condor DAG.
  c             C   s   t  | |¡ dS )zJ
    job = A CondorDAGJob that can run an instance of plotinspmissed.
    N)r¨   r
   )r   r   r   r   r	   r
   p	  s    zPlotInspmissedNode.__init__N)r   r   r   r2   r
   r   r   r   r	   rz  l	  s   rz  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotEffdistcutJobzõ
  A ploteffdistcut job. The static options are read from the section
  [ploteffdistcut] in the ini file.  The stdout and stderr from the job
  are directed to the logs directory.  The path to the executable is
  determined from the ini file.
  c             C   s$   d}dg}d}t  | ||||¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    Zploteffdistcutr€   N)r3   r
   )r   r'   r)   r(   r*   r   r   r	   r
   	  s    zPlotEffdistcutJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r{  x	  s   r{  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotEffdistcutNodezY
  A PlotEffdistcutNode runs an instance of the
  ploteffdistcut code in a Condor DAG.
  c             C   s   t  | |¡ dS )zJ
    job = A CondorDAGJob that can run an instance of ploteffdistcut.
    N)r¨   r
   )r   r   r   r   r	   r
   	  s    zPlotEffdistcutNode.__init__N)r   r   r   r2   r
   r   r   r   r	   r|  ˆ	  s   r|  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotInspinjJobzï
  A plotinspinj job. The static options are read from the section
  [plotinspinj] in the ini file.  The stdout and stderr from the job
  are directed to the logs directory.  The path to the executable is
  determined from the ini file.
  c             C   s0   d}dg}d}t  | ||||¡ |  dd¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    Zplotinspinjr€   rL   rq  N)r3   r
   r   )r   r'   r)   r(   r*   r   r   r	   r
   œ	  s
    zPlotInspinjJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r}  •	  s   r}  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotInspinjNodezR
  A PlotInspinjNode runs an instance of the plotinspiral code in a Condor DAG.
  c             C   s   t  | |¡ dS )zG
    job = A CondorDAGJob that can run an instance of plotinspinj.
    N)r¨   r
   )r   r   r   r   r	   r
   ª	  s    zPlotInspinjNode.__init__N)r   r   r   r2   r
   r   r   r   r	   r~  ¦	  s   r~  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotSnrchiJobzí
  A plotsnrchi job. The static options are read from the section
  [plotsnrchi] in the ini file.  The stdout and stderr from the job
  are directed to the logs directory.  The path to the executable is
  determined from the ini file.
  c             C   s0   d}dg}d}t  | ||||¡ |  dd¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    Z
plotsnrchir€   rL   rq  N)r3   r
   r   )r   r'   r)   r(   r*   r   r   r	   r
   ¹	  s
    zPlotSnrchiJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r  ²	  s   r  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotSnrchiNodezQ
  A PlotSnrchiNode runs an instance of the plotinspiral code in a Condor DAG.
  c             C   s   t  | |¡ dS )zF
    job = A CondorDAGJob that can run an instance of plotsnrchi.
    N)r¨   r
   )r   r   r   r   r	   r
   Ç	  s    zPlotSnrchiNode.__init__N)r   r   r   r2   r
   r   r   r   r	   r€  Ã	  s   r€  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotGRBtimeslideStatsJobzÿ
  A plotgrbtimeslidestats job. The static options are read from the section
  [grbtimeslidestats] in the ini file.  The stdout and stderr from the job
  are directed to the logs directory.  The path to the executable is
  determined from the ini file.
  c             C   s0   d}dg}d}t  | ||||¡ |  dd¡ dS )zF
    @param cp = ConfigParser object from which options are read.
    Zpylal_grbtimeslide_statsZgrbtimeslidestatsr€   r4   r5   N)r   r
   r   )r   r'   r)   r(   r*   r   r   r	   r
   Ö	  s
    z!PlotGRBtimeslideStatsJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r  Ï	  s   r  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotGRBtimeslideStatsNodezh
  A PlotGRBtimeslideStatsNode runs an instance of the pylal_grbtimeslide_stats code in a Condor DAG.
  c             C   s   t  | |¡ dS )zT
    job = A CondorDAGJob that can run an instance of pylal_grbtimeslide_stats.
    N)rŠ   r
   )r   r   r   r   r	   r
   ä	  s    z"PlotGRBtimeslideStatsNode.__init__N)r   r   r   r2   r
   r   r   r   r	   r‚  à	  s   r‚  c               @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚMiniFollowupsJobzf
  A minifollowups job. Static options are read from the
  [minifollowups] section in the ini file.
  c             C   s2   d}ddg}d}t  | ||||¡ |  dd¡ dS )zE
    @param cp: ConfigParser object from which options are read.
    Zminifollowupszomega-scansNrL   rq  )r3   r
   r   )r   r'   r)   r(   r*   r   r   r	   r
   ñ	  s
    zMiniFollowupsJob.__init__c             C   s   |   dd¡ dS )z.
    Turns on the --time-slides argument.
    ztime-slidesr_   N)rZ   )r   r   r   r	   Úset_time_slidesû	  s    z MiniFollowupsJob.set_time_slidesN)r   r   r   r2   r
   r„  r   r   r   r	   rƒ  ì	  s   
rƒ  c               @   s˜   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$S )%ÚMiniFollowupsNodez
  A mininfollowups node.
  c             C   s@   t  | |¡ d| _d| _d| _d| _d| _d| _d| _d| _	dS )z(
    @param job: a MiniFollowupsJob
    N)
rŠ   r
   Ú_MiniFollowupsNode__cache_fileÚ _MiniFollowupsNode__cache_stringÚ_MiniFollowupsNode__prefixÚ_MiniFollowupsNode__suffixÚ_MiniFollowupsNode__input_xmlÚ%_MiniFollowupsNode__input_xml_summaryÚ%_MiniFollowupsNode__output_html_tableÚ_MiniFollowupsNode__table_name)r   r   r   r   r	   r
   
  s    zMiniFollowupsNode.__init__c             C   s   |   d|¡ || _dS )z*
    Set the ihope cache file to use.
    z
cache-fileN)rp   r†  )r   Z
cache_filer   r   r	   Úset_cache_file
  s    z MiniFollowupsNode.set_cache_filec             C   s   | j S )z,
    Returns the cache file that's set.
    )r†  )r   r   r   r	   Úget_cache_file
  s    z MiniFollowupsNode.get_cache_filec             C   s   |   d|¡ || _dS )z*
    Set the ihope cache file to use.
    zcache-stringN)rp   r‡  )r   r/  r   r   r	   r0  !
  s    z"MiniFollowupsNode.set_cache_stringc             C   s   | j S )z,
    Returns the cache file that's set.
    )r‡  )r   r   r   r	   Úget_cache_string(
  s    z"MiniFollowupsNode.get_cache_stringc             C   s   |   d|¡ || _dS )z?
    Sets the prefix option, which is used for plot names.
    ÚprefixN)r¢   rˆ  )r   r‘  r   r   r	   Ú
set_prefix.
  s    zMiniFollowupsNode.set_prefixc             C   s   | j S )z'
    Return the prefix that's set.
    )rˆ  )r   r   r   r	   Ú
get_prefix5
  s    zMiniFollowupsNode.get_prefixc             C   s   |   d|¡ || _dS )z?
    Sets the suffix option, which is used for plot names.
    ÚsuffixN)r¢   r‰  )r   r”  r   r   r	   Ú
set_suffix;
  s    zMiniFollowupsNode.set_suffixc             C   s   | j S )z'
    Return the suffix that's set.
    )r‰  )r   r   r   r	   Ú
get_suffixB
  s    zMiniFollowupsNode.get_suffixc             C   s   |   d|¡ || _dS )z
    Sets the input xml.
    z	input-xmlN)r¢   rŠ  )r   Z	input_xmlr   r   r	   Úset_input_xmlH
  s    zMiniFollowupsNode.set_input_xmlc             C   s   | j S )z*
    Return the input_xml that's set.
    )rŠ  )r   r   r   r	   Úget_input_xmlO
  s    zMiniFollowupsNode.get_input_xmlc             C   s   |   d|¡ || _dS )z
    Sets the input xml.
    zinput-xml-summaryN)r¢   r‹  )r   Zinput_xml_summaryr   r   r	   Úset_input_xml_summaryU
  s    z'MiniFollowupsNode.set_input_xml_summaryc             C   s   | j S )z2
    Return the input_xml_summary that's set.
    )r‹  )r   r   r   r	   Úget_input_xml_summary\
  s    z'MiniFollowupsNode.get_input_xml_summaryc             C   s   |   d|¡ || _dS )z
    Sets the input xml.
    zoutput-html-tableN)r¢   rŒ  )r   Zoutput_html_tabler   r   r	   Úset_output_html_tableb
  s    z'MiniFollowupsNode.set_output_html_tablec             C   s   | j S )z2
    Return the output_html_table that's set.
    )rŒ  )r   r   r   r	   Úget_output_html_tablei
  s    z'MiniFollowupsNode.get_output_html_tablec             C   s   |   d|¡ || _dS )z'
    Sets the table-name argument.
    z
table-nameN)r¢   r  )r   Z
table_namer   r   r	   Úset_table_nameo
  s    z MiniFollowupsNode.set_table_namec             C   s   | j S )z+
    Return the table_name that's set.
    )r  )r   r   r   r	   Úget_table_namev
  s    z MiniFollowupsNode.get_table_nameN)r   r   r   r2   r
   rŽ  r  r0  r  r’  r“  r•  r–  r—  r˜  r™  rš  r›  rœ  r  rž  r   r   r   r	   r…  
  s$   r…  c               @   s   e Zd ZdZdd„ ZdS )ÚDBSimplifyJobzd
  A DBSimplify job. The static options are read from the section
  [dbsimplify] in the ini file.
  c             C   s    d}dg}t j | |||¡ dS )zE
    @param cp: ConfigParser object from which options are read.
    Z
dbsimplifyN)r   Ú	SqliteJobr
   )r   r'   r)   r(   r   r   r	   r
   …
  s    zDBSimplifyJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rŸ  €
  s   rŸ  c               @   s   e Zd ZdZdd„ ZdS )ÚDBSimplifyNodez
  A DBSimplify node.
  c             C   s   t j | |¡ dS )z%
    @param job: a DBSimplifyJob
    N)r   Ú
SqliteNoder
   )r   r   r   r   r	   r
   ’
  s    zDBSimplifyNode.__init__N)r   r   r   r2   r
   r   r   r   r	   r¡  Ž
  s   r¡  c               @   s   e Zd ZdZdd„ ZdS )ÚComputeDurationsJobzq
  A ComputeDurations job. The static options are read from the section
  [compute_durations] in the ini file.
  c             C   s    d}dg}t j | |||¡ dS )zE
    @param cp: ConfigParser object from which options are read.
    Zcompute_durationsN)r   r   r
   )r   r'   r)   r(   r   r   r	   r
   ž
  s    zComputeDurationsJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r£  ™
  s   r£  c               @   s   e Zd ZdZdd„ ZdS )ÚComputeDurationsNodez
  A ComputeDurations node.
  c             C   s   t j | |¡ dS )z+
    @param job: a ComputeDurationsJob
    N)r   r¢  r
   )r   r   r   r   r	   r
   «
  s    zComputeDurationsNode.__init__N)r   r   r   r2   r
   r   r   r   r	   r¤  §
  s   r¤  c               @   s   e Zd ZdZdd„ ZdS )ÚDBAddInjJobz`
  A DBAddInj job. The static options are read from the section
  [dbaddinj] in the ini file.
  c             C   s    d}dg}t j | |||¡ dS )zE
    @param cp: ConfigParser object from which options are read.
    ZdbaddinjN)r   r   r
   )r   r'   r)   r(   r   r   r	   r
   ·
  s    zDBAddInjJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r¥  ²
  s   r¥  c               @   s8   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ ZdS )ÚDBAddInjNodez
  A DBAddInj node.
  c             C   s   t j | |¡ d| _d| _dS )z$
    @param job: a DBAddInj job
    N)r   r¢  r
   Ú_DBAddInjNode__injection_fileÚ_DBAddInjNode__inj_tag)r   r   r   r   r	   r
   Ä
  s    zDBAddInjNode.__init__c             C   s   |   d|¡ || _dS )zX
    @param injection_file: Injection file for dbaddinj to
    add to the database.
    zinjection-fileN)rp   r§  )r   Zinjection_filer   r   r	   Úset_injection_fileÌ
  s    zDBAddInjNode.set_injection_filec             C   s   | j S )z/
    Returns injection file for this node.
    )Z_injection_file)r   r   r   r	   Úget_injection_fileÔ
  s    zDBAddInjNode.get_injection_filec             C   s   |   d|¡ || _dS )zH
    @param inj_tag: Injection tag used to name the injection files
    zsim-tagN)r¢   r¨  )r   Zinj_tagr   r   r	   Úset_inj_tagÚ
  s    zDBAddInjNode.set_inj_tagc             C   s   | j S )z.
    Returns injection_tag for this node.
    )r¨  )r   r   r   r	   Úget_inj_tagá
  s    zDBAddInjNode.get_inj_tagN)	r   r   r   r2   r
   r©  rª  r«  r¬  r   r   r   r	   r¦  À
  s   r¦  c               @   s   e Zd ZdZdd„ ZdS )ÚRepopCoincJobzf
  A repop_coinc job. The static options are read from the section
  [repop_coinc] in the ini file.
  c             C   s    d}dg}t j | |||¡ dS )zE
    @param cp: ConfigParser object from which options are read.
    Zrepop_coincN)r   r   r
   )r   r'   r)   r(   r   r   r	   r
   ì
  s    zRepopCoincJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r­  ç
  s   r­  c               @   s   e Zd ZdZdd„ ZdS )ÚRepopCoincNodez
  A repop_coinc node.
  c             C   s   t j | |¡ dS )z%
    @param job: a RepopCoincJob
    N)r   r¢  r
   )r   r   r   r   r	   r
   ù
  s    zRepopCoincNode.__init__N)r   r   r   r2   r
   r   r   r   r	   r®  õ
  s   r®  c               @   s   e Zd ZdZdd„ ZdS )ÚDBInjFindJobzb
  A dbinjfind job. The static options are read from the section
  [dbinjfind] in the ini file.
  c             C   s    d}dg}t j | |||¡ dS )zE
    @param cp: ConfigParser object from which options are read.
    Z	dbinjfindN)r   r   r
   )r   r'   r)   r(   r   r   r	   r
     s    zDBInjFindJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r¯     s   r¯  c               @   s   e Zd ZdZdd„ ZdS )ÚDBInjFindNodez
  A dbinjfind node.
  c             C   s   t j | |¡ dS )z$
    @param job: a DBInjFindJob
    N)r   r¢  r
   )r   r   r   r   r	   r
     s    zDBInjFindNode.__init__N)r   r   r   r2   r
   r   r   r   r	   r°    s   r°  c               @   s   e Zd ZdZdd„ ZdS )ÚClusterCoincsJobzl
  A cluster coincs job. The static options are read from the section
  [cluster_coincs] in the ini file.
  c             C   s    d}dg}t j | |||¡ dS )zE
    @param cp: ConfigParser object from which options are read.
    Zcluster_coincsN)r   r   r
   )r   r'   r)   r(   r   r   r	   r
     s    zClusterCoincsJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r±    s   r±  c               @   s   e Zd ZdZdd„ ZdS )ÚClusterCoincsNodez
  A ClusterCoincs node.
  c             C   s   t j | |¡ dS )z(
    @param job: a ClusterCoincsJob
    N)r   r¢  r
   )r   r   r   r   r	   r
   +  s    zClusterCoincsNode.__init__N)r   r   r   r2   r
   r   r   r   r	   r²  '  s   r²  c               @   s   e Zd ZdZdd„ ZdS )ÚCFarJobzX
  A cfar job. The static options are read from the section [cfar] in
  the ini file.
  c             C   s   d}t j | |||¡ dS )z
    @param cp: ConfigParser object from which options are read.
    @param sections: list of sections for cp to read from
    ZcfarN)r   r   r
   )r   r'   r(   r)   r   r   r	   r
   7  s    zCFarJob.__init__N)r   r   r   r2   r
   r   r   r   r	   r³  2  s   r³  c               @   s   e Zd ZdZdd„ ZdS )ÚCFarNodez
  A CFar node.
  c             C   s   t j | |¡ dS )z
    @param job: a CFarJob
    N)r   r¢  r
   )r   r   r   r   r	   r
   D  s    zCFarNode.__init__N)r   r   r   r2   r
   r   r   r   r	   r´  @  s   r´  c               @   s   e Zd ZdZdd„ ZdS )ÚLigolwCBCPrintJobzj
  A LigolwCBCPrintJob is a generic job class for ligolw_cbc_print* programs, e.g., ligolw_cbc_printlc.
  c             C   s   t j | |||¡ dS )z¡
    @param cp: ConfigParser object from which options are read.
    @param exec_name UNDOCUMENTED
    @param sections: list of sections for cp to read from
    N)r   r   r
   )r   r'   r)   r(   r   r   r	   r
   O  s    zLigolwCBCPrintJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rµ  K  s   rµ  c               @   sˆ   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd S )!ÚLigolwCBCPrintNodez¡
  A LigolwCBCPrintJob is a generic node class for ligolw_cbc_print* programs, e.g., ligolw_cbc_printlc.
  This class offers options common to these programs.
  c             C   s<   t j | |¡ d| _d| _d| _d| _d| _d| _d| _	dS )z"
    @param job: a PrintLCJob
    N)
r   r¢  r
   Ú#_LigolwCBCPrintNode__extract_to_xmlÚ(_LigolwCBCPrintNode__extract_to_databaseÚ#_LigolwCBCPrintNode__exclude_coincsÚ(_LigolwCBCPrintNode__include_only_coincsÚ_LigolwCBCPrintNode__sim_tagÚ"_LigolwCBCPrintNode__output_formatÚ_LigolwCBCPrintNode__columns)r   r   r   r   r	   r
   ]  s    zLigolwCBCPrintNode.__init__c             C   s   |   d|¡ || _dS )z)
    Sets the extract-to-xml option.
    zextract-to-xmlN)r¢   r·  )r   Zxml_filenamer   r   r	   Úset_extract_to_xmlj  s    z%LigolwCBCPrintNode.set_extract_to_xmlc             C   s   | j S )z5
    Gets xml-filename if extract-to-xml is set.
    )r·  )r   r   r   r	   Úget_extract_to_xmlq  s    z%LigolwCBCPrintNode.get_extract_to_xmlc             C   s   |   d|¡ || _dS )z.
    Sets the extract-to-database option.
    zextract-to-databaseN)r¢   r¸  )r   Zdatabase_filenamer   r   r	   Úset_extract_to_databasew  s    z*LigolwCBCPrintNode.set_extract_to_databasec             C   s   | j S )z?
    Gets database-filename if extract-to-database is set.
    )r¸  )r   r   r   r	   Úget_extract_to_database~  s    z*LigolwCBCPrintNode.get_extract_to_databasec             C   s   |   d|¡ || _dS )z%
    Sets exclude-coincs option.
    zexclude-coincsN)r¢   r¹  )r   Zexclude_coincsr   r   r	   Úset_exclude_coincs„  s    z%LigolwCBCPrintNode.set_exclude_coincsc             C   s   | j S )z%
    Gets exclude-coincs option.
    )r¹  )r   r   r   r	   Úget_exclude_coincs‹  s    z%LigolwCBCPrintNode.get_exclude_coincsc             C   s   |   d|¡ || _dS )z*
    Sets include-only-coincs option.
    zinclude-only-coincsN)r¢   rº  )r   Zinclude_only_coincsr   r   r	   Úset_include_only_coincs‘  s    z*LigolwCBCPrintNode.set_include_only_coincsc             C   s   | j S )z*
    Gets include-only-coincs option.
    )rº  )r   r   r   r	   Úget_include_only_coincs˜  s    z*LigolwCBCPrintNode.get_include_only_coincsc             C   s   |   d|¡ || _dS )z$
    Sets the --sim-tag option.
    zsim-tagN)r¢   r»  )r   Úsim_tagr   r   r	   Úset_sim_tagž  s    zLigolwCBCPrintNode.set_sim_tagc             C   s   | j S )z
    Gets sim-tag option.
    )r»  )r   r   r   r	   Úget_sim_tag¥  s    zLigolwCBCPrintNode.get_sim_tagc             C   s   |   d|¡ || _dS )zk
    Sets the output-format option. (Note that the default
    for all ligolw_cbc_print* jobs is xml.)
    zoutput-formatN)r¢   r¼  )r   Zoutput_formatr   r   r	   Úset_output_format«  s    z$LigolwCBCPrintNode.set_output_formatc             C   s   | j S )z(
    Gets the output-format option.
    )r¼  )r   r   r   r	   Úget_output_format³  s    z$LigolwCBCPrintNode.get_output_formatc             C   s   |   d|¡ || _dS )z"
    Sets the columns option.
    ÚcolumnsN)r¢   r½  )r   rË  r   r   r	   Úset_columns¹  s    zLigolwCBCPrintNode.set_columnsc             C   s   | j S )z"
    Gets the columns option.
    )r½  )r   r   r   r	   Úget_columnsÀ  s    zLigolwCBCPrintNode.get_columnsN)r   r   r   r2   r
   r¾  r¿  rÀ  rÁ  rÂ  rÃ  rÄ  rÅ  rÇ  rÈ  rÉ  rÊ  rÌ  rÍ  r   r   r   r	   r¶  X  s    r¶  c               @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚPrintLCNodezR
  A special instance of LigolwCBCPrintNode that adds printlc-specific methods.
  c             C   s   t  | |¡ d| _dS )z)
    @param job: a LigolwCBCPrintJob
    N)r¶  r
   Ú_PrintLCNode__datatype)r   r   r   r   r	   r
   Ë  s    zPrintLCNode.__init__c             C   s   |   d|¡ || _dS )z
    Sets datatype option.
    ÚdatatypeN)r¢   rÏ  )r   rÐ  r   r   r	   Úset_datatypeÒ  s    zPrintLCNode.set_datatypec             C   s   | j S )z
    Gets datatype.
    )rÏ  )r   r   r   r	   Úget_datatypeÙ  s    zPrintLCNode.get_datatypeN)r   r   r   r2   r
   rÑ  rÒ  r   r   r   r	   rÎ  Ç  s   rÎ  c               @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚPrintSimsNodezT
  A special instance of LigolwCBCPrintNode that adds printsims-specific methods.
  c             C   s"   t  | |¡ d| _d| _d| _dS )z)
    @param job: a LigolwCBCPrintJob
    N)r¶  r
   Ú#_PrintSimsNode__comparison_datatypeZ _PrintSimsNode__simulation_tableZ_PrintSimsNode__recovery_table)r   r   r   r   r	   r
   ã  s    zPrintSimsNode.__init__c             C   s   |   d|¡ || _dS )z*
    Sets comparison-datatype option.
    zcomparison-datatypeN)r¢   rÔ  )r   rÐ  r   r   r	   Úset_comparison_datatypeì  s    z%PrintSimsNode.set_comparison_datatypec             C   s   | j S )z#
    Gets comparison-datatype.
    )rÔ  )r   r   r   r	   Úget_comparison_datatypeó  s    z%PrintSimsNode.get_comparison_datatypeN)r   r   r   r2   r
   rÕ  rÖ  r   r   r   r	   rÓ  ß  s   	rÓ  c               @   s   e Zd ZdZdd„ ZdS )ÚPrintMissedNodezV
  A special instance of LigolwCBCPrintNode that adds printmissed-specific methods.
  c             C   s   t  | |¡ dS )z)
    @param job: a LigolwCBCPrintJob
    N)r¶  r
   )r   r   r   r   r	   r
   þ  s    zPrintMissedNode.__init__N)r   r   r   r2   r
   r   r   r   r	   r×  ú  s   r×  c               @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚPlotSlidesJobzf
  A plotslides job. The static options are read from the sections [plot_input]
  and [plotslides].
  c             C   s"   d}ddg}t j | |||¡ dS )zE
    @param cp: ConfigParser object from which options are read.
    Z
plotslidesÚ
plot_inputN)r   r   r
   )r   r'   r)   r(   r   r   r	   r
   
  s    zPlotSlidesJob.__init__c             C   s   |   dd¡ dS )zT
    Sets plot-playground-only option. This causes job to only plot playground.
    zplot-playground-onlyr_   N)rZ   )r   r   r   r	   Úset_plot_playground_only  s    z&PlotSlidesJob.set_plot_playground_onlyN)r   r   r   r2   r
   rÚ  r   r   r   r	   rØ    s   rØ  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotSlidesNodez
  A PlotSlides node.
  c             C   s   t j | |¡ dS )z%
    @param job: a PlotSlidesJob
    N)r   r¢  r
   )r   r   r   r   r	   r
     s    zPlotSlidesNode.__init__N)r   r   r   r2   r
   r   r   r   r	   rÛ    s   rÛ  c               @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚPlotCumhistJobzh
  A plotcumhist job. The static options are read from the sections [plot_input] and
  [plotcumhist].
  c             C   s"   d}ddg}t j | |||¡ dS )zE
    @param cp: ConfigParser object from which options are read.
    ZplotcumhistrÙ  N)r   r   r
   )r   r'   r)   r(   r   r   r	   r
   )  s    zPlotCumhistJob.__init__c             C   s   |   dd¡ dS )zT
    Sets plot-playground-only option. This causes job to only plot playground.
    zplot-playground-onlyr_   N)rZ   )r   r   r   r	   rÚ  1  s    z'PlotCumhistJob.set_plot_playground_onlyN)r   r   r   r2   r
   rÚ  r   r   r   r	   rÜ  $  s   rÜ  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotCumhistNodez
  A PlotCumhist node.
  c             C   s   t j | |¡ dS )z'
    @param job: a PlotCumhist Job
    N)r   r¢  r
   )r   r   r   r   r	   r
   <  s    zPlotCumhistNode.__init__N)r   r   r   r2   r
   r   r   r   r	   rÝ  8  s   rÝ  c               @   s   e Zd ZdZdd„ ZdS )ÚPlotIfarJobzN
  A plotifar job. The static options are read from the [plotifar] section.
  c             C   s"   d}ddg}t j | |||¡ dS )zE
    @param cp: ConfigParser object from which options are read.
    ZplotifarrÙ  N)r   r   r
   )r   r'   r)   r(   r   r   r	   r
   G  s    zPlotIfarJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rÞ  C  s   rÞ  c               @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚPlotIfarNodez
  A PlotIfar node.
  c             C   s   t j | |¡ d| _dS )z#
    @param job: a PlotIfarJob
    N)r   r¢  r
   Ú_PlotIfarNode__datatype)r   r   r   r   r	   r
   T  s    zPlotIfarNode.__init__c             C   s   |   d|¡ || _dS )z
    Sets datatype option.
    rÐ  N)r¢   rà  )r   rÐ  r   r   r	   rÑ  [  s    zPlotIfarNode.set_datatypec             C   s   | j S )z
    Gets datatype.
    )rà  )r   r   r   r	   rÒ  b  s    zPlotIfarNode.get_datatypeN)r   r   r   r2   r
   rÑ  rÒ  r   r   r   r	   rß  P  s   rß  c               @   s   e Zd ZdZdd„ ZdS )Ú	PlotFMJobzJ
  A plotfm job. The static options are read from the [plotfm] seciont.
  c             C   s"   d}ddg}t j | |||¡ dS )zE
    @param cp: ConfigParser object from which objects are read.
    ZplotfmrÙ  N)r   r   r
   )r   r'   r)   r(   r   r   r	   r
   l  s    zPlotFMJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rá  h  s   rá  c               @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	Ú
PlotFMNodez
  A PlotFM node.
  c             C   s   t j | |¡ d| _dS )z!
    @param job: a PlotFMJob
    N)r   r¢  r
   Ú_PlotFMNode__sim_tag)r   r   r   r   r	   r
   x  s    zPlotFMNode.__init__c             C   s   |   d|¡ || _dS )z$
    Sets the --sim-tag option.
    zsim-tagN)r¢   rã  )r   rÆ  r   r   r	   rÇ    s    zPlotFMNode.set_sim_tagc             C   s   | j S )z
    Gets sim-tag option.
    )rã  )r   r   r   r	   rÈ  †  s    zPlotFMNode.get_sim_tagN)r   r   r   r2   r
   rÇ  rÈ  r   r   r   r	   râ  t  s   râ  c             C   sX   |   ¡ }|  ¡ }|  ¡ | }| ¡ | }||kr8||kpV||krH||kpV||koV||kS )a¿  
  Test whether the two intervals could possibly overlap with one of them being
  slid by a maximum time of slide_sec.  Perform three tests:
  1)  Does the start of interval 1 lie within interval 2's range (with the
    start decremented by slide_sec and the end incremented by slide_sec)
  2)  Does the end of interval 1 lie within interval 2's range (with the start
    decremented by slide_sec and the end incremented by slide_sec)
  3)  Does interval 1 completely cover (the extended) interval 2,
    ie is interval_1 start before (interval 2 start - slide_sec) AND
    interval 1 end after (interval 2 end + slide_sec)
  If any of the above conditions are satisfied then return True, else False.
  )r;  r>  )Z	interval1Z	interval2Z	slide_secZstart1Zend1ÚleftÚrightr   r   r	   Úoverlap_test  s    ræ  c               @   s   e Zd ZdZdd„ ZdS )ÚSearchVolumeJobzÍ
  A search volume job. Computes the observed physical volume
  above a specified FAR; if FAR is not specified, computes the
  volume above the loudest event (open box) or FAR=1/livetime
  (closed box).
  c             C   s(   d}t j | |dg|¡ |  dd¡ dS )zE
    @param cp: ConfigParser object from which options are read.
    Zsearch_volumezsearch-volumer6   z!KMP_LIBRARY=serial;MKL_SERIAL=yesN)r   r   r
   r   )r   r'   r)   r   r   r	   r
   ­  s    zSearchVolumeJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rç  ¦  s   rç  c               @   s@   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dS )ÚSearchVolumeNodez
  A search volume node.
  c             C   s   t j | |¡ dS )z
    N)r   r¢  r
   )r   r   r   r   r	   r
   ¹  s    zSearchVolumeNode.__init__c             C   s   |   |¡ d S )N)Úadd_var_arg)r   Údbr   r   r	   Úadd_database¾  s    zSearchVolumeNode.add_databasec             C   s   |   d|¡ d S )Nzoutput-cache)r¢   )r   r   r   r   r	   Úset_output_cacheÁ  s    z!SearchVolumeNode.set_output_cachec             C   s   |   d|¡ d S )Nzuser-tag)r¢   )r   Útagr   r   r	   Úset_user_tagÄ  s    zSearchVolumeNode.set_user_tagc             C   s   |   d|¡ d S )Nzveto-segments-name)r¢   )r   Únamer   r   r	   r#  Ç  s    z'SearchVolumeNode.set_veto_segments_namec             C   s   |   d¡ d S )Nz
--open-box)ré  )r   r   r   r	   Úset_open_boxÊ  s    zSearchVolumeNode.set_open_boxN)
r   r   r   r2   r
   rë  rì  rî  r#  rð  r   r   r   r	   rè  µ  s   rè  c               @   s   e Zd ZdZdd„ ZdS )ÚSearchUpperLimitJobz|
  A search upper limit job. Compute the search upper limit from the search
  volume output. Generates upper limit plots.
  c             C   s(   d}t j | |dg|¡ |  dd¡ dS )zx
    @param cp: ConfigParser object from which options are read.
    sections: list of sections for cp to read from
    Zsearch_upper_limitzupper-limitr6   z!KMP_LIBRARY=serial;MKL_SERIAL=yesN)r   r   r
   r   )r   r'   r)   r   r   r	   r
   Ó  s    zSearchUpperLimitJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rñ  Î  s   rñ  c               @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ÚSearchUpperLimitNodez 
  A search upper limit node.
  c             C   s   t j | |¡ d| _dS )z+
    @param job: a SearchUpperLimitJob
    FN)r   r¢  r
   Úopen_box)r   r   r   r   r	   r
   à  s    zSearchUpperLimitNode.__init__c             C   s   |   |¡ d S )N)ré  )r   r  r   r   r	   Úadd_input_cacheç  s    z$SearchUpperLimitNode.add_input_cachec             C   s   |   d|¡ d S )Nzuser-tag)r¢   )r   rí  r   r   r	   rî  ê  s    z!SearchUpperLimitNode.set_user_tagc             C   s   | j sd| _ |  d¡ dS )z 
    Set the open box flag.
    Tz
--open-boxN)ró  ré  )r   r   r   r	   rð  í  s    z!SearchUpperLimitNode.set_open_boxN)r   r   r   r2   r
   rô  rî  rð  r   r   r   r	   rò  Ü  s
   rò  c               @   s   e Zd ZdZdd„ ZdS )ÚMVSCDagGenerationJobzP
  a job that generates the mvsc_dag, which will be run as an external subdag
  c             C   sx   d}d}d}|  d|¡}tj | ||¡ tj | |¡ |  dd¡ |  d| d ¡ |  d| d	 ¡ |  |d
 ¡ dS )zE
    @param cp: ConfigParser object from which options are read.
    Zmvsc_dagr:   z
[mvsc_dag]r   r4   r5   zlogs/z-$(cluster)-$(process).outz-$(cluster)-$(process).errz.subN)	r   r   r   r
   r   r   r$   r%   r&   )r   r'   r)   r   r(   r+   r   r   r	   r
   ù  s    zMVSCDagGenerationJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rõ  õ  s   rõ  c               @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚMVSCDagGenerationNodezœ
  the node that runs the mvsc dag generation script for a given configuration
  generally the different nodes will be for different categories of vetoes
  c             C   s   t  | |¡ d S )N)rŠ   r
   )r   r   r   r   r	   r
     s    zMVSCDagGenerationNode.__init__c             C   s   |   |¡ d S )N)ré  )r   Zdatabaser   r   r	   Úset_database  s    z"MVSCDagGenerationNode.set_databasec             C   s   |   d|¡ d S )Nzuser-tag)r¢   )r   rí  r   r   r	   rî    s    z"MVSCDagGenerationNode.set_user_tagN)r   r   r   r2   r
   r÷  rî  r   r   r   r	   rö    s   rö  c               @   s   e Zd ZdZdd„ ZdS )ÚExtendedCoincJobzA
  job to calculate the extende background for zero far events
  c             C   s.   d}g }d}t  | ||||¡ |  dd¡ dS )zµ
    cp = ConfigParser object from which options are read.
    sections = sections of the ConfigParser that get added to the opts
    exec_name = exec_name name in ConfigParser
    Zextended_backgroundr€   r4   r5   N)r   r
   r   )r   r'   r)   r(   r*   r   r   r	   r
     s
    zExtendedCoincJob.__init__N)r   r   r   r2   r
   r   r   r   r	   rø    s   rø  c               @   sX   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dd„ Zdd„ ZdS )ÚExtendedCoincNodezD
  Node to calculate the extended background for a zero far event
  c             C   s   t  | |¡ d S )N)rŠ   r
   )r   r   r   r   r	   r
   )  s    zExtendedCoincNode.__init__c             C   s   |   d|¡ d S )Nzcoinc-threshold)r¢   )r   Zcoinc_thresholdr   r   r	   Úset_coinc_threshold,  s    z%ExtendedCoincNode.set_coinc_thresholdc             C   s   |   d|¡ d S )Nzihope-base-dir)r¢   )r   Úbase_dirr   r   r	   Úset_ihope_base_dir/  s    z$ExtendedCoincNode.set_ihope_base_dirc             C   s   |   d|¡ d S )Nzparam-ranges)r¢   )r   Zparam_rangesr   r   r	   Úset_param_ranges2  s    z"ExtendedCoincNode.set_param_rangesc             C   s   |   d|¡ d S )Nze-thinca-parameter)r¢   )r   Zethincar   r   r	   Úset_ethinca5  s    zExtendedCoincNode.set_ethincac             C   s   |   d|¡ d S )Nz
slide-step)r¢   )r   Z
slide_stepr   r   r	   Úset_slide_step8  s    z ExtendedCoincNode.set_slide_stepc             C   s   |   d|¡ d S )Nzveto-window)r¢   )r   Zveto_windowr   r   r	   Úset_veto_window;  s    z!ExtendedCoincNode.set_veto_windowc             C   s   |   d|¡ d S )Nznew-snr-cut)r¢   )r   Znew_snr_cutr   r   r	   Úset_new_snr_cut>  s    z!ExtendedCoincNode.set_new_snr_cutc             C   s   |   d|¡ d S )Nzloudest-event-glob)r¢   )r   Z
event_globr   r   r	   Úset_loudest_event_globA  s    z(ExtendedCoincNode.set_loudest_event_globN)r   r   r   r2   r
   rú  rü  rý  rþ  rÿ  r   r  r  r   r   r   r	   rù  %  s   rù  )r   )ƒr2   Ú
__future__r   Ú
__author__Ú__date__Ú__version__r   ri   r"   rk   rT   rV   Zgluer   r   Ú	Exceptionr   r   r   r   r3   r7   r=   rG   rH   rI   rJ   r^   r`   rb   rc   rd   ru   r   r   r‚   rƒ   r„   r…   r†   r‡   rˆ   r‰   rŒ   r‹   rŠ   r¨   r©   r²   r´   rµ   r·   rÅ   rÊ   rÐ   rÔ   r×   rÞ   rè   r  r)  r4  rK  rY  r[  r^  ra  rc  rk  rl  rm  rn  ro  rp  rr  rs  rt  ru  rv  rw  rx  ry  rz  r{  r|  r}  r~  r  r€  r  r‚  rƒ  r…  r   rŸ  r¢  r¡  r£  r¤  r¥  r¦  r­  r®  r¯  r°  r±  r²  r³  r´  rµ  r¶  rÎ  rÓ  r×  rØ  rÛ  rÜ  rÝ  rÞ  rß  rá  râ  ræ  rç  rè  rñ  rò  rõ  rö  rø  rù  r   r   r   r	   Ú<module>   sò    F 9-8}6,,3)] u3} R>3 ~'o
