Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9144729
Start to analysis filters
dwhswenson May 15, 2021
61d2570
Add shooting points; misc updates to filters
dwhswenson May 17, 2021
0b8aa53
updates to analysis filters
dwhswenson Jun 9, 2021
9527d4b
Add start to tests
dwhswenson Jun 17, 2021
3ce4a88
cleanup of STAGES; several new filters
dwhswenson Jul 5, 2021
b91cb2e
snake_case
dwhswenson Jul 5, 2021
766d81f
add canonical_movers extractor; cleanup
dwhswenson Jul 6, 2021
d17a04a
Add start to docs on extractors and filters
dwhswenson Jul 6, 2021
8ab5a21
get rid of f-strings
dwhswenson Jul 6, 2021
31df2f2
outline tests we need to do
dwhswenson Aug 9, 2021
0ef0885
Merge branch 'master' of github.com:openpathsampling/openpathsampling…
dwhswenson Aug 14, 2021
68ab949
start on test fixtures
dwhswenson Aug 18, 2021
a9456ea
Merge remote-tracking branch 'upstream/master' into analysis_filters
dwhswenson Sep 9, 2021
9a3cb08
split off testing structure (separate PR)
dwhswenson Sep 9, 2021
d8bd07e
Merge branch 'test-analysis-utils' into tmp_test_analysis_filters
dwhswenson Sep 12, 2021
376b876
tests for step filter
dwhswenson Sep 12, 2021
4108ecd
steps toward testing
dwhswenson Sep 19, 2021
6ecd22b
Merge branch 'master' of github.com:openpathsampling/openpathsampling…
dwhswenson Dec 13, 2021
cefb597
Merge branch 'tmp_test_analysis_filters' into analysis_filters
dwhswenson Dec 13, 2021
0fca990
update test_filters for better analysis test utils
dwhswenson Dec 13, 2021
298f73b
fix Py2, more tests
dwhswenson Dec 13, 2021
ec7cb4b
tests for bad input to canonical_mover
dwhswenson Dec 14, 2021
8aaa92a
test_extractor
dwhswenson Jan 14, 2022
96495a3
Merge remote-tracking branch 'upstream/master' into analysis_filters
dwhswenson Mar 25, 2022
20d12f8
steps toward better docs
dwhswenson May 20, 2022
80bffc4
starting on tests for shooting analysis
dwhswenson Jul 30, 2022
a6c9cf5
Parts of testing for filters
dwhswenson Oct 16, 2022
a31b017
steps toward tests
dwhswenson Dec 26, 2022
a2bd212
Merge remote-tracking branch 'upstream/master' into analysis_filters
dwhswenson Dec 26, 2022
999bea2
Merge remote-tracking branch 'upstream/master' into analysis_filters
dwhswenson Dec 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tests for bad input to canonical_mover
  • Loading branch information
dwhswenson committed Dec 14, 2021
commit ec7cb4b7e40d3f158e2ddb4671e845a4869d7104
3 changes: 2 additions & 1 deletion openpathsampling/analysis/filters.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import openpathsampling as paths
import enum
import inspect

def _default_repr(obj): # pragma: no cover
return obj.name if obj.name is not None \
Expand Down Expand Up @@ -111,7 +112,7 @@ def __init__(self, mover):
elif isinstance(mover, str):
self.mover = getattr(paths, mover)
self._condition = self.isinstance_check
elif issubclass(mover, paths.PathMover):
elif inspect.isclass(mover) and issubclass(mover, paths.PathMover):
self.mover = mover
self._condition = self.isinstance_check
elif isinstance(mover, paths.MCStep):
Expand Down
18 changes: 14 additions & 4 deletions openpathsampling/tests/analysis/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,17 @@ def test_canonical_mover_step_filter(input_type, seven_steps_no_dynamics,
assert [s.mccycle for s in filtered_steps] == expected


def test_canonical_mover_step_filter_input_step(seven_steps_no_dynamics):
step = next(seven_steps_no_dynamics)
with pytest.raises(TypeError, match="mean to use the extractor"):
_ = canonical_mover(step)


def test_canonical_mover_step_filter_bad_input():
with pytest.raises(TypeError, match="does not appear to be"):
_ = canonical_mover(5)


def test_trial_replica_step_filter(seven_steps_no_dynamics):
filt = trial_replica(0)
filtered_steps = list(filt(seven_steps_no_dynamics))
Expand Down Expand Up @@ -200,12 +211,11 @@ def test_sampling_ensemble_sample_filter():

##### extractors ###########################################################

def map_replicas_and_ensembles(sample_set):
def _map_replicas_and_ensembles(sample_set):
return {s.replica: s.ensemble for s in sample_set}


def test_active_samples_extractor(scheme, seven_steps_no_dynamics):
# check that the active samples are correct for the first 4 steps
ens0, ens1, ens2 = scheme.network.sampling_ensembles
all_expected = [
{0: ens0, 1: ens1, 2: ens2},
Expand All @@ -217,7 +227,7 @@ def test_active_samples_extractor(scheme, seven_steps_no_dynamics):
{0: ens0, 1: ens1, 2: ens2},
]
for step, expected in zip(seven_steps_no_dynamics, all_expected):
found = map_replicas_and_ensembles(step.active)
found = _map_replicas_and_ensembles(step.active)
assert found == expected


Expand All @@ -233,7 +243,7 @@ def test_trial_samples_extractor(scheme, seven_steps_no_dynamics):
{1: ens2, 2: ens1},
]
for step, expected in zip(seven_steps_no_dynamics, all_expected):
found = map_replicas_and_ensembles(step.change.trials)
found = _map_replicas_and_ensembles(step.change.trials)
assert found == expected


Expand Down