cells¶
champalimaud.cells
¶
The cells of each type: which root ids belong to a type.
cells_of_types(census, sides, types, *, side='right')
¶
Collect the root ids of the cells of each type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
census
|
DataFrame
|
Columns |
required |
sides
|
DataFrame
|
Columns |
required |
types
|
sequence of str
|
The |
required |
side
|
str or None
|
Keep the cells on that side.
|
"right"
|
Returns:
| Type | Description |
|---|---|
dict of str to list of int
|
The root ids of each type, sorted. A type with no cells maps to an empty list. |
Examples:
>>> import polars as pl
>>> census = pl.DataFrame(
... {
... "root_id": [3, 1, 2],
... "primary_type": ["A", "A", "B"],
... }
... )
>>> sides = pl.DataFrame(
... {"root_id": [1, 2, 3], "side": ["right", "right", "left"]}
... )
>>> cells_of_types(census, sides, ["A", "B", "C"])
{'A': [1], 'B': [2], 'C': []}
Source code in champalimaud/cells.py
type_table(cells_by_type)
¶
Tabulate the type of each cell.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cells_by_type
|
dict of str to list
|
Maps a type name to the ids of its cells. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
Columns |
Raises:
| Type | Description |
|---|---|
ValueError
|
For a cell listed under two types. |
Examples: