#!/usr/bin/python3.13
#
# Copyright (C) 2012  Chad Hanna
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.


### Plot the horizon distance as a function of time from PSDs computed from
### gstlal_reference_psd


from optparse import OptionParser

from gstlal.plots import set_matplotlib_cache_directory
set_matplotlib_cache_directory()
from gstlal.plots import horizon


def parse_command_line():
	parser = OptionParser()
	parser.add_option("-o", "--output", help = "Set plot filename.")
	options, filenames = parser.parse_args()

	if not filenames:
		raise ValueError("must supply at least one input filename")

	return options, filenames


options, filenames = parse_command_line()

horizon_distance = horizon.HorizonDistance.from_psds(filenames)
horizon_distance.savefig(options.output)
