ceem.systems package

Submodules

ceem.systems.discretelinear module

class ceem.systems.discretelinear.DiscreteLinear(xdim, udim, ydim, A=None, B=None, C=None, D=None, obsModel={'activation': 'tanh', 'gain': 0.5, 'hidden_sizes': [32, 32], 'ln': False})[source]

Bases: ceem.dynamics.DiscreteDynamicalSystem, torch.nn.modules.module.Module, ceem.dynamics.AnalyticDynJacMixin, ceem.dynamics.ObsJacMixin

Discrete dynamical system with linear dynamics and linear or non-linear observation model.

jac_step_theta(t, x, u=None)[source]

Returns the Jacobian of step at time t

Parameters
  • t (torch.tensor) – (B, T,) shaped time indices

  • x (torch.tensor) – (B, T, n) shaped system states

  • u (torch.tensor) – (B, T, m) shaped control inputs

Returns

jac_x_t (seq of torch.tensor): jacobian of the observation wrt each nn.Parameter

jac_step_x(t, x, u)[source]

Returns the Jacobian of step at time t

Parameters
  • t (torch.tensor) – (B, T,) shaped time indices

  • x (torch.tensor) – (B, T, n) shaped system states

  • u (torch.tensor) – (B, T, m) shaped control inputs

Returns

jac_x_t (torch.tensor): (B, T, n, n) shaped jacobian of the next state

observe(t, x, u)[source]

Returns y_t

step(t, x, u)[source]

Returns next x_{t+1}

Parameters
  • t (torch.IntTensor) – (B, T,) shaped time

  • x (torch.tensor) – (B, T, n) shaped system states

  • u (torch.tensor) – (B, T, m) shaped control inputs

Returns

(B, T, n) shaped next system states

Return type

x_next (torch.tensor)

class ceem.systems.discretelinear.DynamicsModule(A, B, xdim, udim)[source]

Bases: torch.nn.modules.module.Module

forward(t, x, u)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class ceem.systems.discretelinear.ObservationModule(C, D, obsModel, xdim, udim, ydim)[source]

Bases: torch.nn.modules.module.Module

forward(t, x, u)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

ceem.systems.lorenzattractor module

class ceem.systems.lorenzattractor.LorenzAttractor(sigma, rho, beta, C, dt, method='midpoint')[source]

Bases: ceem.dynamics.C2DSystem, torch.nn.modules.module.Module, ceem.dynamics.AnalyticObsJacMixin, ceem.dynamics.DynJacMixin

Basic Lorenz Attractor

jac_obs_theta(t, x, u)[source]

Returns the Jacobian of observation wrt theta

Parameters
  • t (torch.tensor) – (B, T,) shaped time indices

  • x (torch.tensor) – (B, T, n) shaped system states

  • u (torch.tensor) – (B, T, m) shaped control inputs

Returns

jac_y_t (seq of torch.tensor): jacobian of the observation wrt each nn.Parameter

jac_obs_x(t, x, u=None)[source]

Returns the Jacobian of observation wrt x

Parameters
  • t (torch.tensor) – (B, T,) shaped time indices

  • x (torch.tensor) – (B, T, n) shaped system states

  • u (torch.tensor) – (B, T, m) shaped control inputs

Returns

jac_y_t (torch.tensor): (B, T, m, n) shaped jacobian of the observation

observe(t, x, u=None)[source]

Returns y_t

step_derivs(t, x, u=None)[source]

Returns xdot_t

Parameters
  • t (torch.tensor) – (B, T,) shaped time indices

  • x (torch.tensor) – (B, T, n) shaped system states

  • u (torch.tensor) – (B, T, m) shaped control inputs

Returns

(B, T, n) system state derivatives

Return type

xdot (torch.tensor)

ceem.systems.lorenzattractor.default_lorenz_attractor(seed=4, obsdif=1, dt=0.04)[source]
ceem.systems.lorenzattractor.main()[source]

ceem.systems.lorenzsystem module

class ceem.systems.lorenzsystem.LorenzSystem(sigmas, rhos, betas, H, C, dt, method='midpoint')[source]

Bases: ceem.dynamics.C2DSystem, torch.nn.modules.module.Module, ceem.dynamics.AnalyticObsJacMixin, ceem.dynamics.DynJacMixin

Basic Lorenz Attractor

jac_obs_theta(t, x, u=None)[source]

Returns the Jacobian of observation wrt theta

Parameters
  • t (torch.tensor) – (B, T,) shaped time indices

  • x (torch.tensor) – (B, T, n) shaped system states

  • u (torch.tensor) – (B, T, m) shaped control inputs

Returns

jac_y_t (seq of torch.tensor): jacobian of the observation wrt each nn.Parameter

jac_obs_x(t, x, u=None)[source]

Returns the Jacobian of observation wrt x

Parameters
  • t (torch.tensor) – (B, T,) shaped time indices

  • x (torch.tensor) – (B, T, n) shaped system states

  • u (torch.tensor) – (B, T, m) shaped control inputs

Returns

jac_y_t (torch.tensor): (B, T, m, n) shaped jacobian of the observation

observe(t, x, u=None)[source]

Returns y_t

step_derivs(t, x, u=None)[source]

Returns xdot_t

Parameters
  • t (torch.tensor) – (B, T,) shaped time indices

  • x (torch.tensor) – (B, T, n) shaped system states

  • u (torch.tensor) – (B, T, m) shaped control inputs

Returns

(B, T, n) system state derivatives

Return type

xdot (torch.tensor)

ceem.systems.lorenzsystem.default_lorenz_system(k, seed=4, obsdif=2, dt=0.04)[source]

ceem.systems.maglev module

class ceem.systems.maglev.MagLev(mg, k, dt, method='midpoint')[source]

Bases: ceem.dynamics.C2DSystem, torch.nn.modules.module.Module, ceem.dynamics.AnalyticObsJacMixin, ceem.dynamics.DynJacMixin

Simple pendulum, where y = [cos th, sin th]

jac_obs_x(t, x, u=None)[source]

Returns the Jacobian of observation wrt x

Parameters
  • t (torch.tensor) – (B, T,) shaped time indices

  • x (torch.tensor) – (B, T, n) shaped system states

  • u (torch.tensor) – (B, T, m) shaped control inputs

Returns

jac_y_t (torch.tensor): (B, T, m, n) shaped jacobian of the observation

observe(t, x, u=None)[source]

Returns y_t

step_derivs(t, x, u)[source]

Returns xdot_t

Parameters
  • t (torch.tensor) – (B, T,) shaped time indices

  • x (torch.tensor) – (B, T, n) shaped system states

  • u (torch.tensor) – (B, T, m) shaped control inputs

Returns

(B, T, n) system state derivatives

Return type

xdot (torch.tensor)

ceem.systems.springmassdamper module

class ceem.systems.springmassdamper.SpringMassDamper(M, D, K, dt, method='midpoint')[source]

Bases: ceem.dynamics.KinoDynamicalSystem, ceem.dynamics.C2DSystem, torch.nn.modules.module.Module, ceem.dynamics.DynJacMixin, ceem.dynamics.AnalyticObsJacMixin

Generalized Spring Mass Damper System

dynamics(t, q, v, u)[source]

Returns qdot_t

Parameters
  • t (torch.tensor) – (B, T,) shaped time indices

  • q (torch.tensor) – (B, T, qn) shaped system generalized coordinates

  • v (torch.tensor) – (B, T, vn) shaped system generalized velocities

  • u (torch.tensor) – (B, T, m) shaped control inputs

Returns

(B, T, n) system gen. velocity derivatives

Return type

vdot (torch.tensor)

jac_obs_theta(t, x, u)[source]

Returns the Jacobian of observation wrt theta

Parameters
  • t (torch.tensor) – (B, T,) shaped time indices

  • x (torch.tensor) – (B, T, n) shaped system states

  • u (torch.tensor) – (B, T, m) shaped control inputs

Returns

jac_y_t (seq of torch.tensor): jacobian of the observation wrt each nn.Parameter

jac_obs_x(t, x, u)[source]

Returns the Jacobian of observation wrt x

Parameters
  • t (torch.tensor) – (B, T,) shaped time indices

  • x (torch.tensor) – (B, T, n) shaped system states

  • u (torch.tensor) – (B, T, m) shaped control inputs

Returns

jac_y_t (torch.tensor): (B, T, m, n) shaped jacobian of the observation

kinematics(t, q, v, u)[source]

Returns qdot_t

Parameters
  • t (torch.tensor) – (B, T,) shaped time indices

  • q (torch.tensor) – (B, T, qn) shaped system generalized coordinates

  • v (torch.tensor) – (B, T, vn) shaped system generalized velocities

  • u (torch.tensor) – (B, T, m) shaped control inputs

Returns

(B, T, n) system gen. coordinate derivatives

Return type

qdot (torch.tensor)

observe(t, x, u=None)[source]

Returns y_t

ceem.systems.springmassdamper.main()[source]

Module contents