Density#
- class braincell.mech.Density(class_name, /, *, params=None, name=None, coverage_area_fraction=1.0)[source]#
Base class for distributed mechanism declarations.
Densityis the shared skeleton forChannelandIon. It stores the declaration fields (class_name,params,name,coverage_area_fraction) and implements equality / hashing / immutability, but it is abstract in the sense thatcategoryis only set by the concrete subclasses. Attempting to constructDensitydirectly raisesTypeError.- Parameters:
class_name (
Any) – Registry key for the concrete runtime class, or a class object whose canonical name the registry already knows (e.g.braincell.ion.PotassiumFixed). A type argument is resolved throughbraincell.mech.get_registry()at construction time; the storedclass_nameis always a string.params (
Any) – Parameter mapping.None(the default) produces an emptyParams.name (
str|None) – Optional instance label. WhenNone,class_nameis used as the display label (seeinstance_name).coverage_area_fraction (
float) – Fraction in[0, 1]of the target control volume’s lateral area covered by this declaration. Set by the control-volume lowering pipeline (braincell.cv._lower) when a paint region only partially overlaps a CV. Defaults to1.0.
- Raises:
TypeError – If
Densityitself is instantiated directly (the concrete subclass determinescategory), or ifclass_nameis neither a string nor a class, or ifnameis not a string orNone.ValueError – If
class_nameresolves to an empty string, or ifcoverage_area_fractionis outside[0, 1].
- category: ClassVar[str] = ''#
Category discriminator, set by concrete subclasses to
"channel"or"ion". Instances of the abstract base have an empty string.
- property instance_name: str#
Display label for this declaration.
Returns
self.namewhen set, otherwiseself.class_name.