/usr/lib/python3/dist-packages/pyregion/tests/test_get_mask.py is in python3-pyregion 2.0-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import os
import numpy as np
from os.path import join
from astropy.io.fits import Header
from .. import open as pyregion_open
rootdir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')
def demo_header():
return Header.fromtextfile(join(rootdir, "sample_fits01.header"))
def test_region():
ref_name = "test01_img.reg"
header = demo_header()
ref_region = pyregion_open(join(rootdir, ref_name)).as_imagecoord(header)
mask = ref_region.get_mask(shape=(100, 100))
assert isinstance(mask, np.ndarray) and mask.shape == (100, 100)
# TODO: assert the content of the mask, too
|