示例#1
0
def gen_likelihood_control(coinc_params_distributions,
                           seglists,
                           name=u"lalapps_burca_tailor",
                           comment=u""):
    xmldoc = ligolw.Document()
    node = xmldoc.appendChild(ligolw.LIGO_LW())

    process = ligolw_process.register_to_xmldoc(xmldoc,
                                                program=process_program_name,
                                                paramdict={},
                                                version=__version__,
                                                cvs_repository="lscsoft",
                                                cvs_entry_time=__date__,
                                                comment=comment)
    coinc_params_distributions.process_id = process.process_id
    ligolw_search_summary.append_search_summary(xmldoc,
                                                process,
                                                ifos=seglists.keys(),
                                                inseg=seglists.extent_all(),
                                                outseg=seglists.extent_all())

    node.appendChild(coinc_params_distributions.to_xml(name))

    ligolw_process.set_process_end_time(process)

    return xmldoc
示例#2
0
def create_process_table(document,
                         program_name=None,
                         detectors=None,
                         comment=None,
                         options=None):
    """Create a LIGOLW process table with sane defaults, add it to a LIGOLW
    document, and return it.
    """
    if program_name is None:
        program_name = os.path.basename(sys.argv[0])
    if options is None:
        options = {}

    # ligo.lw does not like `cvs_entry_time` being an empty string
    cvs_entry_time = pycbc_version.date or None

    process = ligolw_process.register_to_xmldoc(document,
                                                program_name,
                                                options,
                                                version=pycbc_version.version,
                                                cvs_repository='pycbc/' +
                                                pycbc_version.git_branch,
                                                cvs_entry_time=cvs_entry_time,
                                                instruments=detectors,
                                                comment=comment)
    return process
示例#3
0
def append_process(xmldoc, cluster_algorithm, comment):
    return ligolw_process.register_to_xmldoc(
        xmldoc,
        program=process_program_name,
        paramdict={"cluster_algorithm": cluster_algorithm},
        version=__version__,
        cvs_repository=u"lscsoft",
        cvs_entry_time=__date__,
        comment=comment)
示例#4
0
def register_to_xmldoc(xmldoc, parser, opts, **kwargs):
    from ligo.lw.utils import process
    params = {
        key: _sanitize_arg_value_for_xmldoc(value)
        for key, value in opts.__dict__.items()
    }
    return process.register_to_xmldoc(xmldoc,
                                      parser.prog,
                                      params,
                                      **kwargs,
                                      version=version_string)
示例#5
0
def append_process(xmldoc, cluster_algorithm, comment):
	return ligolw_process.register_to_xmldoc(
		xmldoc,
		program = process_program_name,
		paramdict = {
			"cluster_algorithm": cluster_algorithm
		},
		version = __version__,
		cvs_repository = u"lscsoft",
		cvs_entry_time = __date__,
		comment = comment
	)
示例#6
0
def append_process(xmldoc, match_algorithm, comment):
    """
	Convenience wrapper for adding process metadata to the document.
	"""
    return ligolw_process.register_to_xmldoc(
        xmldoc,
        program=process_program_name,
        paramdict={"match_algorithm": match_algorithm},
        version=__version__,
        cvs_repository=u"lscsoft",
        cvs_entry_time=__date__,
        comment=comment)
示例#7
0
def gen_likelihood_control(coinc_params_distributions, seglists, name = u"lalapps_burca_tailor", comment = u""):
	xmldoc = ligolw.Document()
	node = xmldoc.appendChild(ligolw.LIGO_LW())

	process = ligolw_process.register_to_xmldoc(xmldoc, program = process_program_name, paramdict = {}, version = __version__, cvs_repository = "lscsoft", cvs_entry_time = __date__, comment = comment)
	coinc_params_distributions.process_id = process.process_id
	ligolw_search_summary.append_search_summary(xmldoc, process, ifos = seglists.keys(), inseg = seglists.extent_all(), outseg = seglists.extent_all())

	node.appendChild(coinc_params_distributions.to_xml(name))

	ligolw_process.set_process_end_time(process)

	return xmldoc
