Exemplo n.º 1
0
def test_remove_DMX():
    """Check the DMX model no longer has the DMX components after they are removed. """
    dm_mod = DispersionDMX()
    index = 3
    dmx = 1.0
    mjd_start = 58000.0
    mjd_end = 58100.0
    dm_mod.add_DMX_range(mjd_start, mjd_end, index, dmx, frozen=False)
    dm_mod.remove_DMX_range(index)
    for pn in ["DMX_", "DMXR1_", "DMXR2_"]:
        nm = str(pn) + str(f"{int(index):04d}")
        assert nm not in dm_mod.params
Exemplo n.º 2
0
def test_print_inds():
    dm_mod = DispersionDMX()
    dmx = 1.0
    mjd_start = 58000.0
    mjd_end = 58100.0
    inds_init = 5
    dm_mod.remove_DMX_range(1)
    for i in range(inds_init):
        dm_mod.add_DMX_range(mjd_start, mjd_end, i, dmx, frozen=False)
    inds = dm_mod.get_indices()
    assert len(inds) == inds_init
    for i in range(inds_init):
        assert i in inds
Exemplo n.º 3
0
def test_remove_nonexistent_index():
    """ Check for error when a unused DMX index is removed. """
    dm_mod = DispersionDMX()
    index = 3
    with pytest.raises(ValueError):
        dm_mod.remove_DMX_range(index)