Groups

class dendrotweaks.biophys.groups.SegmentGroup(name: str, domains: List[str], select_by: str | None = None, min_value: float | None = None, max_value: float | None = None)[source]

Bases: object

A group of segments that share a common property.

Parameters:
  • name (str) – The name of the segment group.

  • domains (List[str]) – The domains the segments belong to.

  • select_by (Optional[str]) – The property to select the segments by. Can be: - ‘diam’: the diameter of the segment. - ‘section_diam’: the diameter of the section the segment belongs to. - ‘distance’: the distance of the segment from the root. - ‘domain_distance’: the distance of the segment from the root within the domain.

  • min_value (Optional[float]) – The minimum value of the property.

  • max_value (Optional[float]) – The maximum value of the property.

Examples

Create a segment group that selects segments by diameter:

>>> group = SegmentGroup('group1', domains=['dend'], select_by='diam', min_value=1, max_value=2)
>>> group
SegmentGroup("group1", domains=['dend'], diam(1, 2))

Check if a segment is in the group:

>>> segment in group
True
name: str
domains: List[str]
select_by: str | None = None
min_value: float | None = None
max_value: float | None = None
to_dict() Dict[source]

Convert the SegmentGroup to a dictionary.

static from_dict(data: Dict) SegmentGroup[source]

Create a SegmentGroup from a dictionary.