示例#8
0
def new_doc(comment=None, **kwargs):
    doc = ligolw.Document()
    doc.appendChild(ligolw.LIGO_LW())
    process = ligolw_process.register_to_xmldoc(
        doc,
        program=u"lalapps_gen_timeslides",
        paramdict=kwargs,
        version=__version__,
        cvs_repository=u"lscsoft",
        cvs_entry_time=__date__,
        comment=comment)
    doc.childNodes[0].appendChild(lsctables.New(lsctables.TimeSlideTable))

    return doc, process
示例#9
0
def append_process(xmldoc, match_algorithm, comment):
	"""
	Convenience wrapper for adding process metadata to the document.
	"""
	return ligolw_process.register_to_xmldoc(
		xmldoc,
		program = process_program_name,
		paramdict = {
			"match_algorithm": match_algorithm
		},
		version = __version__,
		cvs_repository = u"lscsoft",
		cvs_entry_time = __date__,
		comment = comment
	)
示例#10
0
def new_doc(comment = None, **kwargs):
	doc = ligolw.Document()
	doc.appendChild(ligolw.LIGO_LW())
	process = ligolw_process.register_to_xmldoc(
		doc,
		program = u"lalapps_gen_timeslides",
		paramdict = kwargs,
		version = __version__,
		cvs_repository = u"lscsoft",
		cvs_entry_time = __date__,
		comment = comment
	)
	timeslidetable = lsctables.New(lsctables.TimeSlideTable)
	doc.childNodes[0].appendChild(timeslidetable)

	return doc, process
示例#11
0
def ligolw_bucut(xmldoc,
                 burst_test_func,
                 veto_segments=segments.segmentlistdict(),
                 del_non_coincs=False,
                 del_skipped_injections=False,
                 program=None,
                 comment=None,
                 verbose=False):
    process = ligolw_process.register_to_xmldoc(xmldoc,
                                                process_program_name,
                                                paramdict,
                                                version=__version__,
                                                cvs_repository=u"lscsoft",
                                                cvs_entry_time=__date__,
                                                comment=comment)

    contents = DocContents(xmldoc, program)

    apply_filters(contents,
                  burst_test_func,
                  veto_segments,
                  del_non_coincs=del_non_coincs,
                  del_skipped_injections=del_skipped_injections,
                  verbose=verbose)

    seg = contents.outsegs.extent_all()
    ligolw_search_summary.append_search_summary(xmldoc,
                                                process,
                                                inseg=seg,
                                                outseg=seg,
                                                nevents=len(
                                                    contents.snglbursttable))

    ligolw_process.set_process_end_time(process)

    return xmldoc
示例#12
0
 def gen_psd_xmldoc(self):
     xmldoc = lal.series.make_psd_xmldoc(self.psds)
     process = ligolw_process.register_to_xmldoc(xmldoc, "snax", {})
     ligolw_process.set_process_end_time(process)
     return xmldoc
示例#13
0
options, filenames = parse_command_line()

#
# use the time-slide file to start the output document
#

xmldoc = ligolw_utils.load_filename(options.time_slide_xml,
                                    verbose=options.verbose,
                                    contenthandler=LIGOLWContentHandler)

#
# add our metadata
#

process = ligolw_process.register_to_xmldoc(xmldoc,
                                            u"lalapps_binj_pic",
                                            options.options_dict,
                                            version=git_version.version)

#
# use whatever time slide vector comes first in the table (lazy)
#

time_slide_table = lsctables.TimeSlideTable.get_table(xmldoc)
time_slide_id = time_slide_table[0].time_slide_id
if options.verbose:
    print("associating injections with time slide (%d) %s" %
          (time_slide_id, time_slide_table.as_dict()[time_slide_id]),
          file=sys.stderr)

#
# find or add a sim_burst table
示例#14
0
		if not options.force:
			if options.verbose:
				print("skipping", file=sys.stderr)
			continue
		if options.verbose:
			print("continuing by --force", file=sys.stderr)

	#
	# Add an entry to the process table.
	#

	process = ligolw_process.register_to_xmldoc(
		xmldoc,
		process_program_name,
		process_params,
		comment = options.comment,
		version = __version__,
		cvs_repository = u"lscsoft",
		cvs_entry_time = __date__
	)

	#
	# LAL writes all triggers with event_id = 0.  Detect this and barf
	# on it.
	#

	tbl = lsctables.SnglInspiralTable.get_table(xmldoc)
	assert len(set(tbl.getColumnByName("event_id"))) == len(tbl), "degenerate sngl_inspiral event_id detected"

	#
	# Extract veto segments if present.
