Other

Logging

Logging configuration

class pttools.logging.MatplotlibFilter(name='')

Bases: Filter

Filter for excluding some matplotlib debug messages

filter(record)

Determine if the specified record is to be logged.

Returns True if the record should be logged, or False otherwise. If deemed appropriate, the record may be modified in-place.

Parameters:

record (LogRecord)

Return type:

bool

pttools.logging.setup_logging(log_dir=None, enable_faulthandler=True, silence_spam=True)

Configure logging to both file and console and optionally silence spam

Parameters:
  • log_dir (str)

  • enable_faulthandler (bool)

  • silence_spam (bool)

Type hints

Type hints for simplifying and unifying PTtools code

pttools.type_hints.CS2CFunc

ctypes type of a cs2 function

pttools.type_hints.CS2Fun

Type of a cs2 function

alias of Callable[[float | float64 | ndarray, float | float64 | ndarray], float | float64 | ndarray] | CPUDispatcher

pttools.type_hints.CS2FunScalarPtr = (float64, float64) -> float64*

Numba pointer to a cs2 function

pttools.type_hints.CS2FunScalarSig = (float64, float64) -> float64

Numba type of a cs2 function

pttools.type_hints.FloatListOrArr

Float list or a Numpy array

alias of List[float | float64] | ndarray

pttools.type_hints.FloatOrArr

Float or a Numpy array

alias of float | float64 | ndarray

pttools.type_hints.FloatOrArrNumba

The return type of a Numba function that returns a float or a Numpy array

alias of float | float64 | ndarray | callable | CPUDispatcher

pttools.type_hints.IntOrArr

Integer or a Numpy array

alias of int | ndarray

pttools.type_hints.NumbaFunc

Numba function

alias of callable | CPUDispatcher

pttools.type_hints.ODESolver

ODE solver specifier

alias of OdeSolver | Type[OdeSolver] | Type[odeint] | str