# Path: tests/data.py

# 
# Path: blimpy/plotting/config.py
# MAX_PLT_POINTS      = 65536                  # Max number of points in matplotlib plot
# MAX_IMSHOW_POINTS   = (8192, 4096)           # Max number of points in imshow plot


import blimpy as bl
import numpy as np
from pprint import pprint
from tests.data import voyager_fil, voyager_h5
from blimpy.plotting.config import plt


def test_compare_waterfall_fil_to_h5():
    """ Load Voyager dataset and test that both fil and hdf5 readers return same headers and data """

    print("Loading FIL and HDF5 data with Waterfall()..."),
    a = bl.Waterfall(voyager_h5)
    b = bl.Waterfall(voyager_fil)

    print("Reading headers..")
    pprint(a.header)
    print("\nFIL file header:")
    pprint(b.header)
    print("Headers are loading OK")

    print("\nChecking header values match..."),
    for key in b.header.keys():
        assert b.header[key] == a.header[key]

    print("Checking datatype matches..."),
    assert a.data.dtype == b.data.dtype

    print("Checking data matches..."),
    assert np.allclose(a.data, b.data)
    assert a.data.dtype == b.data.dtype


def test_waterfall_fil_to_h5_methods_and_attributes():
    """ Compare attributes and check methods """

# Path: tests/data.py

# 
# Path: blimpy/plotting/config.py
# MAX_PLT_POINTS      = 65536                  # Max number of points in matplotlib plot
# MAX_IMSHOW_POINTS   = (8192, 4096)           # Max number of points in imshow plot


# Path: tests/test_compare_voyager.py
import blimpy as bl
import numpy as np
from pprint import pprint
from tests.data import voyager_fil, voyager_h5
from blimpy.plotting.config import plt



def test_compare_waterfall_fil_to_h5():
    """ Load Voyager dataset and test that both fil and hdf5 readers return same headers and data """

    print("Loading FIL and HDF5 data with Waterfall()..."),
    a = bl.Waterfall(voyager_h5)
    b = bl.Waterfall(voyager_fil)

    print("Reading headers..")
    pprint(a.header)
    print("\nFIL file header:")
    pprint(b.header)
    print("Headers are loading OK")

    print("\nChecking header values match..."),
    for key in b.header.keys():
        assert b.header[key] == a.header[key]

    print("Checking datatype matches..."),
    assert a.data.dtype == b.data.dtype

    print("Checking data matches..."),
    assert np.allclose(a.data, b.data)
    assert a.data.dtype == b.data.dtype


def test_waterfall_fil_to_h5_methods_and_attributes():
    """ Compare attributes and check methods """

    a = bl.Waterfall(voyager_h5)