Skip to content
Snippets Groups Projects
Commit 8741e330 authored by ChiWai Chan's avatar ChiWai Chan
Browse files

gstlal_inspiral_plot_rankingstats_horizon: update docstring and fix

minor bug.
parent 30625887
No related branches found
No related tags found
1 merge request!114Plot horizon distance from ranking statistics
......@@ -29,7 +29,8 @@ from gstlal.plots import horizon
from lal.utils import CacheEntry
def parse_command_line():
parser = OptionParser(description = __doc__)
usage = "Usage: %prog [options] file1 file2 ..."
parser = OptionParser(description = __doc__, usage = usage)
parser.add_option("-o", "--outdir", default = ".", help = "Set the output directory. By default, current directory will be used.")
parser.add_option("-f", "--format", default = "png", help = "Set the output format. By default, the output will be a png file.")
......
......@@ -73,12 +73,16 @@ class HorizonDistance:
Returns:
An instance of HorizionDistance.
Note:
The ranking statistic files are expectd to be in the same
template bank bin.
"""
loader = cls.datasource_loader(sources)
urls = loader(sources)
rankingstat = far.marginalize_pdf_urls(urls, "RankingStat", verbose = verbose)
horizon_history_dict = rankingstat.numerator.horizon_history
return cls(horizon_history_dict)
return cls(horizon_history_dict, verbose=verbose)
@classmethod
def from_psds(cls, sources, verbose=False):
......@@ -100,7 +104,7 @@ class HorizonDistance:
for ifo, psd in psds.items():
if psd is not None:
horizon_history_dict[ifo].update({int(psd.epoch): HorizonDistance(10., 2048., psd.deltaF, 1.4, 1.4)(psd, 8.)[0]})
return cls(horizon_history_dict)
return cls(horizon_history_dict, verbose=verbose)
@staticmethod
def datasource_loader(sources):
......@@ -160,7 +164,7 @@ class HorizonDistance:
ax[1].hist(horizon_dist, binvec, alpha = 0.5, color = plotutil.colour_from_instruments([ifo]), label = ifo)
if self.verbose:
sys.stderr.write("plotting " + output)
sys.stderr.write("plotting " + str(output) + "\n")
ax[0].set_xlabel("Time (ks) from GPS {:d}".format(mint))
ax[0].set_ylabel("Mpc")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment