Cadabra
Computer algebra system for field theory problems
Classes | Functions | Variables
cadabra2_defaults Namespace Reference

Classes

class  PackageCompiler
 
class  Server
 Object to handle advanced display in a UI-independent way. More...
 
class  Console
 

Functions

def save_history (history_path)
 
def display (obj, cell_id=0, delay_send=False)
 Generic display function which handles local as well as remote clients. More...
 
def _displayhook (arg)
 
def post_process (__cdbkernel__, ex)
 

Variables

 __cdbkernel__ = cadabra2.__cdbkernel__
 
 completer
 
int PY3 = 3
 
 unicode = str
 
string discr = "\\discretionary{}{}{} "
 
string mopen = "\\begin{dmath*}{}";
 
string mclose = "\\end{dmath*}";
 
 server
 
bool have_matplotlib = True
 
bool have_plotly = True
 
 console = Console()
 
 callback
 
 remember_display_hook = sys.displayhook
 
 displayhook
 

Function Documentation

◆ _displayhook()

def cadabra2_defaults._displayhook (   arg)
private

◆ display()

def cadabra2_defaults.display (   obj,
  cell_id = 0,
  delay_send = False 
)

Generic display function which handles local as well as remote clients.

The 'display' function is a replacement for 'str', in the sense that it will generate human-readable output. However, in contrast to 'str', it knows about what the front-end ('server') can display, and will adapt the output to that. For instance, if server.handles('latex_view') is true, it will generate LaTeX output, while it will generate just plain text otherwise.

Once it has figured out which display is accepted by 'server', it will call server.send() with data depending on the object type it is being fed. Data types the server object can support are:

  • "latex_view": text-mode LaTeX string.
  • "image_png": base64 encoded png image.
  • "image_svg": svg image.
  • "verbatim": ascii string to be displayed verbatim.
Generalised 'print' function which knows how to display objects in the 
best possible way on the used interface, be it a console or graphical
notebook. In particular, it knows how to display Cadabra expressions
in typeset form whenever LaTeX functionality is available. Can also be
used to display matplotlib plots.

When using a Cadabra front-end (command line or notebook), an expression
with a trailing semi-colon ';' will automatically be wrapped in a 
'display' function call so that the expression is displayed immediately.

◆ post_process()

def cadabra2_defaults.post_process (   __cdbkernel__,
  ex 
)

◆ save_history()

def cadabra2_defaults.save_history (   history_path)

Variable Documentation

◆ __cdbkernel__

cadabra2_defaults.__cdbkernel__ = cadabra2.__cdbkernel__
private

◆ callback

cadabra2_defaults.callback

◆ completer

cadabra2_defaults.completer

◆ console

cadabra2_defaults.console = Console()

◆ discr

string cadabra2_defaults.discr = "\\discretionary{}{}{} "

◆ displayhook

cadabra2_defaults.displayhook

◆ have_matplotlib

bool cadabra2_defaults.have_matplotlib = True

◆ have_plotly

bool cadabra2_defaults.have_plotly = True

◆ mclose

string cadabra2_defaults.mclose = "\\end{dmath*}";

◆ mopen

string cadabra2_defaults.mopen = "\\begin{dmath*}{}";

◆ PY3

int cadabra2_defaults.PY3 = 3

◆ remember_display_hook

cadabra2_defaults.remember_display_hook = sys.displayhook

◆ server

cadabra2_defaults.server

◆ unicode

cadabra2_defaults.unicode = str