Skip to content
Snippets Groups Projects
XYZAlgorithm_test.py 1.18 KiB
Newer Older
  • Learn to ignore specific revisions
  • Hal Simpson's avatar
    Hal Simpson committed
    #! /usr/bin/env python
    from obspy.core.stream import Stream
    from nose.tools import assert_equals
    
    from nose.tools import assert_is
    
    Hal Simpson's avatar
    Hal Simpson committed
    from XYZAlgorithm import XYZAlgorithm
    from StreamConverter_test import __create_trace
    
    
    def test_xyzalgorithm_process():
        """geomag.XYZAlgorithmtest.test_algorithm_process()
    
        confirms that a converted stream contains the correct outputchannels.
        """
        algorithm = XYZAlgorithm('obs', 'geo')
        timeseries = Stream()
        timeseries += __create_trace('H', [1, 1])
        timeseries += __create_trace('E', [1, 1])
        timeseries += __create_trace('Z', [1, 1])
        timeseries += __create_trace('F', [1, 1])
        outputstream = algorithm.process(timeseries)
    
        assert_is(outputstream[0].stats.channel, 'X')
    
    Hal Simpson's avatar
    Hal Simpson committed
    
    
    def test_xyzalgorithm_channels():
        """geomag.XYZAlgorithmtest.test_algorithm_process()
    
        confirms that the input/output channels are correct for the given
        informat/outformat during instantiation.
        """
        algorithm = XYZAlgorithm('obs', 'geo')
        inchannels = ['H', 'E', 'Z', 'F']
        outchannels = ['X', 'Y', 'Z', 'F']
        assert_equals(algorithm.get_input_channels(), inchannels)
        assert_equals(algorithm.get_output_channels(), outchannels)