Simulation#

class scdiffeq.tools._simulation.Simulation(use_key: str = 'X_pca', time_key: str = 'Time point', N: int = 1, device: device | None = device(type='cpu'), *args, **kwargs)[source]#

Bases: ABCParse

Sampled trajectories from an scDiffEq model

Parameters:
  • use_key (str) – description. Default: “X_pca”

  • N (int) – number of trajectories to sample from the model. Default: 2000

  • device (bool) – description. Default: “cuda:0”

Returns:

None

__init__(use_key: str = 'X_pca', time_key: str = 'Time point', N: int = 1, device: device | None = device(type='cpu'), *args, **kwargs)[source]#
Parameters:
  • use_key (str) – description. Default: “X_pca”

  • N (int) – number of trajectories to sample from the model. Default: 2000

  • device (bool) – description. Default: “cuda:0”

Returns:

None

property idx#
property Z0: Tensor#
property t: Tensor#
forward(Z0, t) Tensor[source]#
_to_adata_sim(Z_hat: ndarray) AnnData[source]#
Parameters:

Z_hat (np.ndarray)

Returns:

adata_sim (anndata.AnnData)

__call__(diffeq, adata: AnnData, idx: Index, dt: float = 0.1, t: Tensor | None = None, *args, **kwargs) AnnData[source]#

Simulate trajectories by sampling from an scDiffEq model.

Parameters:
  • () (diffeq) – lightning model.

  • adata (AnnData) – Input AnnDat object.

  • idx (pd.Index) – cell indices (corresponding to adata from which the model should initiate sampled trajectories.

Returns:

adata_sim (anndata.AnnData)

__parse__(kwargs: Dict, public: List | None = [None], private: List | None = [], ignore: List | None = []) None#

Made to be called during cls.__init__ of the inherited class. Central function of this autoparsing base class.

Parameters:
  • kwargs (Dict,)

  • public (Optional[List] = [None],)

  • private (Optional[List] = [],)

  • ignore (Optional[List] = [])

Return type:

None

__update__(kwargs: Dict, public: List | None = [None], private: List | None = [], ignore: List | None = []) None#

To be called after __parse__ has already been called (e.g., during cls.__call__) of the inherited class.

Parameters:
  • kwargs (Dict) – Typically, locals()

  • public (Optional[List] = [None])

  • private (Optional[List] = [])

  • ignore (Optional[List] = [])

  • class. (Second-most central function of this autoparsing base)

Return type:

None