Skip to content

Commit

Permalink
change relative include to include from (.). Subs - for _ in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
landmanbester committed Mar 4, 2024
1 parent c08f709 commit 64dc3f4
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
6 changes: 3 additions & 3 deletions pfb/parser/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import glob
from typing import *
from scabha import configuratt
from scabha.cargo import Parameter
from scabha.cargo import Parameter, _UNSET_DEFAULT
from omegaconf.omegaconf import OmegaConf


Expand All @@ -28,14 +28,14 @@ class _CabInputsOutputs(object):
config_class="PfbCleanCabs",
use_cache=False)

# this is required since upgrade of scabha to caching branch
# tmp is a tuple containing the config object as the first element
# and a set containing locations of .yaml configs for pfb workers
schema = OmegaConf.create(tmp[0])

# is this still necessary?
for worker in schema.keys():
for param in schema[worker]['inputs']:
if schema[worker]['inputs'][param]['default'] == '<UNSET DEFAULT VALUE>':
if schema[worker]['inputs'][param]['default'] == _UNSET_DEFAULT:
schema[worker]['inputs'][param]['default'] = None


Expand Down
18 changes: 9 additions & 9 deletions pfb/parser/uncabbedcabs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pfb.init:
pass_missing_as_none: true

_include:
- init.yaml
- (.)init.yaml

pfb.grid:
command: pfb.workers.grid.grid
Expand All @@ -14,7 +14,7 @@ pfb.grid:
pass_missing_as_none: true

_include:
- grid.yaml
- (.)grid.yaml

pfb.degrid:
command: pfb.workers.degrid.degrid
Expand All @@ -23,7 +23,7 @@ pfb.degrid:
pass_missing_as_none: true

_include:
- degrid.yaml
- (.)degrid.yaml

pfb.clean:
command: pfb.workers.clean.clean
Expand All @@ -32,7 +32,7 @@ pfb.clean:
pass_missing_as_none: true

_include:
- clean.yaml
- (.)clean.yaml

pfb.restore:
command: pfb.workers.restore.restore
Expand All @@ -41,7 +41,7 @@ pfb.restore:
pass_missing_as_none: true

_include:
- restore.yaml
- (.)restore.yaml

pfb.fwdbwd:
command: pfb.workers.fwdbwd.fwdbwd
Expand All @@ -50,7 +50,7 @@ pfb.fwdbwd:
pass_missing_as_none: true

_include:
- fwdbwd.yaml
- (.)fwdbwd.yaml

pfb.forward:
command: pfb.workers.forward.forward
Expand All @@ -59,7 +59,7 @@ pfb.forward:
pass_missing_as_none: true

_include:
- forward.yaml
- (.)forward.yaml

pfb.spotless:
command: pfb.workers.spotless.spotless
Expand All @@ -68,7 +68,7 @@ pfb.spotless:
pass_missing_as_none: true

_include:
- spotless.yaml
- (.)spotless.yaml

pfb.model2comps:
command: pfb.workers.model2comps.model2comps
Expand All @@ -77,4 +77,4 @@ pfb.model2comps:
pass_missing_as_none: true

