Ejemplo n.º 1
0
def test_trim_and_o_fail2():
    temporary_path = mkdtemp()
    fs = generate_bias_file()
    fits.writeto('%s/flat.fits' % (temporary_path), fs, clobber=True)

    bins = 'fail'
    detconf = {
        'trim1': [[0,2056],[50,4146]],
        'trim2': [[2156,4212],[50,4146]],
        'bng': bins
    }
    with pytest.raises(ValueError) as excinfo:
        trimOut(
            '%s/flat.fits' % (temporary_path),
            detconf,
            out='%s/result.fits' % (temporary_path)
        )
    shutil.rmtree(temporary_path)
    assert excinfo.value.args[0] == "%s must be one if '11', '12', '21, '22'" % bins
Ejemplo n.º 2
0
def test_trim_and_o_fail():
    temporary_path = mkdtemp()
    fs = generate_bias_file()
    fits.writeto('%s/flat.fits' % (temporary_path), fs, clobber=True)

    direction = 'fails'
    detconf = {
        'trim1': [[0,2056],[50,4146]],
        'trim2': [[2156,4212],[50,4146]],
        'bng': [1,1]
    }
    with pytest.raises(ValueError) as excinfo:
        trimOut(
            '%s/flat.fits' % (temporary_path),
            detconf,
            out='%s/result.fits' % (temporary_path),
            direction=direction
        )
    shutil.rmtree(temporary_path)
    assert excinfo.value.args[0] == "%s must be either 'normal' or 'mirror'" % direction
Ejemplo n.º 3
0
def test_trim_and_o(direction):
    temporary_path = mkdtemp()
    detconf = {
        'trim1': [[0,2056],[50,4146]],
        'trim2': [[2156,4212],[50,4146]],
        'bng': [1,1]
    }
    fs = generate_bias_file()
    fits.writeto('%s/flat.fits' % (temporary_path), fs, clobber=True)
    trimOut(
        '%s/flat.fits' % (temporary_path),
        detconf,
        out='%s/result.fits' % (temporary_path),
        direction=direction,
    )
    with fits.open('%s/result.fits' % (temporary_path)) as hdul:
        assert hdul[0].shape[0] + 100 == fs.shape[0]
        assert hdul[0].shape[1] + 100 == fs.shape[1]

    shutil.rmtree(temporary_path)