Karana.Core#
Core modules and classes.
These are foundational and utilized by many of the other packages and modules.
Attributes#
Classes#
Weak reference to C++ object. |
|
Base class used for Var and BaseWithVars. |
|
Container class that holds all the Base objects. |
|
Common base class used by most simulation objects. |
|
Base class for json loggers. Json log information will come in on the |
|
Locking version of the Base class. This is the base class but with |
|
The Vars for the LockingBase class. |
|
Members: |
|
A structure to hold nested Vars. |
|
Base class for all Vars. |
|
Base class for all Vars. |
|
Base class for all Vars. |
|
Base class for all Vars. |
|
Base class for all Vars. |
|
Base class for all Vars. |
|
Base class for all Vars. |
|
Base class for all Vars. |
|
Base class for all Vars. |
|
Base class for all Vars. |
|
Base class for all Vars. |
|
Base class for all Vars. |
|
Base class for all Vars. |
|
Base class for all Vars. |
|
Base class for all Vars. |
|
Enums for the Var type. |
|
Base class for all Vars. |
|
Base class for all Vars. |
|
Base class for all Vars. |
|
Base class for all Vars. |
|
Base class for all Vars. |
|
Base class for all Vars. |
Functions#
|
Use this decorator is used to mark functions or classes as deprecated. |
|
Checks if all Base objects have been destroyed. |
|
Checks whether all non-DataCache objects are healthy |
|
Checks is the params for all the Base objects in the provided |
|
Write an debug to all loggers using a function that outputs a message. |
|
Write an debug to all loggers using the provided ordered json and |
|
Discard a sequence of Bases. |
|
Write an error to all loggers using a function that outputs a message. |
|
Find the /share/Karana path on the system respecting the |
|
Write an info to all loggers using a function that outputs a message. |
|
Write an num_trace to all loggers using a function that outputs a |
|
Write an trace to all loggers using a function that outputs a message. |
|
Write an trace to all loggers using the provided ordered json and |
|
Write an warn to all loggers using a function that outputs a message. |
Package Contents#
- type Karana.Core.Json = dict[str, str | int | float | 'Json']#
- Karana.Core.deprecated(name: str, removal_date: datetime.date | str, msg: str)#
- Karana.Core.deprecated(removal_date: datetime.date | str, msg: str)
Use this decorator is used to mark functions or classes as deprecated.
See overloaded function signatures for details.
- Karana.Core.T#
- class Karana.Core.CppWeakRef(base: T)#
Bases:
CppWeakRefBase,Generic[T]Weak reference to C++ object.
Use the get() method to return a Python object from the C++ object if it exists.
- class Karana.Core.Base(name: str)#
- Base class used for Var and BaseWithVars.
Most simulation objects will derive from BaseWithVars.
- dump(prefix: str = '', options: DumpOptionsBase = None) None#
Print dumpString on std::cout.
- Parameters:
prefix – A string to use as prefix for each output line
options – Struct with options to tailor the output
- dumpString(prefix: str = '', options: DumpOptionsBase = None) str#
Return information about the object.
- Parameters:
prefix – A string to use as prefix for each output line
options – Struct with options to tailor the output
- Returns:
String with the information about the object.
- id() int#
id of this object. :returns: id of this object.
- isReady() bool#
Checks is the params for the object have been initialized. :returns: True if the params have set up.
- name() str#
Name of this object. :returns: Name of this object.
- typeString(brief: bool = True) str#
Returns the type string of Base. :param brief: if true, return the short form of the class type name, else
the full type name
- Returns:
The type string.
- class Karana.Core.BaseContainer#
Container class that holds all the Base objects.
The BaseContainer provides named storage and access to Base objects using unique IDs. It supports range-based iteration and is designed to allow insertion and erasure by friend class Base.
- at_exit_fns: _VoidCallbackRegistry#
- check_all_destroyed: bool#
- static singleton() BaseContainer#
Gets the singleton BaseContainer instance.
- Returns:
A shared pointer to the singleton BaseContainer.
- at(arg0: SupportsInt) Base#
Retrieves the Base pointer associated with the given ID.
- Parameters:
id – The ID of the desired Base object.
- Returns:
A pointer to the Base object, or nullptr if not found.
- atLockingBase(arg0: SupportsInt) LockingBase | None#
Look for a Base at the given ID. Try to convert it to a LockingBase
- contains(arg0: SupportsInt) bool#
Checks whether the container has an entry with the given ID.
- Parameters:
id – The ID to check for.
- Returns:
True if the ID is present; otherwise, false.
- class Karana.Core.BaseVars#
Common base class used by most simulation objects.
- static create() BaseVars#
Create a new instance of BaseVars.
- Parameters:
bwv – The BaseWithVars that this BaseVars will be associated with.
- Returns:
A pointer to the newly created instance of BaseVars.
- dump(prefix: str = '', depth: SupportsInt = 0) None#
Dump all of the Vars to stdout.
- Parameters:
prefix – The prefix to put in front of each Var.
depth – How many levels deep to dump. A negative value will dump all levels.
- dumpString(prefix: str = '', depth: SupportsInt = 0) str#
Dump all of the Vars as a string.
- Parameters:
prefix – The prefix to put in front of each Var.
depth – How many levels deep to dump. A negative value will dump all levels.
- Returns:
A string with the information about all the Vars contained within.
- getAllVars() NestedVars#
Get all the Vars that this BaseVars has.
- Returns:
A map of Vars, where the Var name is the key and the Var is the value.
- class Karana.Core.BaseWithVars(name: str)#
Bases:
Base- static create(name: str) BaseWithVars#
Create an instance of BaseWithVars
- Parameters:
name – Name for the BaseWithVars class.
- Returns:
A pointer to the newly created BaseWithVars class.
- class Karana.Core.CppWeakRefBase(base: Base)#
-
- __deepcopy__(arg0: Any) CppWeakRefBase#
- class Karana.Core.DebugManager#
- all_destroyed_verbosity: ClassVar[int] = 10#
- enable_locking_trace: ClassVar[bool] = False#
- static getUsageTrackingErrors() bool#
Get the value of usage tracking errors.
Usage tracking errors is used to enable/disable error messages when discarding variables. If true, it will print errors if the variable if still in use. If false, it will only print a warning, but will continue on anyway.
- Returns:
Whether usage tracking errors is enabled or disabled.
- static setUsageTrackingErrors(enable: bool) None#
Set the value of usage tracking errors.
Usage tracking errors is used to enable/disable error messages when discarding variables. If true, it will print errors if the variable if still in use. If false, it will only print a warning, but will continue on anyway.
- Parameters:
enable – If true, then enable usage tracking errors. If false, then disable it.
- class Karana.Core.DumpOptionsLockingBase#
Bases:
DumpOptionsBase- downstream_deps: bool#
- healthy_status: bool#
- id: bool#
- ref_count: bool#
- upstream_deps: bool#
- class Karana.Core.JsonLogger(name: str)#
Base class for json loggers. Json log information will come in on the log functions,
and derived classes can do whatever they want with it.
- class Karana.Core.LockingBase(name: str)#
Bases:
BaseWithVarsLocking version of the Base class. This is the base class but with logic to make it healthy or not healthy. It also contains logic to add/remove dependents.
- static create(name: str) LockingBase#
LockingBase class constructor.
- Parameters:
name – Name for the base class.
- Returns:
A pointer to the newly created LockingBase.
- addDependent(arg0: LockingBase) None#
Add dependent as a dependent of this, which means whenever we call ensureNotHealthy on this, we will call ensureNotHealthy on the dependent first. Similarly, to make the dependent healthy, we must first make this healthy.
- Parameters:
dependent – The LockingBase to add as a dependent.
- dumpDependencyGraphviz(filename: os.PathLike | str | bytes, terminal: collections.abc.Sequence[LockingBase] = [], downstream_depth: SupportsInt = -1, upstream_depth: SupportsInt = -1) None#
Create a Graphviz dot file representing the dependency graph. :param filename: Output filename. :param terminal: Nodes to be considered as terminal nodes (stop created
graph on current branch if one of these is reached).
- Parameters:
downstream_depth – Max depth for downstream traversal.
upstream_depth – Max depth for upstream traversal.
- dumpDependencyTree(prefix: str = '', depth: SupportsInt = -1, downstream: bool = True) None#
Display the dependency tree for the object. :param prefix: Optional prefix to add to each line. :param depth: Depth to traverse (default -1 means no limit). :param downstream: Whether to show downstream (true) or upstream (false)
dependencies.
- dumpString(prefix: str = '', options: DumpOptionsBase = None) str#
Return a formatted string containing information about this object. :param prefix: String prefix to use for formatting. :param options: Dump options (if null, defaults will be used).
- Returns:
A string representation of the object.
- ensureHealthy() None#
Make sure this object is healthy if it is not already so.
- ensureNotHealthy() bool#
Make sure this object is in not healthy state if it is not already so. :returns: bool If true, then everything went as intended. If false, then we
are _within_ensureHealthy. This is used to signal that we need to call ensureHealthy and not be not healthy.
- freeze() None#
Freezes the cache to prevent it from becoming not healthy.
- isFrozen() bool#
Returns whether the cache is frozen or not. :returns: true if the cache is frozen, false otherwise.
- isHealthy() bool#
Check whether this is healthy or not. :returns: True if this is healthy, false otherwise.
- removeDependent(arg0: LockingBase) None#
Remove dependent as a dependent of this. See addDependent for more information on what a dependent is.
Remove dependent as a dependent of this. :param dependent: The LockingBase to remove as a dependent.
- unfreeze() None#
Unfreezes the cache to allow it to become not healthy.
- class Karana.Core.LockingBaseVars#
Bases:
BaseVarsThe Vars for the LockingBase class.
- property downstream_deps: VarVecString#
The downstream dependencies
- property upstream_deps: VarVecString#
The upstream dependencies
- class Karana.Core.LogLevel(value: SupportsInt)#
Members:
NUM_TRACE
TRACE
DEBUG
INFO
WARN
ERROR
OFF
- __eq__(other: Any) bool#
- __getstate__() int#
- __hash__() int#
- __index__() int#
- __int__() int#
- __ne__(other: Any) bool#
- __repr__() str#
- __setstate__(state: SupportsInt) None#
- __str__() str#
- property name: str#
- property value: int#
- class Karana.Core.MsgLogger#
- static addConsoleLogger(verbosity: LogLevel) None#
Add a console logger. This prints errors to stderr and everything else to stdout.
The stdout logger is called “stdout” and the stderr logger is called “stderr”.
- Parameters:
verbosity – The verbosity of the stdout logger.
- static addFileLogger(filename: os.PathLike | str | bytes, verbosity: LogLevel) None#
Add a file logger. This adds a logger that will print to the given file.
The name of the logger is the same as the filename.
- Parameters:
filename – The name of the file to log to.
verbosity – The verbosity of the new file logger.
- static addJsonLogger(logger: JsonLogger) None#
Add a json logger.
- Parameters:
logger – The json logger to add.
- static changeVerbosity(name: str, verbosity: LogLevel) None#
Remove a logger. :param name: The name of the logger to remove.
- static removeLogger(name: str) None#
Remove a logger. :param name: The name of the logger to remove.
- class Karana.Core.NestedVars#
A structure to hold nested Vars.
- property description: str#
Description for the NestedVars
- property name: str#
Name of the NestedVars
- property nested_vars: list[NestedVars]#
Nested Vars
- class Karana.Core.Var#
Base class for all Vars.
- description() str#
Description of this Var. :returns: Description of this Var.
- id() int#
id of this object. :returns: id of this object.
- name() str#
Name of this Var. :returns: Name of this Var.
- quantity() str#
Quantity type of this Var. :returns: Quantity type of this Var.
- class Karana.Core.VarBool(name: str, fn: collections.abc.Callable[[], bool], description: str, quantity: str = '')#
- class Karana.Core.VarBool(name: str, other: VarBool, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], bool], description: str, quantity: str = '') VarBool#
- static create(name: str, other: VarBool, description: str) VarBool
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() bool#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- class Karana.Core.VarChar(name: str, fn: collections.abc.Callable[[], str], description: str, quantity: str = '')#
- class Karana.Core.VarChar(name: str, other: VarChar, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], str], description: str, quantity: str = '') VarChar#
- static create(name: str, other: VarChar, description: str) VarChar
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() str#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- class Karana.Core.VarDouble(name: str, fn: collections.abc.Callable[[], float], description: str, quantity: str = '')#
- class Karana.Core.VarDouble(name: str, other: VarDouble, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], float], description: str, quantity: str = '') VarDouble#
- static create(name: str, other: VarDouble, description: str) VarDouble
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() float#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- getPlottingFunction() collections.abc.Callable[[], float]#
Return the plotting function associated with this Var.
- Returns:
The plotting function associated with this Var.
- class Karana.Core.VarFloat(name: str, fn: collections.abc.Callable[[], float], description: str, quantity: str = '')#
- class Karana.Core.VarFloat(name: str, other: VarFloat, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], float], description: str, quantity: str = '') VarFloat#
- static create(name: str, other: VarFloat, description: str) VarFloat
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() float#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- class Karana.Core.VarHomTran(name: str, fn: collections.abc.Callable[[], Karana.Math.HomTran], description: str, quantity: str = '')#
- class Karana.Core.VarHomTran(name: str, other: VarHomTran, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], Karana.Math.HomTran], description: str, quantity: str = '') VarHomTran#
- static create(name: str, other: VarHomTran, description: str) VarHomTran
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() Karana.Math.HomTran#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- class Karana.Core.VarId(name: str, fn: collections.abc.Callable[[], int], description: str, quantity: str = '')#
- class Karana.Core.VarId(name: str, other: VarId, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], int], description: str, quantity: str = '') VarId#
- static create(name: str, other: VarId, description: str) VarId
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() int#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- class Karana.Core.VarInt(name: str, fn: collections.abc.Callable[[], int], description: str, quantity: str = '')#
- class Karana.Core.VarInt(name: str, other: VarInt, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], int], description: str, quantity: str = '') VarInt#
- static create(name: str, other: VarInt, description: str) VarInt
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() int#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- class Karana.Core.VarLong(name: str, fn: collections.abc.Callable[[], int], description: str, quantity: str = '')#
- class Karana.Core.VarLong(name: str, other: VarLong, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], int], description: str, quantity: str = '') VarLong#
- static create(name: str, other: VarLong, description: str) VarLong
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() int#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- class Karana.Core.VarMat(name: str, fn: collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.float64], [m, n]]], matrix_rows: SupportsInt, matrix_cols: SupportsInt, description: str, quantity: str = '')#
- class Karana.Core.VarMat(name: str, other: VarMat, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.float64], [m, n]]], matrix_rows: SupportsInt, matrix_cols: SupportsInt, description: str, quantity: str = '') VarMat#
- static create(name: str, other: VarMat, description: str) VarMat
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() Annotated[numpy.typing.NDArray[numpy.float64], [m, n]]#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- class Karana.Core.VarMat33(name: str, fn: collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.float64], [3, 3]]], description: str, quantity: str = '')#
- class Karana.Core.VarMat33(name: str, other: VarMat33, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.float64], [3, 3]]], description: str, quantity: str = '') VarMat33#
- static create(name: str, other: VarMat33, description: str) VarMat33
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() Annotated[numpy.typing.NDArray[numpy.float64], [3, 3]]#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- class Karana.Core.VarMat66(name: str, fn: collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.float64], [6, 6]]], description: str, quantity: str = '')#
- class Karana.Core.VarMat66(name: str, other: VarMat66, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.float64], [6, 6]]], description: str, quantity: str = '') VarMat66#
- static create(name: str, other: VarMat66, description: str) VarMat66
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() Annotated[numpy.typing.NDArray[numpy.float64], [6, 6]]#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- class Karana.Core.VarShort(name: str, fn: collections.abc.Callable[[], int], description: str, quantity: str = '')#
- class Karana.Core.VarShort(name: str, other: VarShort, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], int], description: str, quantity: str = '') VarShort#
- static create(name: str, other: VarShort, description: str) VarShort
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() int#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- class Karana.Core.VarSpatialVector(name: str, fn: collections.abc.Callable[[], Karana.Math.SpatialVector], description: str, quantity: str = '')#
- class Karana.Core.VarSpatialVector(name: str, other: VarSpatialVector, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], Karana.Math.SpatialVector], description: str, quantity: str = '') VarSpatialVector#
- static create(name: str, other: VarSpatialVector, description: str) VarSpatialVector
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() Karana.Math.SpatialVector#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- class Karana.Core.VarString(name: str, fn: collections.abc.Callable[[], str], description: str, quantity: str = '')#
- class Karana.Core.VarString(name: str, other: VarString, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], str], description: str, quantity: str = '') VarString#
- static create(name: str, other: VarString, description: str) VarString
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() str#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- class Karana.Core.VarType(value: SupportsInt)#
Enums for the Var type.
Members:
DOUBLE : Var type for double
FLOAT : Var type for float
SHORT : Var type for short
INT : Var type for int
LONG : Var type for long
CHAR : Var type for char
VEC3 : Var type for km::Vec3
VEC6 : Var type for km::Vec6
VEC : Var type for km::Vec
VEC_INT : Var type for km::VecInt
MAT33 : Var type for km::Mat33
MAT66 : Var type for km::Mat66
MAT : Var type for km::Mat
STRING : Var type for std::string
BASEVARS : Var type for BaseVars
- __eq__(other: Any) bool#
- __getstate__() int#
- __hash__() int#
- __index__() int#
- __int__() int#
- __ne__(other: Any) bool#
- __repr__() str#
- __setstate__(state: SupportsInt) None#
- __str__() str#
- property name: str#
- property value: int#
- class Karana.Core.VarUnitQuaternion(name: str, fn: collections.abc.Callable[[], Karana.Math.UnitQuaternion], description: str, quantity: str = '')#
- class Karana.Core.VarUnitQuaternion(name: str, other: VarUnitQuaternion, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], Karana.Math.UnitQuaternion], description: str, quantity: str = '') VarUnitQuaternion#
- static create(name: str, other: VarUnitQuaternion, description: str) VarUnitQuaternion
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() Karana.Math.UnitQuaternion#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- class Karana.Core.VarVec(name: str, fn: collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.float64], [m, 1]]], vector_size: SupportsInt, description: str, quantity: str = '')#
- class Karana.Core.VarVec(name: str, other: VarVec, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.float64], [m, 1]]], vector_size: SupportsInt, description: str, quantity: str = '') VarVec#
- static create(name: str, other: VarVec, description: str) VarVec
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() Annotated[numpy.typing.NDArray[numpy.float64], [m, 1]]#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- getPlottingFunction() collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.float64], [m, 1]]]#
Return the plotting function associated with this Var.
- Returns:
The plotting function associated with this Var.
- class Karana.Core.VarVec3(name: str, fn: collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.float64], [3, 1]]], description: str, quantity: str = '')#
- class Karana.Core.VarVec3(name: str, other: VarVec3, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.float64], [3, 1]]], description: str, quantity: str = '') VarVec3#
- static create(name: str, other: VarVec3, description: str) VarVec3
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() Annotated[numpy.typing.NDArray[numpy.float64], [3, 1]]#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- getPlottingFunction() collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.float64], [3, 1]]]#
Return the plotting function associated with this Var.
- Returns:
The plotting function associated with this Var.
- class Karana.Core.VarVec4(name: str, fn: collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.float64], [4, 1]]], description: str, quantity: str = '')#
- class Karana.Core.VarVec4(name: str, other: VarVec4, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.float64], [4, 1]]], description: str, quantity: str = '') VarVec4#
- static create(name: str, other: VarVec4, description: str) VarVec4
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() Annotated[numpy.typing.NDArray[numpy.float64], [4, 1]]#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- class Karana.Core.VarVec6(name: str, fn: collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.float64], [6, 1]]], description: str, quantity: str = '')#
- class Karana.Core.VarVec6(name: str, other: VarVec6, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.float64], [6, 1]]], description: str, quantity: str = '') VarVec6#
- static create(name: str, other: VarVec6, description: str) VarVec6
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() Annotated[numpy.typing.NDArray[numpy.float64], [6, 1]]#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- class Karana.Core.VarVecString(name: str, fn: collections.abc.Callable[[], list[str]], description: str, quantity: str = '')#
- class Karana.Core.VarVecString(name: str, other: VarVecString, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], list[str]], description: str, quantity: str = '') VarVecString#
- static create(name: str, other: VarVecString, description: str) VarVecString
Create a new instance of Var_T<T>.
- Parameters:
name – The name of the Var_T<T>
f – The callable that produces type T.
description – A description of the Var.
quantity – The quantity of the Var.
- Template Args:
F: Templated callable type that produces type T.
- Returns:
The newly created instance of Var_T<T>.
- __call__() list[str]#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- dumpString(prefix: str = '') str#
Get the value this Var holds as a string.
- Parameters:
prefix – The prefix to put in front of each output line.
- Returns:
The string representation of this Var.
- Karana.Core.allDestroyed(bc: BaseContainer = None) bool#
- Checks if all Base objects have been destroyed.
This issues warnings for anything that has not been destroyed.
- Parameters:
bc – Pointer to the base container to check. If nullptr is provided (the default), then the BaseContainer::singleton will be used.
- Returns:
True if all objects have been destroyed, false otherwise.
- Karana.Core.allHealthy(bc: BaseContainer = None) bool#
Checks whether all non-DataCache objects are healthy
- Parameters:
bc – Pointer to the base container whose LockingBases you want to check. If nullptr is provided (the default), then the BaseContainer::singleton will be used.
- Returns:
True if all objects are healthy
- Karana.Core.allReady(bc: BaseContainer = None) bool#
- Checks is the params for all the Base objects in the provided
BaseContainer are ready.
- Parameters:
bc – Pointer to the base container to check. If nullptr is provided (the default), then the BaseContainer::singleton will be used.
- Returns:
true if the all the Bases are ready, false otherwise.
- Karana.Core.debug(msg: str) None#
- Karana.Core.debug(f: collections.abc.Callable[[], str]) None
- Write an debug to all loggers using a function that outputs a message.
This function is only executed if one or more sinks will consume it.
- Parameters:
f – The function that generates the debug message
- Karana.Core.debugJson(json: Karana.Core.Json) None#
- Karana.Core.debugJson(json: Karana.Core.Json, fn: collections.abc.Callable[[Karana.Core.Json], str]) None
Write an debug to all loggers using the provided ordered json and json_to_string
function.
- Parameters:
json – The ordered json debug information.
fn – The function that generates a string from the provided ordered json.
- Karana.Core.discard(base: Base) None#
- Karana.Core.discard(bases: collections.abc.Sequence[Base]) None
Discard a sequence of Bases.
- Parameters:
bases (collections.abc.Sequence[Base]) – The sequence of bases to discard.
- Karana.Core.error(msg: str) None#
- Karana.Core.error(f: collections.abc.Callable[[], str]) None
- Write an error to all loggers using a function that outputs a message.
This function is only executed if one or more sinks will consume it.
- Parameters:
f – The function that generates the error message
Find the /share/Karana path on the system respecting the KARANA_SHARE_DIR environment variable override.
- Returns:
The /share/Karana path
- Karana.Core.info(msg: str) None#
- Karana.Core.info(f: collections.abc.Callable[[], str]) None
- Write an info to all loggers using a function that outputs a message.
This function is only executed if one or more sinks will consume it.
- Parameters:
f – The function that generates the info message
- Karana.Core.numTrace(msg: str) None#
- Karana.Core.numTrace(f: collections.abc.Callable[[], str]) None
Write an num_trace to all loggers using a function that outputs a message.
This function is only executed if one or more sinks will consume it. This will only run in debug mode. If NDEBUG is defined, it is a no-op.
- Parameters:
f – The function that generates the num_trace message
- Karana.Core.trace(msg: str) None#
- Karana.Core.trace(f: collections.abc.Callable[[], str]) None
- Write an trace to all loggers using a function that outputs a message.
This function is only executed if one or more sinks will consume it.
- Parameters:
f – The function that generates the trace message
- Karana.Core.traceJson(json: Karana.Core.Json) None#
- Karana.Core.traceJson(json: Karana.Core.Json, fn: collections.abc.Callable[[Karana.Core.Json], str]) None
Write an trace to all loggers using the provided ordered json and json_to_string
function.
- Parameters:
json – The ordered_json trace information.
fn – A function that generates a string from the provided ordered json.
- Karana.Core.warn(msg: str) None#
- Karana.Core.warn(f: collections.abc.Callable[[], str]) None
- Write an warn to all loggers using a function that outputs a message.
This function is only executed if one or more sinks will consume it.
- Parameters:
f – The function that generates the warn message