-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e9e274f
commit 2912a20
Showing
5 changed files
with
67 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/env python | ||
|
||
""" | ||
Simple wraper around bayestar-localize-coincs to get sky localization for a | ||
specific compact binary merger event. | ||
Uses an XML containing SNR timeseries and PSD and calls BAYESTAR to produce a | ||
sky localization. | ||
""" | ||
|
||
import argparse | ||
import subprocess | ||
import shutil | ||
import logging | ||
import pycbc.version | ||
from pycbc import init_logging | ||
|
||
parser = argparse.ArgumentParser(description=__doc__) | ||
parser.add_argument('--version', action="version", | ||
version=pycbc.version.git_verbose_msg) | ||
parser.add_argument('--verbose', action='count', | ||
help="Make the logging increasingly more verbose") | ||
parser.add_argument('--bayestar-executable', | ||
help="The bayestar-localize-coinc executable to be run. " | ||
"If not given, will use whatever is available in " | ||
"the current environment.") | ||
parser.add_argument('--event-xml', required=True, | ||
help="XML file containing event information, SNR " | ||
"timeseries and PSD to pass to bayestar") | ||
parser.add_argument('--waveform', default='TaylorF2', | ||
help="Waveform used in the matched-filtering " | ||
"to generate the SNR timeseries.") | ||
parser.add_argument('--low-frequency-cutoff', type=float, default=20, | ||
help="Low-frequency cutoff used in the matched-filtering " | ||
"to generate the SNR timeseries") | ||
parser.add_argument('--seed', | ||
help="Seed to pass to bayestar-localize-coincs") | ||
parser.add_argument('--output-file', required=True, | ||
help="Filename to output the fits file to." | ||
args = parser.parse_args() | ||
|
||
init_logging(args.verbose) | ||
logging.info("Starting") | ||
|
||
|
||
bayestar_exe = args.bayestar_executable if args.bayestar_executable \ | ||
else 'bayestar-localize-coincs' | ||
|
||
cmd = [bayestar_exe, | ||
args.event_xml, | ||
'--waveform', args.waveform, | ||
'--f_low', str(args.low_frequency_cutoff), | ||
'-o', tmpdir] | ||
|
||
logging.info("Running %s", ' '.join(cmd)) | ||
subprocess.call(cmd) | ||
|
||
logging.info("Moving output to %s", args.output_file) | ||
shutil.move(os.path.join(tmpdir, '0.fits'), args.output_file) | ||
|
||
logging.info("Done") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters