Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
alibylite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Swain Lab
aliby
alibylite
Commits
d43d5710
Commit
d43d5710
authored
1 year ago
by
pswain
Browse files
Options
Downloads
Patches
Plain Diff
renamed dunder routines in indexing
parent
75686e0c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/agora/utils/indexing.py
+12
-12
12 additions, 12 deletions
src/agora/utils/indexing.py
src/postprocessor/core/postprocessing.py
+5
-5
5 additions, 5 deletions
src/postprocessor/core/postprocessing.py
with
17 additions
and
17 deletions
src/agora/utils/indexing.py
+
12
−
12
View file @
d43d5710
...
...
@@ -73,7 +73,7 @@ def validate_lineage(
"""
if
lineage
.
ndim
==
2
:
# [trap, mother, daughter] becomes [[trap, mother], [trap, daughter]]
lineage
=
_
assoc_indices_to_3d
(
lineage
)
lineage
=
assoc_indices_to_3d
(
lineage
)
if
how
==
"
mothers
"
:
c_index
=
0
elif
how
==
"
daughters
"
:
...
...
@@ -123,7 +123,7 @@ def index_isin(x: np.ndarray, y: np.ndarray) -> np.ndarray:
return
x_bool
def
_
assoc_indices_to_3d
(
ndarray
:
np
.
ndarray
):
def
assoc_indices_to_3d
(
ndarray
:
np
.
ndarray
):
"""
Convert the last column to a new row and repeat first column
'
s values.
...
...
@@ -153,6 +153,16 @@ def _assoc_indices_to_3d(ndarray: np.ndarray):
return
result
def
assoc_indices_to_2d
(
array
:
np
.
ndarray
):
"""
Convert indices to 2d.
"""
result
=
array
if
len
(
array
):
result
=
np
.
concatenate
(
(
array
[:,
0
,
:],
array
[:,
1
,
1
,
np
.
newaxis
]),
axis
=
1
)
return
result
###################################################################
...
...
@@ -250,16 +260,6 @@ def validate_association(
return
valid_association
,
valid_indices
def
_3d_index_to_2d
(
array
:
np
.
ndarray
):
"""
Revert _assoc_indices_to_3d.
"""
result
=
array
if
len
(
array
):
result
=
np
.
concatenate
(
(
array
[:,
0
,
:],
array
[:,
1
,
1
,
np
.
newaxis
]),
axis
=
1
)
return
result
def
compare_indices
(
x
:
np
.
ndarray
,
y
:
np
.
ndarray
)
->
np
.
ndarray
:
"""
Fetch two 2-D indices and return a binary 2-D matrix
...
...
This diff is collapsed.
Click to expand it.
src/postprocessor/core/postprocessing.py
+
5
−
5
View file @
d43d5710
...
...
@@ -10,8 +10,8 @@ from agora.io.cells import Cells
from
agora.io.signal
import
Signal
from
agora.io.writer
import
Writer
from
agora.utils.indexing
import
(
_3d_index
_to_2d
,
_
assoc_indices_to_3d
,
assoc_indices
_to_2d
,
assoc_indices_to_3d
,
)
from
agora.utils.merge
import
merge_lineage
from
postprocessor.core.abc
import
get_parameters
,
get_process
...
...
@@ -133,19 +133,19 @@ class PostProcessor(ProcessABC):
record
=
self
.
signal
.
get_raw
(
self
.
targets
[
"
merging_picking
"
][
"
merger
"
])
merges
=
self
.
merger
.
run
(
record
)
# get lineages from cells object attached to picker
lineage
=
_
assoc_indices_to_3d
(
self
.
picker
.
cells
.
mothers_daughters
)
lineage
=
assoc_indices_to_3d
(
self
.
picker
.
cells
.
mothers_daughters
)
if
merges
.
any
():
# update lineages and merges after merging
new_lineage
,
new_merges
=
merge_lineage
(
lineage
,
merges
)
else
:
new_lineage
=
lineage
new_merges
=
merges
self
.
lineage
=
_3d_index
_to_2d
(
new_lineage
)
self
.
lineage
=
assoc_indices
_to_2d
(
new_lineage
)
self
.
writer
.
write
(
"
modifiers/merges
"
,
data
=
[
np
.
array
(
x
)
for
x
in
new_merges
]
)
self
.
writer
.
write
(
"
modifiers/lineage_merged
"
,
_3d_index
_to_2d
(
new_lineage
)
"
modifiers/lineage_merged
"
,
assoc_indices
_to_2d
(
new_lineage
)
)
# run picker
picked_indices
=
self
.
picker
.
run
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment