Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
7af7eae
Add start to wizard
dwhswenson Feb 18, 2021
7fec891
TPS wizard works through state defs
dwhswenson Feb 19, 2021
250f4e2
a little more work on the wizard
dwhswenson Feb 27, 2021
666f9a9
major steps toward TPS wizard
dwhswenson Mar 4, 2021
8910ba2
A little more cleanup on wizard stuff
dwhswenson Mar 4, 2021
0b60338
Start to add tests for wizard
dwhswenson Mar 4, 2021
68066b1
tests for most of the Wizard object
dwhswenson Mar 6, 2021
4da1b9a
move MockConsole, start to get_object decorator
dwhswenson Mar 6, 2021
c17f3d1
more work toward using get_object
dwhswenson Mar 6, 2021
77fa5ce
tests for OpenMM wizard
dwhswenson Mar 6, 2021
76ea517
Prep tests for CVs
dwhswenson Mar 7, 2021
5d2e3f8
Some CV cleanup; more periodicity to CVs
dwhswenson Mar 7, 2021
b5ec9ce
Wizard ready for 2-state TPS demo
dwhswenson Mar 7, 2021
b32d03a
Add tests for CV wizards
dwhswenson Mar 7, 2021
a52bac0
tests for volume wizards
dwhswenson Mar 8, 2021
a9c4d96
simplify code to reflect current usage
dwhswenson Mar 8, 2021
a85118f
more cleanup of unused
dwhswenson Mar 8, 2021
42aa3c9
More tests; work toward handling Spring Shooting
dwhswenson Mar 18, 2021
13f7108
fix up tests
dwhswenson Mar 18, 2021
9d6c3dd
Add tests for shooting, load_from_ops
dwhswenson Mar 18, 2021
6467b59
Remove name from core (used as wizard.name)
dwhswenson Mar 19, 2021
d2050e4
Add tests for TPS wizard
dwhswenson Mar 20, 2021
94cd34e
Tests for two_state_tps.py
dwhswenson Mar 20, 2021
3f183de
tests for engines and errors
dwhswenson Mar 20, 2021
35c9ca1
Update for parsing.tools.custom_eval
dwhswenson Mar 26, 2021
97189a6
split off _do_one in wizard
dwhswenson Mar 26, 2021
f932fce
Add remaining tests for wizard
dwhswenson Jun 18, 2021
a3c7b4b
from unittest import mock...
dwhswenson Jun 18, 2021
a7fefd2
missed one
dwhswenson Jun 18, 2021
9259aca
fix for tests locally
dwhswenson Jun 18, 2021
10b676d
try ignoring wizard (does that fix test errors?)
dwhswenson Jun 18, 2021
8b7c8b8
re-include wizard tests
dwhswenson Jun 18, 2021
6c37dce
don't actually monkeypatch when testing Wizard
dwhswenson Jun 18, 2021
d444895
fix deprecation warnings for OPS 1.5
dwhswenson Jul 6, 2021
47106e6
Add Wizard (skeleton form) to docs
dwhswenson Jul 7, 2021
e9dd815
Add test job with openmm etc integrations
dwhswenson Jul 7, 2021
ea29ac4
fix whitespace in yaml
dwhswenson Jul 7, 2021
b52c1ef
fix include in yaml
dwhswenson Jul 7, 2021
3b64ce7
fix typo in workflow
dwhswenson Jul 7, 2021
8dcd07d
fix workflow
dwhswenson Jul 7, 2021
e774caa
increase fetch-depth to help codecov
dwhswenson Jul 7, 2021
d07699e
... helps is fetch-depth is in the right heading
dwhswenson Jul 7, 2021
2ba6390
finish test coverage
dwhswenson Jul 24, 2021
59b6fbe
Add test for bad MDTraj atom index input
dwhswenson Jul 24, 2021
4f3e53a
Add tests/wizard/__init__.py
dwhswenson Jul 24, 2021
0b33b79
no-cov on joke
dwhswenson Jul 24, 2021
60eb119
Apply suggestions from code review
dwhswenson Jul 26, 2021
3d92cd2
misc review cleanup
dwhswenson Jul 26, 2021
07b7d7c
Merge branch 'main' of github.com:openpathsampling/openpathsampling-c…
dwhswenson Jul 27, 2021
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
A little more cleanup on wizard stuff
  • Loading branch information