示例#15
0
    # get working copy of database
    #

    if options.verbose:
        print >> sys.stderr, "%d/%d: %s" % (n, len(filename), filename)

    working_filename = dbtables.get_connection_filename(
        filename, tmp_path=options.tmp_space, verbose=options.verbose)
    connection = sqlite3.connect(str(working_filename))

    #
    # record our passage
    #

    xmldoc = dbtables.get_xml(connection)
    process = ligolw_process.register_to_xmldoc(
        xmldoc, u"lalapps_string_compute_fapfar", process_params)

    #
    # assign FAPs and FARs
    #

    fapfar.assign_fapfars(connection)

    #
    # done, restore file to original location
    #

    ligolw_process.set_process_end_time(process)
    connection.cursor().execute(
        "UPDATE process SET end_time = ? WHERE process_id == ?",
        (process.end_time, process.process_id))
示例#16
0
def output_sngl_inspiral_table(outputFile,
                               tempBank,
                               metricParams,
                               ethincaParams,
                               programName="",
                               optDict=None,
                               outdoc=None,
                               **kwargs):
    """
    Function that converts the information produced by the various pyCBC bank
    generation codes into a valid LIGOLW xml file containing a sngl_inspiral
    table and outputs to file.

    Parameters
    -----------
    outputFile : string
        Name of the file that the bank will be written to
    tempBank : iterable
        Each entry in the tempBank iterable should be a sequence of
        [mass1,mass2,spin1z,spin2z] in that order.
    metricParams : metricParameters instance
        Structure holding all the options for construction of the metric
        and the eigenvalues, eigenvectors and covariance matrix
        needed to manipulate the space.
    ethincaParams: {ethincaParameters instance, None}
        Structure holding options relevant to the ethinca metric computation
        including the upper frequency cutoff to be used for filtering.
        NOTE: The computation is currently only valid for non-spinning systems
        and uses the TaylorF2 approximant.
    programName (key-word-argument) : string
        Name of the executable that has been run
    optDict (key-word argument) : dictionary
        Dictionary of the command line arguments passed to the program
    outdoc (key-word argument) : ligolw xml document
        If given add template bank to this representation of a xml document and
        write to disk. If not given create a new document.
    kwargs : key-word arguments
        All other key word arguments will be passed directly to
        ligolw_process.register_to_xmldoc
    """
    if optDict is None:
        optDict = {}
    if outdoc is None:
        outdoc = ligolw.Document()
        outdoc.appendChild(ligolw.LIGO_LW())

    # get IFO to put in search summary table
    ifos = []
    if 'channel_name' in optDict.keys():
        if optDict['channel_name'] is not None:
            ifos = [optDict['channel_name'][0:2]]

    proc_id = ligolw_process.register_to_xmldoc(outdoc,
                                                programName,
                                                optDict,
                                                instruments=ifos,
                                                **kwargs).process_id
    sngl_inspiral_table = convert_to_sngl_inspiral_table(tempBank, proc_id)
    # Calculate Gamma components if needed
    if ethincaParams is not None:
        if ethincaParams.doEthinca:
            for sngl in sngl_inspiral_table:
                # Set tau_0 and tau_3 values needed for the calculation of
                # ethinca metric distances
                (sngl.tau0, sngl.tau3) = pnutils.mass1_mass2_to_tau0_tau3(
                    sngl.mass1, sngl.mass2, metricParams.f0)
                fMax_theor, GammaVals = calculate_ethinca_metric_comps(
                    metricParams,
                    ethincaParams,
                    sngl.mass1,
                    sngl.mass2,
                    spin1z=sngl.spin1z,
                    spin2z=sngl.spin2z,
                    full_ethinca=ethincaParams.full_ethinca)
                # assign the upper frequency cutoff and Gamma0-5 values
                sngl.f_final = fMax_theor
                for i in range(len(GammaVals)):
                    setattr(sngl, "Gamma" + str(i), GammaVals[i])
        # If Gamma metric components are not wanted, assign f_final from an
        # upper frequency cutoff specified in ethincaParams
        elif ethincaParams.cutoff is not None:
            for sngl in sngl_inspiral_table:
                sngl.f_final = pnutils.frequency_cutoff_from_name(
                    ethincaParams.cutoff, sngl.mass1, sngl.mass2, sngl.spin1z,
                    sngl.spin2z)

    # set per-template low-frequency cutoff
    if 'f_low_column' in optDict and 'f_low' in optDict and \
            optDict['f_low_column'] is not None:
        for sngl in sngl_inspiral_table:
            setattr(sngl, optDict['f_low_column'], optDict['f_low'])

    outdoc.childNodes[0].appendChild(sngl_inspiral_table)

    # get times to put in search summary table
    start_time = 0
    end_time = 0
    if 'gps_start_time' in optDict.keys() and 'gps_end_time' in optDict.keys():
        start_time = optDict['gps_start_time']
        end_time = optDict['gps_end_time']

    # make search summary table
    search_summary_table = lsctables.New(lsctables.SearchSummaryTable)
    search_summary = return_search_summary(start_time, end_time,
                                           len(sngl_inspiral_table), ifos,
                                           **kwargs)
    search_summary_table.append(search_summary)
    outdoc.childNodes[0].appendChild(search_summary_table)

    # write the xml doc to disk
    ligolw_utils.write_filename(outdoc,
                                outputFile,
                                gz=outputFile.endswith('.gz'))
