Skip to content

Commit 30bb0d9

Browse files
authored
Merge pull request #37 from openpathsampling/release-0.2.0
Release 0.2.0
2 parents 5ff2ae7 + 3fb2f49 commit 30bb0d9

21 files changed

+731
-40
lines changed

.autorelease/test-testpypi.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
python -m pip install sqlalchemy dill pytest
2+
py.test --pyargs paths_cli

.github/workflows/autorelease-default-env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
INSTALL_AUTORELEASE="python -m pip install autorelease==0.2.3"
1+
INSTALL_AUTORELEASE="python -m pip install autorelease==0.2.6"
22
if [ -f autorelease-env.sh ]; then
33
source autorelease-env.sh
44
fi

.github/workflows/autorelease-deploy.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ jobs:
1414
python-version: "3.x"
1515
- run: | # TODO: move this to an action
1616
source ./.github/workflows/autorelease-default-env.sh
17-
cat autorelease-env.sh >> $GITHUB_ENV
17+
if [ -f "autorelease-env.sh" ]; then
18+
cat autorelease-env.sh >> $GITHUB_ENV
19+
fi
1820
eval $INSTALL_AUTORELEASE
1921
name: "Install autorelease"
2022
- run: |
@@ -27,5 +29,5 @@ jobs:
2729
- uses: pypa/gh-action-pypi-publish@master
2830
with:
2931
password: ${{ secrets.pypi_password }}
30-
name: "Deploy to testpypi"
32+
name: "Deploy to pypi"
3133

.github/workflows/autorelease-gh-rel.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ jobs:
1515
python-version: "3.7"
1616
- run: | # TODO: move this to an action
1717
source ./.github/workflows/autorelease-default-env.sh
18-
cat autorelease-env.sh >> $GITHUB_ENV
18+
if [ -f "autorelease-env.sh" ]; then
19+
cat autorelease-env.sh >> $GITHUB_ENV
20+
fi
1921
eval $INSTALL_AUTORELEASE
2022
name: "Install autorelease"
2123
- run: |

.github/workflows/autorelease-prep.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ jobs:
1919
python-version: "3.x"
2020
- run: | # TODO: move this to an action
2121
source ./.github/workflows/autorelease-default-env.sh
22-
cat autorelease-env.sh >> $GITHUB_ENV
22+
if [ -f "autorelease-env.sh" ]; then
23+
cat autorelease-env.sh >> $GITHUB_ENV
24+
fi
2325
eval $INSTALL_AUTORELEASE
2426
name: "Install autorelease"
2527
- run: |
@@ -49,7 +51,9 @@ jobs:
4951
python-version: "3.x"
5052
- run: | # TODO: move this to an action
5153
source ./.github/workflows/autorelease-default-env.sh
52-
cat autorelease-env.sh >> $GITHUB_ENV
54+
if [ -f "autorelease-env.sh" ]; then
55+
cat autorelease-env.sh >> $GITHUB_ENV
56+
fi
5357
eval $INSTALL_AUTORELEASE
5458
name: "Install autorelease"
5559
- run: test-testpypi

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ miscellaneous operations on OPS output files.
2222
**Simulation Commands:**
2323

2424
* `visit-all`: Run MD to generate initial trajectories
25+
* `md`: Run MD for fixed time or until a given ensemble is satisfied
2526
* `equilibrate`: Run equilibration for path sampling
2627
* `pathsampling`: Run any path sampling simulation, including TIS variants
2728

autorelease-env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
INSTALL_AUTORELEASE="python -m pip install autorelease==0.2.3 nose"
1+
INSTALL_AUTORELEASE="python -m pip install autorelease==0.2.3 nose sqlalchemy dill"
22
PACKAGE_IMPORT_NAME=paths_cli

devtools/tests_require.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ nose
33
pytest
44
pytest-cov
55
coveralls
6+
# following are for SimStore integration
7+
dill
8+
sqlalchemy

