def test_stream_gethdr_count_2d(): """ Test the Stream.gethdr method for 2D data """ # Create two-dimensionnal data of size 'ns'x'nr' ns = 256 nr = 64 data = np.ones((nr, ns)) # Create a new Stream object object = Stream() # Create SU-like data structure from 'data' without options. object.create(data, dt=0.01) # Set header values object.header[:]['sx'] = 10 object.header[:]['scalco'] = 1 # Get header values sx = object.gethdr(key='sx', imin=0, count=1) # Create an equivalent of attempted result sx_att = 10. np.testing.assert_equal(sx, sx_att)
def test_stream_gethdr_1d(): """ Test the Stream.gethdr method for 1D data. """ # Create one-dimensional data of size 'ns' ns = 256 data = np.ones(ns) # Create a new Stream object object = Stream() # Create SU-like data structure from 'data' with option. object.create(data, dt=0.01) # Get header value dt = object.gethdr(key='dt') np.testing.assert_equal(dt, 0.01)
def test_stream_gethdr_2d(): """ Test the Stream.gethdr method for 2D data """ # Create two-dimensionnal data of size 'ns'x'nr' ns = 256 nr = 64 data = np.ones((nr, ns)) # Create a new Stream object object = Stream() # Create SU-like data structure from 'data' without options. object.create(data, dt=0.01) # Get header values dt = object.gethdr(key='dt') # Create an equivalent of attempted result dt_att = np.zeros(nr, dtype=np.float32) dt_att[:] = 0.01 np.testing.assert_equal(dt, dt_att)