dwhswenson committed Mar 4, 2021
commit 8910ba22e68e35a4ab6f0dbeb6a4810d0543b9d8
4 changes: 2 additions & 2 deletions paths_cli/wizard/cvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ def coordinate(wizard):
'Distance': distance,
'Angle': angle,
'Dihedral': dihedral,
'RMSD': rmsd,
# 'RMSD': rmsd,
})

SUPPORTED_CVS.update({
'Coordinate': coordinate,
'Python script': ...,
# 'Python script': ...,
_load_label: partial(load_from_ops,
store_name='cvs',
obj_name='CV'),
Expand Down
46 changes: 41 additions & 5 deletions paths_cli/wizard/wizard.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import random
import os
from functools import partial
import textwrap

Expand All @@ -10,6 +11,7 @@
)
from paths_cli.wizard.tools import yes_no, a_an
from paths_cli.parsing.core import custom_eval
from paths_cli.wizard.errors import FILE_LOADING_ERROR_MSG
from paths_cli.wizard.joke import name_joke

import shutil
Expand Down Expand Up @@ -41,6 +43,15 @@ def __init__(self, steps):

self.console = Console()
self.default = {}
self._patched = False # if we've done the monkey-patching

def _patch(self):
import openpathsampling as paths
from openpathsampling.experimental.storage import monkey_patch_all
if not self._patched:
paths = monkey_patch_all(paths)
paths.InterfaceSet.simstore = True
self._patched = True

def debug(content):
self.console.print(content)
Expand Down Expand Up @@ -86,7 +97,7 @@ def ask_enumerate(self, question, options):
self.say(opt_string, preface=" "*3)
result = None
while result is None:
choice = self.ask("Please select a number.",
choice = self.ask("Please select a number:",
options=[str(i+1)
for i in range(len(options))])
try:
Expand Down Expand Up @@ -127,7 +138,8 @@ def obj_selector(self, store_name, text_name, create_func):
return obj

def exception(self, msg, exception):
self.bad_input(msg + "\nHere's the error I got:\n" + str(exception))
self.bad_input(f"{msg}\nHere's the error I got:\n"
f"{exception.__class__.__name__}: {exception}")

def _req_do_another(self, req):
store, min_, max_ = req
Expand Down Expand Up @@ -164,6 +176,7 @@ def register(self, obj, obj_type, store_name):
return obj

def save_to_file(self):
from openpathsampling.experimental.storage import Storage
filename = None
while filename is None:
filename = self.ask("Where would you like to save your setup "
Expand All @@ -175,9 +188,9 @@ def save_to_file(self):
continue

if os.path.exists(filename):
overwrite = self.ask("{filename} exists. Overwrite it?",
overwrite = self.ask(f"{filename} exists. Overwrite it?",
options=["[Y]es", "[N]o"])
overwrite = yes_no[overwrite]
overwrite = yes_no(overwrite)
if not overwrite:
filename = None
continue
Expand All @@ -189,8 +202,27 @@ def save_to_file(self):
else:
self._do_storage(storage)

def _storage_description_line(self, store_name):
store = getattr(self, store_name)
if len(store) == 1:
store_name = store_name[:-1] # chop the 's'

line = f"* {len(store)} {store_name}: " + str(list(store.keys()))
return line

def _do_storage(self, storage):
pass
store_names = ['engines', 'cvs', 'states', 'networks', 'schemes']
lines = [self._storage_description_line(store_name)
for store_name in store_names]
statement = ("I'm going to store the following items:\n\n"
+ "\n".join(lines))
self.say(statement)
for store_name in store_names:
store = getattr(self, store_name)
for obj in store.values():
storage.save(obj)

self.say("Success! Everthing has been stored in your file.")

def _ask_do_another(self, obj_type):
do_another = None
Expand All @@ -206,6 +238,7 @@ def _ask_do_another(self, obj_type):
return do_another

def run_wizard(self):
self._patch() # try to hide the slowness of our first import
for step in self.steps:
req = step.store_name, step.minimum, step.maximum
do_another = True
Expand All @@ -220,6 +253,8 @@ def run_wizard(self):
else:
do_another = False

self.save_to_file()

from collections import namedtuple
WizardStep = namedtuple('WizardStep', ['func', 'display_name', 'store_name',
'minimum', 'maximum'])
Expand All @@ -229,6 +264,7 @@ def run_wizard(self):
store_name="engines",
minimum=1,
maximum=1)

CVS_STEP = WizardStep(func=cvs,
display_name="CV",
store_name='cvs',
Expand Down