Cadabra
Computer algebra system for field theory problems
Loading...
Searching...
No Matches
cadabra2_defaults Namespace Reference

Classes

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

Functions

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

Variables

 __cdbkernel__ = cadabra2.__cdbkernel__
 
 completer
 
int PY3 = 3
 
 unicode = str
 
str discr = "\\discretionary{}{}{} "
 
str mopen = "\\begin{dmath*}{}";
 
str mclose = "\\end{dmath*}";
 
 server
 
bool have_matplotlib = True
 
 redisplay
 
 history_path = os.path.join(user_data_dir(), "cadabra_history")
 
 display
 
 console = Console()
 
 callback
 
 remember_display_hook = sys.displayhook
 
 displayhook
 

Function Documentation

◆ _displayhook()

cadabra2_defaults._displayhook ( arg)
protected

◆ display()

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.

◆ post_process()

cadabra2_defaults.post_process ( __cdbkernel__,
ex )

◆ save_history()

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

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

◆ display

cadabra2_defaults.display

◆ displayhook

cadabra2_defaults.displayhook

◆ have_matplotlib

bool cadabra2_defaults.have_matplotlib = True

◆ history_path

cadabra2_defaults.history_path = os.path.join(user_data_dir(), "cadabra_history")

◆ mclose

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

◆ mopen

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

◆ PY3

int cadabra2_defaults.PY3 = 3

◆ redisplay

cadabra2_defaults.redisplay

◆ remember_display_hook

cadabra2_defaults.remember_display_hook = sys.displayhook

◆ server

cadabra2_defaults.server

◆ unicode

cadabra2_defaults.unicode = str