Skip to content

[Bug]: The script extract_renewal_events.py fails if no renewal events occur #213

@andthum

Description

@andthum

MDTools version

0.0.7.0

Python version

3.8.6

Operating system

CentOS Linux 7 (Core)

Expected behavior

If no renewal event occurs, the script should still work and generate an output file.

The script might raise a warning but not an exception.

Actual behavior

If no renewal event occurs, the script raises an exception by construction:

Traceback (most recent call last):
  File "mdtools/scripts/dynamics/extract_renewal_events.py", line 921, in <module>
    raise ValueError("Could not detect any renewal event")
ValueError: Could not detect any renewal event

Steps to reproduce

Run the script on a trajectory without renewal events (or choose the atom groups or the cutoff such that no renewal events occur).

Supposed bug location

Turn the exception in line 921 into a warning:

raise ValueError("Could not detect any renewal event")

This requires changes in the following code, because if no renewal events occur, the array data cannot be indexed as done in the script.

Possible solution

A possible solution might be to initiate data as an array of NaN's of the appropriate shape if no renewal events occur.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions