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
def test_values_to_labels(self, values, expected): mb = Maskbit(name=name, schema=schema, description=description) if values is None: mb.mask = mask actual = mb.values_to_labels(values=values) assert actual == expected
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()
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()