Skip to content

Commit

Permalink
Merge pull request #302 from ornlneutronimaging/next
Browse files Browse the repository at this point in the history
Synchronize for release1.2.0dev01
  • Loading branch information
KedoKudo authored Jun 17, 2024
2 parents bdd1581 + 9ef5123 commit 4f0f985
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:
- id: end-of-file-fixer
- id: sort-simple-yaml
- repo: https://github.com/psf/black
rev: 24.2.0
rev: 24.3.0
hooks:
- id: black
args: ['--line-length=119']
Expand Down
3 changes: 3 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ build:
os: ubuntu-20.04
tools:
python: "mambaforge-4.10"
jobs:
pre_build:
- mkdir ~/tmp

sphinx:
builder: html
Expand Down
4 changes: 2 additions & 2 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ requirements:
- dxchange
- olefile
- pooch
- panel<1.3
- param<2
- panel
- param
- pyvista
- holoviews
- bokeh
Expand Down
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ dependencies:
- datashader
- hvplot
# GUI
- panel<1.3
- param<2
- panel
- param
- pyvista
# IO
- dxchange
Expand Down
16 changes: 11 additions & 5 deletions src/imars3d/backend/dataio/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,20 @@ class Foldernames(param.Foldername):
* any of the paths searched by resolve_dir_path() (if search_paths is None).
"""

def _validate(self, val):

if isinstance(val, (list, tuple)):
for v in val:
super()._validate(v)
else:
super()._validate(val)

def _resolve(self, paths):
if isinstance(paths, (str, Path)):
return super()._resolve(paths)
elif isinstance(paths, (list, tuple)):

if isinstance(paths, (list, tuple)):
return [self._resolve(path) for path in paths]
else:
name = next(x for x in [self.name, self.label, "Foldernames parameter"] if x)
raise ValueError(f"{name} must be a string or a list of strings")
return super()._resolve(paths)


class load_data(param.ParameterizedFunction):
Expand Down
2 changes: 1 addition & 1 deletion src/imars3d/backend/workflow/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def _instrospect_task_function(self, function_str: str) -> namedtuple:
# depending on the value of other parameters. Methods `dryrun()` assume that
# parameters are independent of each other
independent = False if function_name in ["load_data"] else True
outputs = dict(function=f, paramdict=f.params(), params_independent=independent)
outputs = dict(function=f, paramdict=f.param.params(), params_independent=independent)
return namedtuple("TaskFuncionInstrospection", outputs.keys())(**outputs)

def _resolve_inputs(self, task_inputs: dict, paramdict: dict) -> dict:
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/backend/dataio/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ class TestFoldernames(param.Parameterized):
# test wrong input
with pytest.raises(ValueError) as e:
TestFoldernames(f=open(tmpdir / "temp.txt", "w"))
assert str(e.value) == "f must be a string or a list of strings"

assert str(e.value) == "Foldernames parameter 'TestFoldernames.f' only take str or pathlib.Path types"
# test single directory
tf = TestFoldernames(f=str(tmpdir))
assert tf.f == str(tmpdir)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/backend/diagnostics/test_tilt.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def test_apply_tilt_correction():
def test_tilt_correction():
# error_0: incorrect dimension
with pytest.raises(ValueError):
tilt_correction(arrays=np.arange(10), tilt=1.0)
tilt_correction(arrays=np.arange(10))
# make synthetic data
size = 100
rot_axis_ideal = get_tilted_rot_axis(0, 0)
Expand Down

0 comments on commit 4f0f985

Please sign in to comment.