示例#17
0
    def __init__(self, ifos, coinc_results, **kwargs):
        """Initialize a ligolw xml representation of a zerolag trigger
        for upload from pycbc live to gracedb.

        Parameters
        ----------
        ifos: list of strs
            A list of the ifos participating in this trigger.
        coinc_results: dict of values
            A dictionary of values. The format is defined in
            pycbc/events/coinc.py and matches the on disk representation
            in the hdf file for this time.
        psds: dict of FrequencySeries
            Dictionary providing PSD estimates for all involved detectors.
        low_frequency_cutoff: float
            Minimum valid frequency for the PSD estimates.
        high_frequency_cutoff: float, optional
            Maximum frequency considered for the PSD estimates. Default None.
        followup_data: dict of dicts, optional
            Dictionary providing SNR time series for each detector,
            to be used in sky localization with BAYESTAR. The format should
            be `followup_data['H1']['snr_series']`. More detectors can be
            present than given in `ifos`. If so, the extra detectors will only
            be used for sky localization.
        channel_names: dict of strings, optional
            Strain channel names for each detector.
            Will be recorded in the sngl_inspiral table.
        mc_area_args: dict of dicts, optional
            Dictionary providing arguments to be used in source probability
            estimation with pycbc/mchirp_area.py
        """
        self.template_id = coinc_results['foreground/%s/template_id' % ifos[0]]
        self.coinc_results = coinc_results
        self.ifos = ifos

        # remember if this should be marked as HWINJ
        self.is_hardware_injection = ('HWINJ' in coinc_results
                                      and coinc_results['HWINJ'])

        # Check if we need to apply a time offset (this may be permerger)
        self.time_offset = 0
        rtoff = 'foreground/{}/time_offset'.format(ifos[0])
        if rtoff in coinc_results:
            self.time_offset = coinc_results[rtoff]

        if 'followup_data' in kwargs:
            fud = kwargs['followup_data']
            assert len({fud[ifo]['snr_series'].delta_t for ifo in fud}) == 1, \
                    "delta_t for all ifos do not match"
            self.snr_series = {ifo: fud[ifo]['snr_series'] for ifo in fud}
            usable_ifos = fud.keys()
            followup_ifos = list(set(usable_ifos) - set(ifos))

            for ifo in self.snr_series:
                self.snr_series[ifo].start_time += self.time_offset
        else:
            self.snr_series = None
            usable_ifos = ifos
            followup_ifos = []

        # Set up the bare structure of the xml document
        outdoc = ligolw.Document()
        outdoc.appendChild(ligolw.LIGO_LW())

        # ligo.lw does not like `cvs_entry_time` being an empty string
        cvs_entry_time = pycbc_version.date or None
        proc_id = ligolw_process.register_to_xmldoc(
            outdoc,
            'pycbc', {},
            instruments=usable_ifos,
            comment='',
            version=pycbc_version.version,
            cvs_repository='pycbc/' + pycbc_version.git_branch,
            cvs_entry_time=cvs_entry_time).process_id

        # Set up coinc_definer table
        coinc_def_table = lsctables.New(lsctables.CoincDefTable)
        coinc_def_id = lsctables.CoincDefID(0)
        coinc_def_row = lsctables.CoincDef()
        coinc_def_row.search = "inspiral"
        coinc_def_row.description = "sngl_inspiral<-->sngl_inspiral coincs"
        coinc_def_row.coinc_def_id = coinc_def_id
        coinc_def_row.search_coinc_type = 0
        coinc_def_table.append(coinc_def_row)
        outdoc.childNodes[0].appendChild(coinc_def_table)

        # Set up coinc inspiral and coinc event tables
        coinc_id = lsctables.CoincID(0)
        coinc_event_table = lsctables.New(lsctables.CoincTable)
        coinc_event_row = lsctables.Coinc()
        coinc_event_row.coinc_def_id = coinc_def_id
        coinc_event_row.nevents = len(usable_ifos)
        coinc_event_row.instruments = ','.join(usable_ifos)
        coinc_event_row.time_slide_id = lsctables.TimeSlideID(0)
        coinc_event_row.process_id = proc_id
        coinc_event_row.coinc_event_id = coinc_id
        coinc_event_row.likelihood = 0.
        coinc_event_table.append(coinc_event_row)
        outdoc.childNodes[0].appendChild(coinc_event_table)

        # Set up sngls
        sngl_inspiral_table = lsctables.New(lsctables.SnglInspiralTable)
        coinc_event_map_table = lsctables.New(lsctables.CoincMapTable)

        sngl_populated = None
        network_snrsq = 0
        for sngl_id, ifo in enumerate(usable_ifos):
            sngl = return_empty_sngl(nones=True)
            sngl.event_id = lsctables.SnglInspiralID(sngl_id)
            sngl.process_id = proc_id
            sngl.ifo = ifo
            names = [
                n.split('/')[-1] for n in coinc_results
                if 'foreground/%s' % ifo in n
            ]
            for name in names:
                val = coinc_results['foreground/%s/%s' % (ifo, name)]
                if name == 'end_time':
                    val += self.time_offset
                    sngl.end = lal.LIGOTimeGPS(val)
                else:
                    try:
                        setattr(sngl, name, val)
                    except AttributeError:
                        pass
            if sngl.mass1 and sngl.mass2:
                sngl.mtotal, sngl.eta = pnutils.mass1_mass2_to_mtotal_eta(
                    sngl.mass1, sngl.mass2)
                sngl.mchirp, _ = pnutils.mass1_mass2_to_mchirp_eta(
                    sngl.mass1, sngl.mass2)
                sngl_populated = sngl
            if sngl.snr:
                sngl.eff_distance = (sngl.sigmasq)**0.5 / sngl.snr
                network_snrsq += sngl.snr**2.0
            if 'channel_names' in kwargs and ifo in kwargs['channel_names']:
                sngl.channel = kwargs['channel_names'][ifo]
            sngl_inspiral_table.append(sngl)

            # Set up coinc_map entry
            coinc_map_row = lsctables.CoincMap()
            coinc_map_row.table_name = 'sngl_inspiral'
            coinc_map_row.coinc_event_id = coinc_id
            coinc_map_row.event_id = sngl.event_id
            coinc_event_map_table.append(coinc_map_row)

            if self.snr_series is not None:
                snr_series_to_xml(self.snr_series[ifo], outdoc, sngl.event_id)

        # set merger time to the average of the ifo peaks
        self.merger_time = numpy.mean([
            coinc_results['foreground/{}/end_time'.format(ifo)] for ifo in ifos
        ]) + self.time_offset

        # for subthreshold detectors, respect BAYESTAR's assumptions and checks
        bayestar_check_fields = ('mass1 mass2 mtotal mchirp eta spin1x '
                                 'spin1y spin1z spin2x spin2y spin2z').split()
        for sngl in sngl_inspiral_table:
            if sngl.ifo in followup_ifos:
                for bcf in bayestar_check_fields:
                    setattr(sngl, bcf, getattr(sngl_populated, bcf))
                sngl.end = lal.LIGOTimeGPS(self.merger_time)

        outdoc.childNodes[0].appendChild(coinc_event_map_table)
        outdoc.childNodes[0].appendChild(sngl_inspiral_table)

        # Set up the coinc inspiral table
        coinc_inspiral_table = lsctables.New(lsctables.CoincInspiralTable)
        coinc_inspiral_row = lsctables.CoincInspiral()
        # This seems to be used as FAP, which should not be in gracedb
        coinc_inspiral_row.false_alarm_rate = 0
        coinc_inspiral_row.minimum_duration = 0.
        coinc_inspiral_row.instruments = tuple(usable_ifos)
        coinc_inspiral_row.coinc_event_id = coinc_id
        coinc_inspiral_row.mchirp = sngl_populated.mchirp
        coinc_inspiral_row.mass = sngl_populated.mtotal
        coinc_inspiral_row.end_time = sngl_populated.end_time
        coinc_inspiral_row.end_time_ns = sngl_populated.end_time_ns
        coinc_inspiral_row.snr = network_snrsq**0.5
        far = 1.0 / (lal.YRJUL_SI * coinc_results['foreground/ifar'])
        coinc_inspiral_row.combined_far = far
        coinc_inspiral_table.append(coinc_inspiral_row)
        outdoc.childNodes[0].appendChild(coinc_inspiral_table)

        # append the PSDs
        self.psds = kwargs['psds']
        psds_lal = {}
        for ifo in self.psds:
            psd = self.psds[ifo]
            kmin = int(kwargs['low_frequency_cutoff'] / psd.delta_f)
            fseries = lal.CreateREAL8FrequencySeries(
                "psd", psd.epoch, kwargs['low_frequency_cutoff'], psd.delta_f,
                lal.StrainUnit**2 / lal.HertzUnit,
                len(psd) - kmin)
            fseries.data.data = psd.numpy()[kmin:] / pycbc.DYN_RANGE_FAC**2.0
            psds_lal[ifo] = fseries
        make_psd_xmldoc(psds_lal, outdoc)

        # source probabilities estimation
        if 'mc_area_args' in kwargs:
            eff_distances = [sngl.eff_distance for sngl in sngl_inspiral_table]
            probabilities = calc_probabilities(coinc_inspiral_row.mchirp,
                                               coinc_inspiral_row.snr,
                                               min(eff_distances),
                                               kwargs['mc_area_args'])
            self.probabilities = probabilities
        else:
            self.probabilities = None

        self.outdoc = outdoc
        self.time = sngl_populated.end
