-
Notifications
You must be signed in to change notification settings - Fork 3
fix for all timepoints #102
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
Conversation
src/lineagetree/measure/spatial.py
Outdated
|
|
||
| def get_gabriel_graph(lT: LineageTree, t: int) -> dict[int, set[int]]: | ||
| def get_gabriel_graph( | ||
| lT: LineageTree, t: int | None = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was expecting to have something like:
t: int | Iterable[int] | None = Nonewith something like that:
if t is None:
t = lT.times
elif not isinstance(t, Iterable):
t = [t]
for time in t:
... #compute gabriel graph
src/lineagetree/measure/spatial.py
Outdated
| if t and len(lT.time_nodes[t]) < 5: | ||
| warn("Need more than 5 timepoints") | ||
| return lT.Gabriel_graph |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here there is a small problem, you need at least nb dim + 2 points to compute the Delaunay triangulation so if the lineage tree is in 2D then only 4 points are necessary.
Second the reason why you need nb dim + 2 is that if you have nb dim + 1 or less the triangulation is trivial: each node is connected to each node. In that case wew should still return something
src/lineagetree/measure/spatial.py
Outdated
| if t is None: | ||
| with catch_warnings(): | ||
| simplefilter("ignore") | ||
| for time in lT.time_nodes: | ||
| get_gabriel_graph(lT, time) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an ugly way of doing that. I don't think you should silence warnings in general.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v3.x #102 +/- ##
==========================================
+ Coverage 86.49% 86.56% +0.07%
==========================================
Files 20 20
Lines 1821 1831 +10
==========================================
+ Hits 1575 1585 +10
Misses 246 246 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Added a wanring if the graph cannot be calculated.