Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #98 #99

Merged
merged 4 commits into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Changelog
=========

* Allow None as start/stop values (need for 1 frame trajectories)

v0.1.20 (2022-04-13)
------------------------------------------
Expand Down
7 changes: 4 additions & 3 deletions src/mdacli/libcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,15 @@ def add_run_group(analysis_class_parser):
"-b",
dest="start",
type=str,
default="0",
default=None,
help="start frame or time for evaluation (default: %(default)s)"
)

run_group.add_argument(
"-e",
dest="stop",
type=str,
default="-1",
default=None,
help="end frame or time for evaluation (default: %(default)s)"
)

Expand Down Expand Up @@ -602,7 +602,8 @@ def run_analsis(analysis_callable,

# Run the analysis
for key, value in run_parameters.items():
run_parameters[key] = convert_str_time(value, universe.trajectory.dt)
run_parameters[key] = \
convert_str_time(value, universe.trajectory.dt) if value else value

ac.run(verbose=verbose, **run_parameters)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_libcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def test_split_argparse_into_groups():

@pytest.mark.parametrize(
'dest, default',
[("start", "0"), ("stop", "-1"), ("step", "1"), ("verbose", False)])
[("start", None), ("stop", None), ("step", "1"), ("verbose", False)])
def test_add_run_group_args(dest, default):
"""Test for added run arguments."""
parser = argparse.ArgumentParser()
Expand Down