Skip to content

Commit 1027f8b

Browse files
committed
more documentation for compiling objects
1 parent 472574d commit 1027f8b

File tree

5 files changed

+79
-22
lines changed

5 files changed

+79
-22
lines changed

paths_cli/compiling/_gendocs/json_type_handlers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ def __init__(self, type_name, link_to=None):
146146
CategoryHandler("network"),
147147
CategoryHandler("strategy"),
148148
CategoryHandler("scheme"),
149+
CategoryHandler("shooting-point-selector"),
150+
CategoryHandler("interface-set"),
149151
EvalHandler("EvalInt"),
150152
EvalHandler("EvalIntStrictPos"),
151153
EvalHandler("EvalFloat"),

paths_cli/compiling/networks.py

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,44 @@
22
InstanceCompilerPlugin, Builder, Parameter
33
)
44
from paths_cli.compiling.tools import custom_eval
5-
from paths_cli.compiling.plugins import NetworkCompilerPlugin, CategoryPlugin
5+
from paths_cli.compiling.plugins import (
6+
NetworkCompilerPlugin, CategoryPlugin, InterfaceSetPlugin
7+
)
68
from paths_cli.compiling.root_compiler import compiler_for
79
from paths_cli.compiling.json_type import (
810
json_type_ref, json_type_list, json_type_eval
911
)
1012

11-
build_interface_set = InstanceCompilerPlugin(
13+
14+
INITIAL_STATES_PARAM = Parameter(
15+
'initial_states', compiler_for('volume'),
16+
json_type=json_type_list(json_type_ref('volume')),
17+
description="initial states for this transition",
18+
)
19+
20+
21+
INITIAL_STATE_PARAM = Parameter(
22+
'initial_state', compiler_for('volume'),
23+
json_type=json_type_list(json_type_ref('volume')),
24+
description="initial state for this transition",
25+
)
26+
27+
28+
FINAL_STATES_PARAM = Parameter(
29+
'final_states', compiler_for('volume'),
30+
json_type=json_type_list(json_type_ref('volume')),
31+
description="final states for this transition",
32+
)
33+
34+
35+
FINAL_STATE_PARAM = Parameter(
36+
'final_state', compiler_for('volume'),
37+
json_type=json_type_list(json_type_ref('volume')),
38+
description="final state for this transition",
39+
)
40+
41+
42+
build_interface_set = InterfaceSetPlugin(
1243
builder=Builder('openpathsampling.VolumeInterfaceSet'),
1344
parameters=[
1445
Parameter('cv', compiler_for('cv'), json_type=json_type_ref('cv'),
@@ -23,7 +54,8 @@
2354
description=("maximum value(s) for interfaces in this"
2455
"interface set")),
2556
],
26-
name='interface-set'
57+
name='interface-set',
58+
description="Interface set used in transition interface sampling.",
2759
)
2860

2961

@@ -57,15 +89,10 @@ def tis_trans_info(dct):
5789

5890
TPS_NETWORK_PLUGIN = NetworkCompilerPlugin(
5991
builder=Builder('openpathsampling.TPSNetwork'),
60-
parameters=[
61-
Parameter('initial_states', compiler_for('volume'),
62-
json_type=json_type_list(json_type_ref('volume')),
63-
description="initial states for this transition"),
64-
Parameter('final_states', compiler_for('volume'),
65-
json_type=json_type_list(json_type_ref('volume')),
66-
description="final states for this transition")
67-
],
68-
name='tps'
92+
parameters=[INITIAL_STATES_PARAM, FINAL_STATES_PARAM],
93+
name='tps',
94+
description=("Network for transition path sampling (two state TPS or "
95+
"multiple state TPS)."),
6996
)
7097

7198

paths_cli/compiling/schemes.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
ENGINE_PARAMETER
4646
],
4747
name='spring-shooting',
48+
description=("Move scheme for TPS with the spring-shooting algorithm. "
49+
"Under most circumstances, the network provided here "
50+
"should be a 2-state TPS network."),
4851
)
4952

5053

@@ -78,6 +81,8 @@ def __call__(self, **dct):
7881
STRATEGIES_PARAMETER,
7982
],
8083
name='one-way-shooting',
84+
description=("One-way-shooting move scheme. This can be extended with "
85+
"additional user-defined move strategies."),
8186
)
8287

