Skip to content

Commit

Permalink
Merge branch 'move-tests'
Browse files Browse the repository at this point in the history
* move-tests: (5 commits)
  Add missing data files
  ...
  • Loading branch information
suvayu committed Oct 23, 2024
2 parents caa1d01 + 98aac47 commit 4e8a705
Show file tree
Hide file tree
Showing 99 changed files with 2,582 additions and 53 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ dependencies = [

[tool.pytest.ini_options]
testpaths = ["test"]
addopts = ["--import-mode=importlib", "--cov=sourcefinder", "-q"]
addopts = ["--import-mode=importlib", "--cov=sourcefinder", "-q", "-ra"]

[tool.black]
include = '\.pyi?$'
Expand Down
4 changes: 2 additions & 2 deletions sourcefinder/testutil/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __init__(self,
Generate a synthetic image for use in tests
Args:
wcs (tkp.utility.coordinates.WCS): WCS for the image.
wcs (sourcefinder.utility.coordinates.WCS): WCS for the image.
data (array_like): Data for the image. Default is a 512x512 array of
zeroes.
beam (tuple): Beamsemi-major axis (in pixels), semi-minor axis (pixels)
Expand Down Expand Up @@ -102,4 +102,4 @@ def __init__(self,
def calculate_phase_centre(self):
x, y = self.data.shape
centre_ra, centre_decl = self.wcs.p2s((x / 2, y / 2))
return centre_ra, centre_decl
return centre_ra, centre_decl
50 changes: 0 additions & 50 deletions sourcefinder/utility/__init__.py
Original file line number Diff line number Diff line change
@@ -1,50 +0,0 @@
"""
Root level :mod:`sourcefinder.utility` functions that don't justify a submodule:
"""
import math


def nice_format(f):
if f > 9999 or f < 0.01:
return "%.2e" % f
else:
return "%.2f" % f


def substitute(value, sub, test_f):
try:
if test_f(value):
return sub
except TypeError:
pass
return value


def substitute_inf(value, sub="Infinity"):
"""
If value is not infinite, return value. Otherwise, return sub.
"""
return substitute(value, sub, math.isinf)


def substitute_nan(value, sub=0.0):
"""
If value is not NaN, return value. Otherwise, return sub.
"""
return substitute(value, sub, math.isnan)


class adict(dict):
"""
Accessing dict keys like an attribute.
"""

def __getattr__(self, key):
try:
return self[key]
except KeyError:
msg = "can't find %s, please check your settings file"
raise AttributeError(msg % key)

__setattr__ = dict.__setitem__
1 change: 1 addition & 0 deletions sourcefinder/utility/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ def __setattr__(self, attrname, value):
def __getattr__(self, attrname):
if attrname in self.WCS_ATTRS:
return getattr(self.wcs.wcs, attrname)
raise AttributeError(f"{type(self)!r} object has no attribute {attrname!r}")

def p2s(self, pixpos):
"""
Expand Down
Binary file added test/data/aartfaac.fits
Binary file not shown.
Binary file added test/data/aartfaac.table/logtable/table.dat
Binary file not shown.
Binary file added test/data/aartfaac.table/logtable/table.f0
Binary file not shown.
4 changes: 4 additions & 0 deletions test/data/aartfaac.table/logtable/table.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Type = Log message
SubType =

Repository for software-generated logging messages
Binary file added test/data/aartfaac.table/logtable/table.lock
Binary file not shown.
Binary file added test/data/aartfaac.table/table.dat
Binary file not shown.
Binary file added test/data/aartfaac.table/table.f0
Binary file not shown.
Binary file added test/data/aartfaac.table/table.f0_TSM0
Binary file not shown.
3 changes: 3 additions & 0 deletions test/data/aartfaac.table/table.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Type = Image
SubType =

Binary file added test/data/aartfaac.table/table.lock
Binary file not shown.
Binary file added test/data/ami-la.image/logtable/table.dat
Binary file not shown.
Binary file added test/data/ami-la.image/logtable/table.f0
Binary file not shown.
4 changes: 4 additions & 0 deletions test/data/ami-la.image/logtable/table.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Type = Log message
SubType =

Repository for software-generated logging messages
Binary file added test/data/ami-la.image/logtable/table.lock
Binary file not shown.
Binary file added test/data/ami-la.image/table.dat
Binary file not shown.
Binary file added test/data/ami-la.image/table.f0
Binary file not shown.
Binary file added test/data/ami-la.image/table.f0_TSM0
Binary file not shown.
3 changes: 3 additions & 0 deletions test/data/ami-la.image/table.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Type = Image
SubType =

Binary file added test/data/ami-la.image/table.lock
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Type =
SubType =

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Type =
SubType =

Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Type =
SubType =

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Type =
SubType =

Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Type =
SubType =

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Type =
SubType =

Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Type =
SubType =

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Type =
SubType =

Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Type =
SubType =

Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Type = Log message
SubType =

Repository for software-generated logging messages
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Type = Image
SubType =

Binary file not shown.
Binary file added test/data/kat7.image/logtable/table.dat
Binary file not shown.
Binary file added test/data/kat7.image/logtable/table.f0
Binary file not shown.
4 changes: 4 additions & 0 deletions test/data/kat7.image/logtable/table.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Type = Log message
SubType =

Repository for software-generated logging messages
Binary file added test/data/kat7.image/logtable/table.lock
Binary file not shown.
Binary file added test/data/kat7.image/table.dat
Binary file not shown.
Binary file added test/data/kat7.image/table.f0
Binary file not shown.
Binary file added test/data/kat7.image/table.f0_TSM0
Binary file not shown.
3 changes: 3 additions & 0 deletions test/data/kat7.image/table.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Type = Image
SubType =

Binary file added test/data/kat7.image/table.lock
Binary file not shown.
Binary file added test/data/lofar.fits
Binary file not shown.
Binary file added test/data/lofar.h5
Binary file not shown.
Loading

0 comments on commit 4e8a705

Please sign in to comment.