Cadabra
Computer algebra system for field theory problems
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions | Variables
cadabra2_defaults Namespace Reference

Classes

class  Sympy
 Stub object for when Sympy itself is not available. More...
 
class  Server
 Object to handle advanced display in a UI-independent way. More...
 

Functions

def display
 Generic display function which handles local as well as remote clients. More...
 
def _displayhook
 
def post_process
 

Variables

 __cdbkernel__ = cadabra2.__cdbkernel__
 
string mopen = "\\begin{dmath*}{}"
 
string mclose = "\\end{dmath*}"
 
 have_matplotlib = True
 
 remember_display_hook = sys.displayhook
 

Function Documentation

def cadabra2_defaults._displayhook (   arg)
private
def cadabra2_defaults.display (   obj,
  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.
  • "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.
    
def cadabra2_defaults.post_process (   __cdbkernel__,
  ex 
)

Variable Documentation

cadabra2_defaults.__cdbkernel__ = cadabra2.__cdbkernel__
cadabra2_defaults.have_matplotlib = True
string cadabra2_defaults.mclose = "\\end{dmath*}"
string cadabra2_defaults.mopen = "\\begin{dmath*}{}"
cadabra2_defaults.remember_display_hook = sys.displayhook