Skip to content

Conversation

@ns-rse
Copy link
Contributor

@ns-rse ns-rse commented Sep 4, 2023

Closes #206

The error arises during usage of csr.Skeleton.prune_paths() which takes a list of indices, typical from csr.summarize(), which are to be pruned. If the index is outside of the range of rows in the data frame a ValueError is thrown.

It was first highlighted during early development of pruning iteratively but can arise any time in inappropriate value that is greater than the number of paths in a skeleton is passed to prune_path() method.

A try: ... except: ... is introduced to capture this and report, hopefully informatively, what the problem is and how to correct it. Tests are introduced for this method, parametrized to test removing different types of paths along with tests of two exceptions that can arise.

Closes jni#206

The error arises during usage of the `csr.Skeleton.prune_paths()` which takes a list of indices from
`csr.summarize()` which are to be pruned. If the index is outside of the range of rows in the data frame
a `ValueError` is thrown.

It was first highlighted during early development of pruning iteratively but can arise any time in inappropriate value
that is greater than the number of paths in a skeleton is passed to `prune_path()` method.

A `try: ... except: ...` is introduced to capture this and report, hopefully informatively, what the problem is and how
to correct it. Tests are introduced for this method, parametrized to test removing different types of paths along with
tests of two exceptions that can arise.
@jni
Copy link
Owner

jni commented Oct 3, 2023

@ns-rse Thinking about this: I think we can catch early and fail: if np.any(np.array(indices_to_remove) > len(self.paths))? Something like that?

@ns-rse
Copy link
Contributor Author

ns-rse commented Oct 9, 2023

The @slackline account is my personal rather than work account sorry for the mistake.

[0, 3, 2, 0, 1, 1, 0], [3, 0, 0, 4, 0, 0, 0],
[3, 0, 0, 0, 4, 4, 4]])
),
]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eek, looks like I need to fiddle with my yapf config a bit more, I very much dislike this way of closing/matching parens... 😅 (Ignore this comment for this PR, just thinking out loud.)

@jni
Copy link
Owner

jni commented Oct 16, 2023

I've pushed a few changes, we can probably merge this live in a bit. 😊

@jni jni merged commit 91d4e7c into jni:main Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ValueError: not enough values to unpack (expected 2, got 0)

3 participants