#

# FIXME:  don't hard-code instruments
distributions = stringutils.StringCoincParamsDistributions(["H1", "L1", "V1"])
segs = segments.segmentlistdict()

#
# Start output document
#

xmldoc = ligolw.Document()
xmldoc.appendChild(ligolw.LIGO_LW())
process = ligolw_process.register_to_xmldoc(
    xmldoc,
    program=u"lalapps_string_meas_likelihood",
    paramdict=paramdict,
    version=__version__,
    cvs_repository="lscsoft",
    cvs_entry_time=__date__,
    comment=u"")

#
# Iterate over files
#

for n, filename in enumerate(filenames):
    #
    # Open the database file.
    #

    if options.verbose:
        print("%d/%d: %s" % (n + 1, len(filenames), filename), file=sys.stderr)
示例#19
0
                  file=sys.stderr)
        if not options.force:
            if options.verbose:
                print("skipping", file=sys.stderr)
            continue
        if options.verbose:
            print("continuing by --force", file=sys.stderr)

    #
    # Add an entry to the process table.
    #

    process = ligolw_process.register_to_xmldoc(xmldoc,
                                                process_program_name,
                                                process_params,
                                                comment=options.comment,
                                                version=__version__,
                                                cvs_repository=u"lscsoft",
                                                cvs_entry_time=__date__)

    #
    # LAL writes all triggers with event_id = 0.  Detect this and barf
    # on it.
    #

    tbl = lsctables.SnglInspiralTable.get_table(xmldoc)
    assert len(set(tbl.getColumnByName("event_id"))) == len(
        tbl), "degenerate sngl_inspiral event_id detected"

    #
    # Extract veto segments if present.
