diff --git a/Pyxides/im/argo.py b/Pyxides/im/argo.py index e9b74ce..bd16a85 100644 --- a/Pyxides/im/argo.py +++ b/Pyxides/im/argo.py @@ -20,7 +20,6 @@ # register ourselves with Pyxis and define the superglobals register_pyxis_module(superglobals="MS LSM") -register_pyxis_module() rm_fr = x.rm.args("-fr") diff --git a/Pyxides/imager.py b/Pyxides/imager.py index 3e03156..a070326 100644 --- a/Pyxides/imager.py +++ b/Pyxides/imager.py @@ -1,5 +1,3 @@ -from Pyxides.im import argo - from Pyxis.ModSupport import * register_pyxis_module(superglobals="MS LSM DESTDIR"); diff --git a/Pyxis/Internals.py b/Pyxis/Internals.py index 2fbccb3..1570ded 100644 --- a/Pyxis/Internals.py +++ b/Pyxis/Internals.py @@ -12,6 +12,7 @@ import fnmatch import shutil import shlex +import six import Pyxis @@ -725,15 +726,15 @@ def set_logfile (filename,quiet=False): sys.stdout,sys.stderr = sys.__stdout__,sys.__stderr__; _current_logobj = None; else: - mode = "wa"; + mode = "a"; # append to file if name starts with +, or if file has already been used as a log this session, or if flush is off if Pyxis.Context.get("LOG_FLUSH"): mode = "w"; if filename[0] == '+': filename = filename[1:]; - mode = "wa"; + mode = "a"; if filename in _visited_logfiles: - mode = "wa"; + mode = "a"; Pyxis.ModSupport.makedir(os.path.dirname(filename),no_interpolate=True); _current_logobj = sys.stdout = sys.stderr = open(filename,mode); hdr = Pyxis.Context.get("LOG_HEADER"); @@ -786,7 +787,7 @@ def initconf (force=False,files=[],directory="."): if Pyxis.Context.get("PYXIS_AUTO_IMPORT_MODULES",True) and toplevel: _verbose(1,"importing top-level modules (%s) for you. Preset PYXIS_AUTO_IMPORT_MODULES=False to disable."%", ".join(toplevel)); for mod in toplevel: - Pyxis.Context[mod] = sys.modules.get(mod,sys.modules.get("Pyxides."+m)); + Pyxis.Context[mod] = sys.modules.get(mod, sys.modules.get("Pyxides."+mod)); def loadconf (filename,frame=None,chdir=True): """Loads config file"""; @@ -822,7 +823,7 @@ def load_package (pkgname,filename,chdir=True,report=True): if dirname not in oldpath: sys.path.append(dirname); try: - exec(open(filename),Pyxis.Context); + exec(open(filename, "rt").read(), Pyxis.Context, Pyxis.Context) finally: sys.path = oldpath; except SystemExit: diff --git a/Pyxis/ModSupport.py b/Pyxis/ModSupport.py index 8093836..2ca0793 100644 --- a/Pyxis/ModSupport.py +++ b/Pyxis/ModSupport.py @@ -1,6 +1,7 @@ """Pyxis.ModSupport: functions for programming Pyxides modules""" -import fnmatch +import fnmatch +import inspect, traceback import Pyxis from Pyxis import * @@ -20,10 +21,10 @@ def register_pyxis_module (superglobals=""): module = sys.modules[modname]; if modname.startswith("Pyxides."): modname = modname.split(".",1)[-1]; - # check for double registration if id(globs) in _superglobals: if _modules[modname] is not module: raise RuntimeError("a different Pyxis module named '%s' is already registered"%modname); + return _modules[modname] = module; # build list of superglobals if isinstance(superglobals,str): @@ -34,7 +35,7 @@ def register_pyxis_module (superglobals=""): _verbose(1,"registered module '%s'"%modname); _namespaces[modname] = globs; _superglobals[id(globs)] = superglobs; - Pyxis.Context[modname] = __import__(modname,Pyxis.Context); + Pyxis.Context[modname] = module; # add superglobals for sym in superglobs: # if superglobal is already defined, copy its value to the new module diff --git a/Pyxis/doc/example/pyxis-wsrt21cm.py b/Pyxis/doc/example/pyxis-wsrt21cm.py index 6ef53ab..526b395 100644 --- a/Pyxis/doc/example/pyxis-wsrt21cm.py +++ b/Pyxis/doc/example/pyxis-wsrt21cm.py @@ -7,7 +7,9 @@ # import some Pyxides modules. # Note that Pyxides is implicitly added to the include path # when you import Pyxis above -import ms,imager,std,lsm,stefcal +import ms,imager,std,lsm + +from Cattery.Pyxides import stefcal # import some other Python modules that we make use of below from astropy.io import fits as pyfits diff --git a/Pyxis/recipies/imagers-test/WSRT_ANTENNA/table.dat b/Pyxis/recipes/imagers-test/WSRT_ANTENNA/table.dat similarity index 100% rename from Pyxis/recipies/imagers-test/WSRT_ANTENNA/table.dat rename to Pyxis/recipes/imagers-test/WSRT_ANTENNA/table.dat diff --git a/Pyxis/recipies/imagers-test/WSRT_ANTENNA/table.f0 b/Pyxis/recipes/imagers-test/WSRT_ANTENNA/table.f0 similarity index 100% rename from Pyxis/recipies/imagers-test/WSRT_ANTENNA/table.f0 rename to Pyxis/recipes/imagers-test/WSRT_ANTENNA/table.f0 diff --git a/Pyxis/recipies/imagers-test/WSRT_ANTENNA/table.info b/Pyxis/recipes/imagers-test/WSRT_ANTENNA/table.info similarity index 100% rename from Pyxis/recipies/imagers-test/WSRT_ANTENNA/table.info rename to Pyxis/recipes/imagers-test/WSRT_ANTENNA/table.info diff --git a/Pyxis/recipies/imagers-test/WSRT_ANTENNA/table.lock b/Pyxis/recipes/imagers-test/WSRT_ANTENNA/table.lock similarity index 100% rename from Pyxis/recipies/imagers-test/WSRT_ANTENNA/table.lock rename to Pyxis/recipes/imagers-test/WSRT_ANTENNA/table.lock diff --git a/Pyxis/recipies/imagers-test/WSRT_makems.cfg b/Pyxis/recipes/imagers-test/WSRT_makems.cfg similarity index 100% rename from Pyxis/recipies/imagers-test/WSRT_makems.cfg rename to Pyxis/recipes/imagers-test/WSRT_makems.cfg diff --git a/Pyxis/recipies/imagers-test/basic_imager_test.py b/Pyxis/recipes/imagers-test/basic_imager_test.py similarity index 98% rename from Pyxis/recipies/imagers-test/basic_imager_test.py rename to Pyxis/recipes/imagers-test/basic_imager_test.py index a61fb5b..b35ba5a 100644 --- a/Pyxis/recipies/imagers-test/basic_imager_test.py +++ b/Pyxis/recipes/imagers-test/basic_imager_test.py @@ -12,7 +12,7 @@ PYXIS_ROOT_NAMESPACE = True # must set this before import! import Pyxis import Pyxides - PACKAGE_TEST_DIR = os.path.join(os.path.dirname(Pyxis.__file__), "recipies", "imagers-test") + PACKAGE_TEST_DIR = os.path.join(os.path.dirname(Pyxis.__file__), "recipes", "imagers-test") if not os.path.exists(PACKAGE_TEST_DIR): raise RuntimeError("Installation excludes {}".format(PACKAGE_TEST_DIR)) except: diff --git a/Pyxis/recipies/imagers-test/imager.conf b/Pyxis/recipes/imagers-test/imager.conf similarity index 100% rename from Pyxis/recipies/imagers-test/imager.conf rename to Pyxis/recipes/imagers-test/imager.conf diff --git a/Pyxis/recipies/meqtrees-batch-test/WSRT_ANTENNA/table.dat b/Pyxis/recipes/meqtrees-batch-test/WSRT_ANTENNA/table.dat similarity index 100% rename from Pyxis/recipies/meqtrees-batch-test/WSRT_ANTENNA/table.dat rename to Pyxis/recipes/meqtrees-batch-test/WSRT_ANTENNA/table.dat diff --git a/Pyxis/recipies/meqtrees-batch-test/WSRT_ANTENNA/table.f0 b/Pyxis/recipes/meqtrees-batch-test/WSRT_ANTENNA/table.f0 similarity index 100% rename from Pyxis/recipies/meqtrees-batch-test/WSRT_ANTENNA/table.f0 rename to Pyxis/recipes/meqtrees-batch-test/WSRT_ANTENNA/table.f0 diff --git a/Pyxis/recipies/meqtrees-batch-test/WSRT_ANTENNA/table.info b/Pyxis/recipes/meqtrees-batch-test/WSRT_ANTENNA/table.info similarity index 100% rename from Pyxis/recipies/meqtrees-batch-test/WSRT_ANTENNA/table.info rename to Pyxis/recipes/meqtrees-batch-test/WSRT_ANTENNA/table.info diff --git a/Pyxis/recipies/meqtrees-batch-test/WSRT_ANTENNA/table.lock b/Pyxis/recipes/meqtrees-batch-test/WSRT_ANTENNA/table.lock similarity index 100% rename from Pyxis/recipies/meqtrees-batch-test/WSRT_ANTENNA/table.lock rename to Pyxis/recipes/meqtrees-batch-test/WSRT_ANTENNA/table.lock diff --git a/Pyxis/recipies/meqtrees-batch-test/WSRT_makems.cfg b/Pyxis/recipes/meqtrees-batch-test/WSRT_makems.cfg similarity index 100% rename from Pyxis/recipies/meqtrees-batch-test/WSRT_makems.cfg rename to Pyxis/recipes/meqtrees-batch-test/WSRT_makems.cfg diff --git a/Pyxis/recipies/meqtrees-batch-test/batch_test.py b/Pyxis/recipes/meqtrees-batch-test/batch_test.py similarity index 99% rename from Pyxis/recipies/meqtrees-batch-test/batch_test.py rename to Pyxis/recipes/meqtrees-batch-test/batch_test.py index a164cc2..7215b20 100644 --- a/Pyxis/recipies/meqtrees-batch-test/batch_test.py +++ b/Pyxis/recipes/meqtrees-batch-test/batch_test.py @@ -12,7 +12,7 @@ PYXIS_ROOT_NAMESPACE = True # must set this before import! import Pyxis import Pyxides - PACKAGE_TEST_DIR = os.path.join(os.path.dirname(Pyxis.__file__), "recipies", "meqtrees-batch-test") + PACKAGE_TEST_DIR = os.path.join(os.path.dirname(Pyxis.__file__), "recipes", "meqtrees-batch-test") if not os.path.exists(PACKAGE_TEST_DIR): raise RuntimeError("Installation excludes {}".format(PACKAGE_TEST_DIR)) except: diff --git a/Pyxis/recipies/meqtrees-batch-test/cal.py b/Pyxis/recipes/meqtrees-batch-test/cal.py similarity index 100% rename from Pyxis/recipies/meqtrees-batch-test/cal.py rename to Pyxis/recipes/meqtrees-batch-test/cal.py diff --git a/Pyxis/recipies/meqtrees-batch-test/imager.conf b/Pyxis/recipes/meqtrees-batch-test/imager.conf similarity index 100% rename from Pyxis/recipies/meqtrees-batch-test/imager.conf rename to Pyxis/recipes/meqtrees-batch-test/imager.conf diff --git a/Pyxis/recipies/meqtrees-batch-test/sim.py b/Pyxis/recipes/meqtrees-batch-test/sim.py similarity index 100% rename from Pyxis/recipies/meqtrees-batch-test/sim.py rename to Pyxis/recipes/meqtrees-batch-test/sim.py diff --git a/Pyxis/recipies/meqtrees-batch-test/test-lsm.txt b/Pyxis/recipes/meqtrees-batch-test/test-lsm.txt similarity index 100% rename from Pyxis/recipies/meqtrees-batch-test/test-lsm.txt rename to Pyxis/recipes/meqtrees-batch-test/test-lsm.txt diff --git a/Pyxis/recipies/meqtrees-batch-test/test-lsm1.txt.reference b/Pyxis/recipes/meqtrees-batch-test/test-lsm1.txt.reference similarity index 100% rename from Pyxis/recipies/meqtrees-batch-test/test-lsm1.txt.reference rename to Pyxis/recipes/meqtrees-batch-test/test-lsm1.txt.reference diff --git a/Pyxis/recipies/meqtrees-batch-test/test-lsm2.txt.reference b/Pyxis/recipes/meqtrees-batch-test/test-lsm2.txt.reference similarity index 100% rename from Pyxis/recipies/meqtrees-batch-test/test-lsm2.txt.reference rename to Pyxis/recipes/meqtrees-batch-test/test-lsm2.txt.reference diff --git a/Pyxis/recipies/meqtrees-batch-test/test-refimage.fits b/Pyxis/recipes/meqtrees-batch-test/test-refimage.fits similarity index 100% rename from Pyxis/recipies/meqtrees-batch-test/test-refimage.fits rename to Pyxis/recipes/meqtrees-batch-test/test-refimage.fits diff --git a/Pyxis/recipies/meqtrees-batch-test/test-refresidual.fits b/Pyxis/recipes/meqtrees-batch-test/test-refresidual.fits similarity index 100% rename from Pyxis/recipies/meqtrees-batch-test/test-refresidual.fits rename to Pyxis/recipes/meqtrees-batch-test/test-refresidual.fits diff --git a/Pyxis/recipies/meqtrees-batch-test/testing.tdl.conf b/Pyxis/recipes/meqtrees-batch-test/testing.tdl.conf similarity index 100% rename from Pyxis/recipies/meqtrees-batch-test/testing.tdl.conf rename to Pyxis/recipes/meqtrees-batch-test/testing.tdl.conf diff --git a/setup.py b/setup.py index 3e26c31..8dd7b03 100755 --- a/setup.py +++ b/setup.py @@ -10,6 +10,7 @@ 'matplotlib', 'python_casacore', 'numpy<=1.16', + 'scipy', 'future' ] if six.PY2 else [ 'astropy>=3.0', @@ -17,6 +18,7 @@ 'matplotlib', 'python_casacore', 'numpy>=1.16', + 'scipy', 'future' ]