diff --git a/Tigger/bin/tigger_convert.py b/Tigger/bin/tigger_convert.py index 485d63d..feed4b1 100644 --- a/Tigger/bin/tigger_convert.py +++ b/Tigger/bin/tigger_convert.py @@ -461,7 +461,7 @@ def convert_coordinates(coords): # recompute 'r' attribute (unless --center is in effect, in which case it's going to be done anyway below) if options.refresh_r: for src in model2.sources: - src.setAttribute('r', Coordinates.angular_dist_pos_angle(ra0, dec0, *model.fieldCenter())[0]) + src.setAttribute('r', Coordinates.angular_dist_pos_angle(src.pos.ra, src.pos.dec, *model.fieldCenter())[0]) print("Appended %d sources from %s (%s)" % (len(model2.sources), filename, append_doc)) # apply center, if specified @@ -515,8 +515,8 @@ def convert_coordinates(coords): tags = ff[3:] if len(ff) > 3 else [] except: parser.error("Invalid --add-brick setting %s" % brickspec) - if [src.name for src in sources if src.name == name]: - print("Error: model already contains a source named '%s'" % name) + if [src.name for src in sources if src.name == srcname]: + print("Error: model already contains a source named '%s'" % srcname) # add brick from astropy.io import fits as pyfits from astLib.astWCS import WCS diff --git a/Tigger/bin/tigger_make_brick.py b/Tigger/bin/tigger_make_brick.py index 70aaea2..6ddb866 100644 --- a/Tigger/bin/tigger_make_brick.py +++ b/Tigger/bin/tigger_make_brick.py @@ -221,7 +221,7 @@ def main(): src.flux.I = max_flux src.shape.ex, src.shape.ey = sx, sy src.shape.nx, src.shape.ny = nx, ny - src.shape.pad = pad + src.shape.pad = options.pad break # not contained, make new source object else: diff --git a/Tigger/bin/tigger_restore.py b/Tigger/bin/tigger_restore.py index d0fefe7..0bf07e3 100644 --- a/Tigger/bin/tigger_restore.py +++ b/Tigger/bin/tigger_restore.py @@ -196,7 +196,7 @@ def main(): if not isinstance(dum, float): raise TypeError("Primary beam expression does not evaluate to a float") except Exception as exc: - print("Bad primary beam expression '%s': %s" % (pb, str(exc))) + print("Bad primary beam expression '%s': %s" % (options.pb, str(exc))) sys.exit(1) if not freq: print("Model must contain a reference requency, or else specify one with --freq.") diff --git a/Tigger/bin/tigger_tag.py b/Tigger/bin/tigger_tag.py index 204d7e0..72d91f2 100644 --- a/Tigger/bin/tigger_tag.py +++ b/Tigger/bin/tigger_tag.py @@ -300,7 +300,7 @@ def lookupObject(src, tagname): # else some other type is specified -- use it to convert the value elif typename: try: - newval = getattr(__builtin__, typename)(value) + newval = getattr(globals()["__builtin__"], typename)(value) except: print("Can't parse \"%s\" as a value of type %s" % (value, typename)) sys.exit(2) diff --git a/pyproject.toml b/pyproject.toml index c021160..3e46ad4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,6 +29,15 @@ tigger-tag = "Tigger.bin.tigger_tag:main" tigger-restore = "Tigger.bin.tigger_restore:main" tigger-make-brick = "Tigger.bin.tigger_make_brick:main" + +[tool.poetry.group.tests] +optional = true +[tool.poetry.group.tests.dependencies] +pytest = "^7.1.3" +flake8 = "*" + + + [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api"