Skip to main content

Documentation Index

Fetch the complete documentation index at: https://tsim.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

enriched_stim_error

enriched_stim_error(exc: ValueError, converted_text: str) -> ValueError
Improve stim parse errors for tsim-specific gates. When stim raises a ‘Gate not found’ error for a gate that should have been converted by shorthand_to_stim, this searches the converted text for the unconverted usage and returns a more helpful error message.

shorthand_to_stim

shorthand_to_stim(text: str) -> str
Convert tsim shorthand syntax to valid stim instructions. Converts: T 0 1 → S[T] 0 1 T_DAG 0 1 → S_DAG[T] 0 1 TPP X0Y1 → SPP[T] X0Y1 TPP_DAG X0Y1 → SPP_DAG[T] X0Y1 R_Z(0.3) 0 → I[R_Z(theta=0.3pi)] 0 R_X(0.25) 0 → I[R_X(theta=0.25pi)] 0 R_Y(-0.5) 0 → I[R_Y(theta=-0.5pi)] 0 U3(0.3, 0.24, 0.49) 0 → I[U3(theta=0.3pi, phi=0.24pi, lambda=0.49pi)] 0

stim_to_shorthand

stim_to_shorthand(text: str) -> str
Convert expanded stim annotations back to tsim shorthand. Rewrites:
  • I[U3(theta=θpi, phi=φpi, lambda=λ*pi)] → U3(θ, φ, λ)
  • I[R_X(theta=α*pi)] / I[R_Y(…)] / I[R_Z(…)] → R_X(α) / R_Y(α) / R_Z(α)
  • SPP[T] → TPP
  • SPP_DAG[T] → TPP_DAG
  • S[T] → T
  • S_DAG[T] → T_DAG