# Path: pyfusion/acquisition/DSV/acq.py
# class DSVAcquisition(BaseAcquisition):
#     pass
# 
# Path: pyfusion/acquisition/base.py
# class BaseAcquisition(object):
#     """Base class for datasystem specific acquisition classes.
# 
#     :param   config_name:  name   of  acquisition   as  specified in\
#     configuration file.
# 
#     On  instantiation,  the pyfusion  configuration  is  searched for  a
#     ``[Acquisition:config_name]``   section.    The   contents  of   the
#     configuration  section are  loaded into  the object  namespace.  For
#     example, a configuration section::
# 
#       [Acquisition:my_custom_acq]
#       acq_class = pyfusion.acquisition.base.BaseAcquisition
#       server = my.dataserver.com
#  
#     will result in the following behaviour::
# 
#      >>> from pyfusion.acquisition.base import BaseAcquisition
#      >>> my_acq = BaseAcquisition('my_custom_acq')
#      >>> print(my_acq.server)
#      my.dataserver.com
# 
#     The configuration entries can be overridden with keyword arguments::
# 
#      >>> my_other_acq = BaseAcquisition('my_custom_acq', server='your.data.net')
#      >>> print(my_other_acq.server)
#      your.data.net
# 
#     """
#     def __init__(self, config_name=None, **kwargs):
#         if config_name != None:
#             self.__dict__.update(get_config_as_dict('Acquisition', config_name))
#         self.__dict__.update(kwargs)
# 
#     def getdata(self, shot, config_name=None, **kwargs):
#         """Get the data and return prescribed subclass of BaseData.
#         
#         :param shot: shot number
#         :param config_name: name of a fetcher class in the configuration file
#         :returns: an instance of a subclass of \
#         :py:class:`~pyfusion.data.base.BaseData` or \
#         :py:class:`~pyfusion.data.base.BaseDataSet`
# 
#         This method needs to know which  data fetcher class to use, if a
#         config_name      argument     is      supplied      then     the
#         ``[Diagnostic:config_name]``   section   must   exist   in   the
#         configuration   file  and   contain  a   ``data_fetcher``  class
#         specification, for example::
# 
#          [Diagnostic:H1_mirnov_array_1_coil_1]
#          data_fetcher = pyfusion.acquisition.H1.fetch.H1DataFetcher
#          mds_path = \h1data::top.operations.mirnov:a14_14:input_1
#          coords_cylindrical = 1.114, 0.7732, 0.355
#          coord_transform = H1_mirnov
# 
#         If a ``data_fetcher`` keyword argument is supplied, it overrides
#         the configuration file specification.
# 
#         The  fetcher  class  is  instantiated,  including  any  supplied
#         keyword arguments, and the result of the ``fetch`` method of the
#         fetcher class is returned.
#         """
#         from pyfusion import config
#         # if there is a data_fetcher arg, use that, otherwise get from config
#         if kwargs.has_key('data_fetcher'):
#             fetcher_class_name = kwargs['data_fetcher']
#         else:
#             fetcher_class_name = config.pf_get('Diagnostic',
#                                                config_name,
#                                                'data_fetcher')
#         fetcher_class = import_from_str(fetcher_class_name)
#         return fetcher_class(self, shot,
#                              config_name=config_name, **kwargs).fetch()
# 
# Path: pyfusion/test/tests.py
# class PfTestBase(object):
#     """Base class for generated sql and non-sql test cases."""
#     pass


import os
from numpy.testing import assert_array_almost_equal, assert_almost_equal
from numpy import genfromtxt, transpose
from pyfusion.acquisition.DSV.acq import DSVAcquisition
from pyfusion.acquisition.base import BaseAcquisition
from pyfusion.test.tests import PfTestBase
"""Test code for delimiter-separated values (DSV) flat file acquisition."""


class CheckDSVAcquisition(PfTestBase):
    """Test the fake data acquisition used for testing."""

    def testBaseClasses(self):
        """Make sure DSVAcquisition is subclass of Acquisition."""
        self.assertTrue(BaseAcquisition in DSVAcquisition.__bases__)

    def testdata(self):
        """read in a test file and compare returned data object to expected result""" 
        filename = os.path.join(os.path.dirname(__file__), "test_dsv.dat")
        data = genfromtxt(filename, unpack=True)

