Beispiel #1
0
def test_plot_target_mollweide(plot):

    target = Target('MyTarget', [(100, 65), (120, 70), (110, 70)],
                    region_type='polygon')

    assert isinstance(target.region, regions.PolygonalRegion)

    fig, ax = target.plot(projection='mollweide')

    if plot:
        plot_path = pathlib.Path(
            __file__).parents[1] / 'plots/test_mytarget_mollweide.pdf'
        plt.savefig(str(plot_path))

    assert isinstance(fig, plt.Figure)
    assert isinstance(ax, Axes)
Beispiel #2
0
def test_tiling_no_ifu(test_target_file):

    target_1 = Target.from_target_list('Target1', target_list=test_target_file)

    assert isinstance(target_1, Target)

    tiling = Tiling(target_1)

    assert isinstance(tiling, Tiling)
    assert len(tiling.tiles) == 0
Beispiel #3
0
def test_target_from_list(restore_config):

    test_target_list = pathlib.Path(
        __file__).parents[1] / 'test_data/test_targets.yaml'

    assert test_target_list.exists()

    lvmsurveysim.config['target_list'] = str(test_target_list)

    target_1 = Target.from_target_list('Target1')

    assert target_1.name == 'Target1'
    assert isinstance(target_1, Target)
    assert isinstance(target_1.region, regions.EllipticalRegion)
Beispiel #4
0
def test_targets(target_name, coords, target_type, target_params):

    target = Target(target_name, coords, target_type, target_params)
    assert isinstance(target, Target)

    assert target.name == target_name

    assert hasattr(target, 'region')

    if target_type == 'circle':
        assert isinstance(target.region, regions.CircularRegion)
    elif target_type == 'ellipse':
        assert isinstance(target.region, regions.EllipticalRegion)
    elif target_type == 'polygon':
        assert isinstance(target.region, regions.PolygonalRegion)
    else:
        raise ValueError('invalid region type')