# Path: blimpy/stax.py
# def cmd_tool(args=None):
#     r"""Coomand line parser"""
#     parser = ArgumentParser(description='Make waterfall plots from a set of files, viewed from top to bottom.')
#     parser.add_argument('file_list', type=str, nargs='+', help='List of files to plot')
#     parser.add_argument('--f_start', type=float, default=None, help='Start frequency.  Default: None.')
#     parser.add_argument('--f_stop', type=float, default=None, help='Stop frequency.  Default: None.')
#     parser.add_argument('--plot_dir', '-p', type=str, default=".", help='Directory to receive the plot (.png).  Default: current directory.')
#     parser.add_argument("--dpi", "-d", type=int, default=200,
#                         help="Image file dots per inch.  Default: 200.")
#     if args is None:
#         args = parser.parse_args()
#     else:
#         args = parser.parse_args(args)
#     if args.file_list == []:
#         os.system("stax -h")
#         sys.exit(0)
#     args.plot_dir += "/"
# 
#     # Get file paths in alphabetical order.
#     args.file_list = sorted(args.file_list)
# 
#     # Compute the array of height ratios.
#     height_ratios = []
#     for file in args.file_list:
#         wf = bl.Waterfall(file, max_load=1)
#         nints = wf.file_shape[0]
#         height_ratios.append((nints - 1) * wf.header["tsamp"])
#         del wf
# 
#     # Make the plots.
#     logger.info("Begin")
#     make_waterfall_plots(args.file_list,
#                          args.plot_dir,
#                          args.dpi,
#                          height_ratios,
#                          args.f_start,
#                          args.f_stop)
#     logger.info("End")
# 
# Path: tests/data.py



from os.path import dirname
from blimpy.stax import cmd_tool
from tests.data import voyager_fil, voyager_h5
import pytest


def test_stax():
    dir = dirname(voyager_h5)
    args = [voyager_fil, voyager_h5, "--plot_dir", dir]
    cmd_tool(args)

# Path: blimpy/stax.py
# def cmd_tool(args=None):
#     r"""Coomand line parser"""
#     parser = ArgumentParser(description='Make waterfall plots from a set of files, viewed from top to bottom.')
#     parser.add_argument('file_list', type=str, nargs='+', help='List of files to plot')
#     parser.add_argument('--f_start', type=float, default=None, help='Start frequency.  Default: None.')
#     parser.add_argument('--f_stop', type=float, default=None, help='Stop frequency.  Default: None.')
#     parser.add_argument('--plot_dir', '-p', type=str, default=".", help='Directory to receive the plot (.png).  Default: current directory.')
#     parser.add_argument("--dpi", "-d", type=int, default=200,
#                         help="Image file dots per inch.  Default: 200.")
#     if args is None:
#         args = parser.parse_args()
#     else:
#         args = parser.parse_args(args)
#     if args.file_list == []:
#         os.system("stax -h")
#         sys.exit(0)
#     args.plot_dir += "/"
# 
#     # Get file paths in alphabetical order.
#     args.file_list = sorted(args.file_list)
# 
#     # Compute the array of height ratios.
#     height_ratios = []
#     for file in args.file_list:
#         wf = bl.Waterfall(file, max_load=1)
#         nints = wf.file_shape[0]
#         height_ratios.append((nints - 1) * wf.header["tsamp"])
#         del wf
# 
#     # Make the plots.
#     logger.info("Begin")
#     make_waterfall_plots(args.file_list,
#                          args.plot_dir,
#                          args.dpi,
#                          height_ratios,
#                          args.f_start,
#                          args.f_stop)
#     logger.info("End")
# 
# Path: tests/data.py



# Path: tests/test_stax.py
from os.path import dirname
from blimpy.stax import cmd_tool
from tests.data import voyager_fil, voyager_h5
import pytest



def test_stax():
    dir = dirname(voyager_h5)
    args = [voyager_fil, voyager_h5, "--plot_dir", dir]
    cmd_tool(args)

    args = [voyager_fil, voyager_h5, "--plot_dir", dir, "--f_start", "8419", "--f_stop", "8420"]