示例#20
0
    workflow, scienceSegs, dfDir, segsList)

# This is needed to know what times will be analysed by daily ahope
# Template bank stuff
banks = _workflow.setup_tmpltbank_workflow(workflow, scienceSegs, datafinds,
                                           dfDir)
# Do matched-filtering
insps = _workflow.setup_matchedfltr_workflow(workflow, scienceSegs, datafinds,
                                             banks, dfDir)

# Now construct the summary XML file

outdoc = ligolw.Document()
outdoc.appendChild(ligolw.LIGO_LW())
# FIXME: PROGRAM NAME and dictionary of opts should be variables defined up above
proc_id = ligolw_process.register_to_xmldoc(outdoc, 'dayhopetest',
                                            vars(args)).process_id
for ifo in workflow.ifos:
    # Lets get the segment lists we need
    segIfoFiles = segsList.find_output_with_ifo(ifo)
    # SCIENCE
    sciSegFile = segIfoFiles.find_output_with_tag('SCIENCE')
    assert (len(sciSegFile) == 1)
    sciSegFile = sciSegFile[0]
    sciSegs = sciSegFile.segmentList
    # SCIENCE_OK
    sciokSegFile = segIfoFiles.find_output_with_tag('SCIENCE_OK')
    assert (len(sciokSegFile) == 1)
    sciokSegFile = sciokSegFile[0]
    sciokSegs = sciokSegFile.segmentList
    # SCIENCE_AVAILABLE
    sciavailableSegFile = segIfoFiles.find_output_with_tag('SCIENCE_AVAILABLE')
