コード例 #1
0
ファイル: test_maskbit.py プロジェクト: karenlmasters/marvin
    def test_get_mask_nonpresent_label(self, labels):

        mb = Maskbit(name=name, schema=schema, description=description)

        with pytest.raises(ValueError) as ee:
            mb.get_mask(labels)

        assert 'label \'BITFAKE\' not found in the maskbit schema.' in str(ee)
コード例 #2
0
def _mask_nocov(dapmap, mask, ivar=None):
    """Mask spaxels that are not covered by the IFU.

    Parameters:
        dapmap (marvin.tools.map.Map):
            Marvin Map object.
        mask (array):
            Mask for image.
        ivar (array):
            Inverse variance for image. Default is None.

    Returns:
        array: Boolean array for mask (i.e., True corresponds to value to be
        masked out).
    """
    assert (dapmap is not None) or (mask is not None) or (ivar is not None), \
        'Must provide ``dapmap``, ``mask`` or ``ivar``.'

    if dapmap is None:
        pixmask = Maskbit('MANGA_DAPPIXMASK')
        pixmask.mask = mask
    else:
        pixmask = dapmap.pixmask

    try:
        return pixmask.get_mask('NOCOV')
    except (MarvinError, AttributeError, IndexError, TypeError):
        return ivar == 0
コード例 #3
0
ファイル: test_maskbit.py プロジェクト: karenlmasters/marvin
    def test_get_mask_empty(self, labels, dtype, expected):

        mb = Maskbit(name=name, schema=schema, description=description)
        mb.mask = mask
        actual = mb.get_mask(labels, mask=custom_mask, dtype=dtype)
        assert (actual == expected).all()
コード例 #4
0
ファイル: test_maskbit.py プロジェクト: karenlmasters/marvin
 def test_get_mask_bool(self, labels, expected):
     mb = Maskbit(name=name, schema=schema, description=description)
     mb.mask = mask
     actual = mb.get_mask(labels, dtype=bool)
     assert (actual == expected).all()