Esempio n. 1
0
def test_operations_datastack_group(ds_setup, ds_datadir):
    '''We are testing one of several grouping schemes here.'''
    datadir = ds_datadir
    datastack.load_pha("myid", '/'.join((datadir, "3c273.pi")))
    d1 = datastack.get_data('myid')
    datastack.group_counts('myid', 5)
    assert np.allclose(d1.get_dep(filter=True)[15:20], [5., 5., 6., 7., 10.])
    datastack.ungroup('myid')
    assert np.all(d1.get_dep(filter=True)[15:20] == [3., 7., 1., 6., 4.])
Esempio n. 2
0
def test_operations_datastack_subtract(ds_setup, ds_datadir):

    datadir = ds_datadir
    datastack.load_pha("myid", '/'.join((datadir, "3c273.pi")))
    d1 = datastack.get_data('myid')
    assert np.all(d1.get_dep()[15:20] == [3., 7., 1., 6., 4.])
    datastack.subtract('myid')
    assert np.allclose(d1.get_dep()[15:20], [2.86507936, 6.86507936, 1.,
                                             6., 4.])
    datastack.unsubtract('myid')
    assert np.all(d1.get_dep()[15:20] == [3., 7., 1., 6., 4.])
Esempio n. 3
0
def test_show_stack4(ds_setup, ds_datadir, capsys):
    """Test the show_stack handling: No MJD_OBS or MJD-OBS keyword
    """

    ls = '@' + '/'.join((ds_datadir, 'pha.lis'))
    datastack.load_pha(ls)

    # Remove the MJD-OBS keyword.
    #
    for idval in [1, 2]:
        d = datastack.get_data(idval)
        del d.header['MJD_OBS']

    validate_show_stack(capsys, ds_datadir, None, None)
Esempio n. 4
0
def test_show_stack3(ds_setup, ds_datadir, capsys):
    """Test the show_stack handling: mixed MJD_OBS and MJD-OBS
    """

    # These files use MJD_OBS in the header
    ls = '@' + '/'.join((ds_datadir, 'pha.lis'))
    datastack.load_pha(ls)

    # Change to MJD-OBS (second file only)
    #
    for idval in [2]:
        d = datastack.get_data(idval)
        mjdobs = d.header['MJD_OBS']
        d.header['MJD-OBS'] = mjdobs
        del d.header['MJD_OBS']

    validate_show_stack(capsys, ds_datadir, 'MJD_OBS', 'MJD-OBS')
Esempio n. 5
0
def test_show_stack2(ds_setup, ds_datadir, capsys):
    """Test the show_stack handling: MJD-OBS

    This is test_show_stack but with the data files adjusted
    to have MJD-OBS rather than MJD_OBS keywords
    """

    # These files use MJD_OBS in the header
    ls = '@' + '/'.join((ds_datadir, 'pha.lis'))
    datastack.load_pha(ls)

    # Change to MJD-OBS
    #
    for idval in [1, 2]:
        d = datastack.get_data(idval)
        mjdobs = d.header['MJD_OBS']
        d.header['MJD-OBS'] = mjdobs
        del d.header['MJD_OBS']

    validate_show_stack(capsys, ds_datadir, 'MJD-OBS', 'MJD-OBS')