8388
MOVESCHEME_PLUGIN = SchemeCompilerPlugin(
@@ -87,7 +92,11 @@ def __call__(self, **dct):
8792
NETWORK_PARAMETER,
8893
STRATEGIES_PARAMETER,
8994
],
90-
name='scheme'
95+
name='scheme',
96+
description=("Generic move scheme. Add strategies to this to make it "
97+
"useful. This defaults to a scheme that first chooses a "
98+
"move type, and then chooses the specific move within "
99+
"that type (i.e., ``OrganizeByMoveGroupStrategy``)"),
91100
)
92101

93102
SCHEME_COMPILER = CategoryPlugin(SchemeCompilerPlugin, aliases=['schemes'])

paths_cli/compiling/shooting.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,24 @@
22
InstanceCompilerPlugin, CategoryCompiler, Builder, Parameter
33
)
44
from paths_cli.compiling.root_compiler import compiler_for
5-
from paths_cli.compiling.tools import custom_eval
5+
from paths_cli.compiling.tools import custom_eval_float
66
from paths_cli.compiling.plugins import ShootingPointSelectorPlugin
7+
from paths_cli.compiling.json_type import json_type_ref, json_type_eval
8+
9+
shooting_selector_compiler = compiler_for('shooting-point-selector')
10+
SP_SELECTOR_PARAMETER = Parameter(
11+
'selector', compiler_for('shooting-point-selector'), default=None,
12+
json_type=json_type_ref('shooting-point-selector'),
13+
description="shooting point selection algorithm to use.",
14+
)
715

816

917
build_uniform_selector = ShootingPointSelectorPlugin(
1018
builder=Builder('openpathsampling.UniformSelector'),
1119
parameters=[],
1220
name='uniform',
21+
description=("Uniform shooting point selection probability: all frames "
22+
"have equal probability (endpoints excluded)."),
1323
)
1424

1525

@@ -24,11 +34,24 @@ def _remapping_gaussian_stddev(dct):
2434
builder=Builder('openpathsampling.GaussianBiasSelector',
2535
remapper=_remapping_gaussian_stddev),
2636
parameters=[
27-
Parameter('cv', compiler_for('cv')),
28-
Parameter('mean', custom_eval),
29-
Parameter('stddev', custom_eval),
37+
Parameter('cv', compiler_for('cv'), json_type=json_type_ref('cv'),
38+
description="bias as a Gaussian in this CV"),
39+
Parameter('mean', custom_eval_float,
40+
json_type=json_type_eval("Float"),
41+
description="mean of the Gaussian"),
42+
Parameter('stddev', custom_eval_float,
43+
json_type=json_type_eval("Float"),
44+
description="standard deviation of the Gaussian"),
3045
],
3146
name='gaussian',
47+
description=(
48+
"Bias shooting point selection based on a Gaussian. That is, for a "
49+
"configuration :math:`x`, the probability of selecting that "
50+
"configruation is proportional to "
51+
r":math:`\exp(-(\lambda(x)-\bar{\lambda})^2 / (2\sigma^2))`, "
52+
r"where :math:`\lambda` is the given CV, :math:`\bar{\lambda}` is "
53+
r"the mean, and :math:`\sigma` is the standard deviation."
54+
),
3255
)
3356

3457

paths_cli/compiling/strategies.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
from paths_cli.compiling.core import Builder, Parameter
2-
# from paths_cli.compiling.shooting import shooting_selector_compiler
32
from paths_cli.compiling.plugins import (
43
StrategyCompilerPlugin, CategoryPlugin
54
)
65
from paths_cli.compiling.root_compiler import compiler_for
76
from paths_cli.compiling.json_type import json_type_ref
8-
9-
shooting_selector_compiler = compiler_for('shooting-point-selector')
7+
from paths_cli.compiling.shooting import SP_SELECTOR_PARAMETER
108

119

1210
def _strategy_name(class_name):
@@ -19,8 +17,6 @@ def _group_parameter(group_name):
1917

2018

2119
# TODO: maybe this moves into shooting once we have the metadata?
22-
SP_SELECTOR_PARAMETER = Parameter('selector', shooting_selector_compiler,
23-
default=None)
2420

2521
ENGINE_PARAMETER = Parameter(
2622
'engine', compiler_for('engine'), json_type=json_type_ref('engine'),

0 commit comments

Comments
 (0)