paths_cli/commands/contents.py

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,64 @@
11
import click
22
from paths_cli.parameters import INPUT_FILE
33

4+
UNNAMED_SECTIONS = ['steps', 'movechanges', 'samplesets', 'trajectories',
5+
'snapshots']
6+
7+
NAME_TO_ATTR = {
8+
'CVs': 'cvs',
9+
'Volumes': 'volumes',
10+
'Engines': 'engines',
11+
'Networks': 'networks',
12+
'Move Schemes': 'schemes',
13+
'Simulations': 'pathsimulators',
14+
'Tags': 'tags',
15+
'Steps': 'steps',
16+
'Move Changes': 'movechanges',
17+
'SampleSets': 'samplesets',
18+
'Trajectories': 'trajectories',
19+
'Snapshots': 'snapshots'
20+
}
21+
422
@click.command(
523
'contents',
624
short_help="list named objects from an OPS .nc file",
725
)
826
@INPUT_FILE.clicked(required=True)
9-
def contents(input_file):
27+
@click.option('--table', type=str, required=False,
28+
help="table to show results from")
29+
def contents(input_file, table):
1030
"""List the names of named objects in an OPS .nc file.
1131
1232
This is particularly useful when getting ready to use one of simulation
1333
scripts (i.e., to identify exactly how a state or engine is named.)
1434
"""
1535
storage = INPUT_FILE.get(input_file)
1636
print(storage)
37+
if table is None:
38+
report_all_tables(storage)
39+
else:
40+
table_attr = table.lower()
41+
try:
42+
store = getattr(storage, table_attr)
43+
except AttributeError:
44+
raise click.UsageError("Unknown table: '" + table_attr + "'")
45+
else:
46+
print(get_section_string(table_attr, store))
47+
48+
49+
def get_section_string(label, store):
50+
attr = NAME_TO_ATTR.get(label, label.lower())
51+
if attr in UNNAMED_SECTIONS:
52+
string = get_unnamed_section_string(label, store)
53+
elif attr in ['tag', 'tags']:
54+
string = get_section_string_nameable(label, store, _get_named_tags)
55+
else:
56+
string = get_section_string_nameable(label, store,
57+
_get_named_namedobj)
58+
return string
59+
60+
61+
def report_all_tables(storage):
1762
store_section_mapping = {
1863
'CVs': storage.cvs, 'Volumes': storage.volumes,
1964
'Engines': storage.engines, 'Networks': storage.networks,
@@ -26,12 +71,16 @@ def contents(input_file):
2671
print(get_section_string_nameable('Tags', storage.tags, _get_named_tags))
2772

2873
print("\nData Objects:")
29-
unnamed_sections = {
30-
'Steps': storage.steps, 'Move Changes': storage.movechanges,
31-
'SampleSets': storage.samplesets,
32-
'Trajectories': storage.trajectories, 'Snapshots': storage.snapshots
74+
data_object_mapping = {
75+
'Steps': lambda storage: storage.steps,
76+
'Move Changes': lambda storage: storage.movechanges,
77+
'SampleSets': lambda storage: storage.samplesets,
78+
'Trajectories': lambda storage: storage.trajectories,
79+
'Snapshots': lambda storage: storage.snapshots
3380
}
34-
for section, store in unnamed_sections.items():
81+
82+
for section, store_func in data_object_mapping.items():
83+
store = store_func(storage)
3584
print(get_unnamed_section_string(section, store))
3685

3786
def _item_or_items(count):

paths_cli/commands/equilibrate.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def equilibrate_main(output_storage, scheme, init_conds, multiplier,
4343
extra_steps):
4444
import openpathsampling as paths
4545
init_conds = scheme.initial_conditions_from_trajectories(init_conds)
46+
scheme.assert_initial_conditions(init_conds)
4647
simulation = paths.PathSampling(
4748
storage=output_storage,
4849
move_scheme=scheme,

0 commit comments

Comments
 (0)