From 3a870f25efcb32c8c185f7a71063bf72280046f9 Mon Sep 17 00:00:00 2001 From: Sichao He <1310722434@qq.com> Date: Sat, 10 Aug 2024 14:00:32 +0800 Subject: [PATCH] Fix `Unit.create` for setting `base` (#37) --- brainunit/_base.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/brainunit/_base.py b/brainunit/_base.py index d2f5101..92cd165 100644 --- a/brainunit/_base.py +++ b/brainunit/_base.py @@ -1395,7 +1395,13 @@ def has_same_dim(self, other: 'Unit') -> bool: return get_dim(self) == other_dim @staticmethod - def create(dim: Dimension, name: str, dispname: str, scale: int = 0) -> 'Unit': + def create( + dim: Dimension, + name: str, + dispname: str, + scale: int = 0, + base: float = 10. + ) -> 'Unit': """ Create a new named unit. @@ -1419,6 +1425,7 @@ def create(dim: Dimension, name: str, dispname: str, scale: int = 0) -> 'Unit': u = Unit( dim=dim, scale=scale, + base=base, name=name, dispname=dispname, )