Miscellaneous

class rascaline.RascalError(message, status=None)

Exceptions thrown for all errors in rascaline.

message

str, error message for this exception

status

Optional[int], status code for this exception

rascaline.set_logging_callback(function)

Call function on every log event.

The callback functions should take two arguments: an integer value representing the log level and a string containing the log message. The function return value is ignored.

rascaline.log.default_logging_callback(level, message)

Redirect message to the logging module.

class rascaline.Profiler

Profiler recording execution time of rascaline functions.

Rascaline uses the time_graph to collect timing information on the calculations. The Profiler class can be used as a context manager to access to this functionality.

The profiling code collects the total time spent inside the most important functions, as well as the function call graph (which function called which other function).

import rascaline

with rascaline.Profiler() as profiler:
    # run some calculations
    ...

print(profiler.as_short_table())
as_json()

Get current profiling data formatted as JSON.

as_table()

Get current profiling data formatted as a table.

as_short_table()

Get current profiling data formatted as a table, using short functions names.