_include:
- model2comps.yaml
- (.)model2comps.yaml
4 changes: 2 additions & 2 deletions pfb/workers/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def init(**kw):
'''
Initialise data products for imaging
'''
defaults.update(kw)
opts = OmegaConf.create(defaults)
defaults.update(kw) # is this still necessary?
opts = OmegaConf.create(kw)
import time
timestamp = time.strftime("%Y%m%d-%H%M%S")
ldir = Path(opts.log_directory).resolve()
Expand Down
6 changes: 3 additions & 3 deletions tests/test_clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def test_clean(do_gains, ms_name):
from pfb.parser.schemas import schema
init_args = {}
for key in schema.init["inputs"].keys():
init_args[key] = schema.init["inputs"][key]["default"]
init_args[key.replace("-", "_")] = schema.init["inputs"][key]["default"]
# overwrite defaults
init_args["ms"] = str(test_dir / 'test_ascii_1h60.0s.MS')
init_args["output_filename"] = outname
Expand All @@ -198,7 +198,7 @@ def test_clean(do_gains, ms_name):
# grid data to produce dirty image
grid_args = {}
for key in schema.grid["inputs"].keys():
grid_args[key] = schema.grid["inputs"][key]["default"]
grid_args[key.replace("-", "_")] = schema.grid["inputs"][key]["default"]
# overwrite defaults
grid_args["output_filename"] = outname
grid_args["postfix"] = postfix
Expand All @@ -218,7 +218,7 @@ def test_clean(do_gains, ms_name):
# run clean
clean_args = {}
for key in schema.clean["inputs"].keys():
clean_args[key] = schema.clean["inputs"][key]["default"]
clean_args[key.replace("-", "_")] = schema.clean["inputs"][key]["default"]
clean_args["output_filename"] = outname
clean_args["postfix"] = postfix
clean_args["nband"] = nchan
Expand Down
4 changes: 2 additions & 2 deletions tests/test_polproducts.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def test_polproducts(do_gains, ms_name):
# set defaults from schema
init_args = {}
for key in schema.init["inputs"].keys():
init_args[key] = schema.init["inputs"][key]["default"]
init_args[key.replace("-", "_")] = schema.init["inputs"][key]["default"]
# overwrite defaults
init_args["ms"] = str(test_dir / 'test_ascii_1h60.0s.MS')
init_args["output_filename"] = outname
Expand All @@ -242,7 +242,7 @@ def test_polproducts(do_gains, ms_name):
# grid data to produce dirty image
grid_args = {}
for key in schema.grid["inputs"].keys():
grid_args[key] = schema.grid["inputs"][key]["default"]
grid_args[key.replace("-", "_")] = schema.grid["inputs"][key]["default"]
# overwrite defaults
grid_args["output_filename"] = outname
grid_args["postfix"] = postfix
Expand Down
14 changes: 7 additions & 7 deletions tests/test_spotless.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def test_spotless(ms_name):
# set defaults from schema
init_args = {}
for key in schema.init["inputs"].keys():
init_args[key] = schema.init["inputs"][key]["default"]
init_args[key.replace("-", "_")] = schema.init["inputs"][key]["default"]
# overwrite defaults
outname = str(test_dir / 'test')
init_args["ms"] = str(test_dir / 'test_ascii_1h60.0s.MS')
Expand All @@ -151,7 +151,7 @@ def test_spotless(ms_name):
# grid data to produce dirty image
grid_args = {}
for key in schema.grid["inputs"].keys():
grid_args[key] = schema.grid["inputs"][key]["default"]
grid_args[key.replace("-", "_")] = schema.grid["inputs"][key]["default"]
# overwrite defaults
grid_args["output_filename"] = outname
grid_args["nband"] = nchan
Expand All @@ -175,7 +175,7 @@ def test_spotless(ms_name):
# run clean
spotless_args = {}
for key in schema.spotless["inputs"].keys():
spotless_args[key] = schema.spotless["inputs"][key]["default"]
spotless_args[key.replace("-", "_")] = schema.spotless["inputs"][key]["default"]
spotless_args["output_filename"] = outname
spotless_args["nband"] = nchan
spotless_args["niter"] = 2
Expand Down Expand Up @@ -217,7 +217,7 @@ def test_spotless(ms_name):

model2comps_args = {}
for key in schema.model2comps["inputs"].keys():
model2comps_args[key] = schema.model2comps["inputs"][key]["default"]
model2comps_args[key.replace("-", "_")] = schema.model2comps["inputs"][key]["default"]
model2comps_args["output_filename"] = outname
model2comps_args["nbasisf"] = nchan
model2comps_args["fit_mode"] = 'Legendre'
Expand Down Expand Up @@ -266,7 +266,7 @@ def test_spotless(ms_name):
# degrid from coeffs populating MODEL_DATA
degrid_args = {}
for key in schema.degrid["inputs"].keys():
degrid_args[key] = schema.degrid["inputs"][key]["default"]
degrid_args[key.replace("-", "_")] = schema.degrid["inputs"][key]["default"]
degrid_args["ms"] = str(test_dir / 'test_ascii_1h60.0s.MS')
degrid_args["mds"] = f'{outname}_I_main_model.mds'
degrid_args["channels_per_image"] = 1
Expand All @@ -284,7 +284,7 @@ def test_spotless(ms_name):
# gridding CORRECTED_DATA should return identical residuals
init_args = {}
for key in schema.init["inputs"].keys():
init_args[key] = schema.init["inputs"][key]["default"]
init_args[key.replace("-", "_")] = schema.init["inputs"][key]["default"]
# overwrite defaults
outname = str(test_dir / 'test2')
init_args["ms"] = str(test_dir / 'test_ascii_1h60.0s.MS')
Expand All @@ -301,7 +301,7 @@ def test_spotless(ms_name):
# grid data to produce dirty image
grid_args = {}
for key in schema.grid["inputs"].keys():
grid_args[key] = schema.grid["inputs"][key]["default"]
grid_args[key.replace("-", "_")] = schema.grid["inputs"][key]["default"]
# overwrite defaults
grid_args["output_filename"] = outname
grid_args["nband"] = nchan
Expand Down

0 comments on commit 64dc3f4

Please sign in to comment.