示例#21
0
#                                     Main
#
# =============================================================================
#


options, filenames = parse_command_line()


if options.verbose:
	print("time-frequency tiles have %g degrees of freedom" % (2 * options.delta_t * options.delta_f), file=sys.stderr)


xmldoc = ligolw.Document()
xmldoc.appendChild(ligolw.LIGO_LW())
process = ligolw_process.register_to_xmldoc(xmldoc, u"lalapps_binj_pic", options.options_dict, version = git_version.version)
time_slide_table = xmldoc.childNodes[-1].appendChild(lsctables.TimeSlideTable.get_table(ligolw_utils.load_filename(options.time_slide_xml, verbose = options.verbose, contenthandler = LIGOLWContentHandler)))
time_slide_id = time_slide_table[0].time_slide_id
if options.verbose:
	print("associating injections with time slide ID \"%s\":  %s" % (time_slide_id, time_slide_table.as_dict()[time_slide_id]), file=sys.stderr)
for row in time_slide_table:
	row.process_id = process.process_id
sim_burst_tbl = xmldoc.childNodes[-1].appendChild(lsctables.New(lsctables.SimBurstTable, ["process_id", "simulation_id", "time_slide_id", "waveform", "waveform_number", "ra", "dec", "psi", "time_geocent_gps", "time_geocent_gps_ns", "duration", "frequency", "bandwidth", "egw_over_rsquared", "pol_ellipse_angle", "pol_ellipse_e"]))


for filename in filenames:
	if options.verbose:
		print("loading %s ..." % filename, file=sys.stderr)
	img = Image.open(filename)

	width, height = img.size
#


# FIXME:  don't hard-code instruments
distributions = stringutils.StringCoincParamsDistributions(["H1", "L1", "V1"])
segs = segments.segmentlistdict()


#
# Start output document
#


xmldoc = ligolw.Document()
xmldoc.appendChild(ligolw.LIGO_LW())
process = ligolw_process.register_to_xmldoc(xmldoc, program = u"lalapps_string_meas_likelihood", paramdict = paramdict, version = __version__, cvs_repository = "lscsoft", cvs_entry_time = __date__, comment = u"")


#
# Iterate over files
#


for n, filename in enumerate(filenames):
	#
	# Open the database file.
	#

	if options.verbose:
		print("%d/%d: %s" % (n + 1, len(filenames), filename), file=sys.stderr)