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. |
|
Enum that keeps track of the verbosity levels. |
|
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. |
|
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. |
|
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 | SupportsIndex) 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 | SupportsIndex) LockingBase | None#
Look for a Base at the given ID. Try to convert it to a LockingBase
- contains(arg0: SupportsInt | SupportsIndex) 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 | SupportsIndex = 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 | SupportsIndex = 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_message_limit: 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.DumpOptionsBaseWithVars#
Bases:
DumpOptionsBase- vars: bool#
- property vars_depth: int#
- class Karana.Core.DumpOptionsLockingBase#
Bases:
DumpOptionsBaseWithVars- downstream_deps: bool#
- healthy_status: bool#
- id: 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(dependent: 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 | SupportsIndex = -1, upstream_depth: SupportsInt | SupportsIndex = -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 | SupportsIndex = -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.
- getVars() LockingBaseVars#
Get the vars for this object.
- Returns:
The vars for this object.
- 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(dependent: 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#
Bases:
enum.IntEnumEnum that keeps track of the verbosity levels.
- __format__(format_spec)#
Convert to a string according to format_spec.
- 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#
Change the verbosity of a logger.
- Parameters:
name – The name of the logger whose verbosity you want to change.
verbosity – The new verbosity of the logger.
- static getVerbosity(name: str) LogLevel#
Get the verbosity of a logger.
- Parameters:
name – The name of the logger whose verbosity you want to get.
- Returns:
The verbosity of the provided logger.
- 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(name: str)#
Bases:
BaseBase class for all Vars.
- description() str#
Description of this Var. :returns: Description 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
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- 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
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- 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
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- 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
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- 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
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- 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
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- 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
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- 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
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- class Karana.Core.VarMat(name: str, fn: collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.float64], [m, n]]], matrix_rows: SupportsInt | SupportsIndex, matrix_cols: SupportsInt | SupportsIndex, 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 | SupportsIndex, matrix_cols: SupportsInt | SupportsIndex, description: str, quantity: str = '') VarMat#
- static create(name: str, other: VarMat, description: str) VarMat
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- 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
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- 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
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- 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
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- class Karana.Core.VarSpatialAcceleration(name: str, fn: collections.abc.Callable[[], Karana.Math.SpatialAcceleration], description: str, quantity: str = '')#
- class Karana.Core.VarSpatialAcceleration(name: str, other: VarSpatialAcceleration, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], Karana.Math.SpatialAcceleration], description: str, quantity: str = '') VarSpatialAcceleration#
- static create(name: str, other: VarSpatialAcceleration, description: str) VarSpatialAcceleration
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- Returns:
The newly created instance of Var_T<T>.
- __call__() Karana.Math.SpatialAcceleration#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- getPlottingFunction() collections.abc.Callable[[], Karana.Math.SpatialAcceleration]#
Return the plotting function associated with this Var.
- Returns:
The plotting function associated with this Var.
- class Karana.Core.VarSpatialForce(name: str, fn: collections.abc.Callable[[], Karana.Math.SpatialForce], description: str, quantity: str = '')#
- class Karana.Core.VarSpatialForce(name: str, other: VarSpatialForce, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], Karana.Math.SpatialForce], description: str, quantity: str = '') VarSpatialForce#
- static create(name: str, other: VarSpatialForce, description: str) VarSpatialForce
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- Returns:
The newly created instance of Var_T<T>.
- __call__() Karana.Math.SpatialForce#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- getPlottingFunction() collections.abc.Callable[[], Karana.Math.SpatialForce]#
Return the plotting function associated with this Var.
- Returns:
The plotting function associated with 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
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- getPlottingFunction() collections.abc.Callable[[], Karana.Math.SpatialVector]#
Return the plotting function associated with this Var.
- Returns:
The plotting function associated with this Var.
- class Karana.Core.VarSpatialVelocity(name: str, fn: collections.abc.Callable[[], Karana.Math.SpatialVelocity], description: str, quantity: str = '')#
- class Karana.Core.VarSpatialVelocity(name: str, other: VarSpatialVelocity, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], Karana.Math.SpatialVelocity], description: str, quantity: str = '') VarSpatialVelocity#
- static create(name: str, other: VarSpatialVelocity, description: str) VarSpatialVelocity
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- Returns:
The newly created instance of Var_T<T>.
- __call__() Karana.Math.SpatialVelocity#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- getPlottingFunction() collections.abc.Callable[[], Karana.Math.SpatialVelocity]#
Return the plotting function associated with this Var.
- Returns:
The plotting function associated with 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
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- class Karana.Core.VarType(*args, **kwds)#
Bases:
enum.EnumEnums for the Var type.
- 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
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- class Karana.Core.VarVec(name: str, fn: collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.float64], [m, 1]]], vector_size: SupportsInt | SupportsIndex, 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 | SupportsIndex, description: str, quantity: str = '') VarVec#
- static create(name: str, other: VarVec, description: str) VarVec
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- 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
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- 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
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- 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
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- class Karana.Core.VarVecInt(name: str, fn: collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.int32], [m, 1]]], vector_size: SupportsInt | SupportsIndex, description: str, quantity: str = '')#
- class Karana.Core.VarVecInt(name: str, other: VarVecInt, description: str)
Bases:
VarBase class for all Vars.
- static create(name: str, fn: collections.abc.Callable[[], Annotated[numpy.typing.NDArray[numpy.int32], [m, 1]]], vector_size: SupportsInt | SupportsIndex, description: str, quantity: str = '') VarVecInt#
- static create(name: str, other: VarVecInt, description: str) VarVecInt
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- Returns:
The newly created instance of Var_T<T>.
- __call__() Annotated[numpy.typing.NDArray[numpy.int32], [m, 1]]#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
- 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
Rename Var_T constructor.
This constructor keeps the same function, size, etc., but takes a new name and description.
- Parameters:
name – The name of the Var_T<T>
other – The Var_T<T> to copy the callable and quantity from.
description – A description of the Var.
- 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.
- class Karana.Core.VoidCallbackRegistry#
- trace_callback_registry: bool#
- __contains__(arg0: str) bool#
Check whether the given callback is contained within the registry. :param item: The name of the callback to check for. :type item: str
- Returns:
True if the item is in the CallbackRegistry, False otherwise.
- Return type:
bool
- __getitem__(key: str | SupportsInt | SupportsIndex) collections.abc.Callable[[], None]#
Get a function by name
- __len__() int#
Get the number of callbacks registered to the CallbackRegistry.
- Returns:
Number of callbacks registered in the CallbackRegistry.
- Return type:
int
- __setitem__(key: str | SupportsInt | SupportsIndex, func: collections.abc.Callable[[], None]) None#
Set a function with a string name or integer index
- clear() None#
Clear out the entire CallbackRegistry. All callbacks will be removed.
- dump(prefix: str = '') None#
Print out the string from dumpString. See dumpString for more details.
- dumpString(prefix: str = '') str#
Create a string that lists all the functions by name.
- erase(name: str, okay_not_exists: bool = False) None#
- erase(index: SupportsInt | SupportsIndex) None
Erase the callback at the provided index.
- Parameters:
name (int) – The index of the callback to erase.
- execute() None#
Execute all functions in the registry.
- executeAndPopReverse() None#
Execute all functions in the registry in reverse and delete them as we go.
- executeReverse() None#
Execute all functions in the registry in reverse.
- insertAfter(item: str, name: str, fn: collections.abc.Callable[[], None]) None#
Insert a function after another in the registry. :param item: The name of the item to insert this new one after. :type item: str :param name: The name of the new item. :type name: str :param fn: The callback associated with the new item. :type fn: Callable
- insertBefore(item: str, name: str, fn: collections.abc.Callable[[], None]) None#
Insert a function before another in the registry. :param item: The name of the item to insert this new one before. :type item: str :param name: The name of the new item. :type name: str :param fn: The callback associated with the new item. :type fn: Callable
- pop(name: str) collections.abc.Callable[[], None]#
- pop(index: SupportsInt | SupportsIndex) collections.abc.Callable[[], None]
Pop the callback at the provided index.
- Parameters:
name (int) – The index of the callback to pop.
- size() int#
Get the number of callbacks registered to the CallbackRegistry.
- Returns:
Number of callbacks registered in the CallbackRegistry.
- Return type:
int
- 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