# Path: pyfusion/acquisition/DSV/acq.py
# class DSVAcquisition(BaseAcquisition):
#     pass
# 
# Path: pyfusion/acquisition/base.py
# class BaseAcquisition(object):
#     """Base class for datasystem specific acquisition classes.
# 
#     :param   config_name:  name   of  acquisition   as  specified in\
#     configuration file.
# 
#     On  instantiation,  the pyfusion  configuration  is  searched for  a
#     ``[Acquisition:config_name]``   section.    The   contents  of   the
#     configuration  section are  loaded into  the object  namespace.  For
#     example, a configuration section::
# 
#       [Acquisition:my_custom_acq]
#       acq_class = pyfusion.acquisition.base.BaseAcquisition
#       server = my.dataserver.com
#  
#     will result in the following behaviour::
# 
#      >>> from pyfusion.acquisition.base import BaseAcquisition
#      >>> my_acq = BaseAcquisition('my_custom_acq')
#      >>> print(my_acq.server)
#      my.dataserver.com
# 
#     The configuration entries can be overridden with keyword arguments::
# 
#      >>> my_other_acq = BaseAcquisition('my_custom_acq', server='your.data.net')
#      >>> print(my_other_acq.server)
#      your.data.net
# 
#     """
#     def __init__(self, config_name=None, **kwargs):
#         if config_name != None:
#             self.__dict__.update(get_config_as_dict('Acquisition', config_name))
#         self.__dict__.update(kwargs)
# 
#     def getdata(self, shot, config_name=None, **kwargs):
#         """Get the data and return prescribed subclass of BaseData.
#         
#         :param shot: shot number
#         :param config_name: name of a fetcher class in the configuration file
#         :returns: an instance of a subclass of \
#         :py:class:`~pyfusion.data.base.BaseData` or \
#         :py:class:`~pyfusion.data.base.BaseDataSet`
# 
#         This method needs to know which  data fetcher class to use, if a
#         config_name      argument     is      supplied      then     the
#         ``[Diagnostic:config_name]``   section   must   exist   in   the
#         configuration   file  and   contain  a   ``data_fetcher``  class
#         specification, for example::
# 
#          [Diagnostic:H1_mirnov_array_1_coil_1]
#          data_fetcher = pyfusion.acquisition.H1.fetch.H1DataFetcher
#          mds_path = \h1data::top.operations.mirnov:a14_14:input_1
#          coords_cylindrical = 1.114, 0.7732, 0.355
#          coord_transform = H1_mirnov
# 
#         If a ``data_fetcher`` keyword argument is supplied, it overrides
#         the configuration file specification.
# 
#         The  fetcher  class  is  instantiated,  including  any  supplied
#         keyword arguments, and the result of the ``fetch`` method of the
#         fetcher class is returned.
#         """
#         from pyfusion import config
#         # if there is a data_fetcher arg, use that, otherwise get from config
#         if kwargs.has_key('data_fetcher'):
#             fetcher_class_name = kwargs['data_fetcher']
#         else:
#             fetcher_class_name = config.pf_get('Diagnostic',
#                                                config_name,
#                                                'data_fetcher')
#         fetcher_class = import_from_str(fetcher_class_name)
#         return fetcher_class(self, shot,
#                              config_name=config_name, **kwargs).fetch()
# 
# Path: pyfusion/test/tests.py
# class PfTestBase(object):
#     """Base class for generated sql and non-sql test cases."""
#     pass


# Path: pyfusion/acquisition/DSV/test.py
import os
from numpy.testing import assert_array_almost_equal, assert_almost_equal
from numpy import genfromtxt, transpose
from pyfusion.acquisition.DSV.acq import DSVAcquisition
from pyfusion.acquisition.base import BaseAcquisition
from pyfusion.test.tests import PfTestBase

"""Test code for delimiter-separated values (DSV) flat file acquisition."""


class CheckDSVAcquisition(PfTestBase):
    """Test the fake data acquisition used for testing."""

    def testBaseClasses(self):
        """Make sure DSVAcquisition is subclass of Acquisition."""
        self.assertTrue(BaseAcquisition in DSVAcquisition.__bases__)

    def testdata(self):
        """read in a test file and compare returned data object to expected result""" 
        filename = os.path.join(os.path.dirname(__file__), "test_dsv.dat")
        data = genfromtxt(filename, unpack=True)

        test_acq = DSVAcquisition()