libscifig API

Tasks

A Task is composed of the following steps:

  1. Transform the source files to a tex file
  2. convert tex to pdf with _tex_to_pdf()
  3. convert pdf to svg with _pdf_to_svg()
  4. convert pdf to eps with _pdf_to_eps()
  5. convert pdf to png with _pdf_to_png()

Step 1 can be complex and could require several sub-steps. Thus, the role of _pre_make() is to do all these sub-steps.

Steps 2 to 5 usually do not depend on the initial type of the task. The function make() do all of them.

Each format has its own export function. The function export() exports all of them.

class task.GnuplotTask(filepath, datafiles=[], tikzsnippet=False, tikzsnippet1=False, tikzsnippet2=False, build='build')[source]

Bases: task.Task

Gnuplot Task manager.

check_dependencies(db)

Check if dependencies have been modified.

Parameters:dbDataBase instance
check_targets(db, pdf_only=False)

Check if targets have been modified.

Parameters:
  • dbDataBase instance
  • pdf_only – Check only the status for pdf
export(db, dst='/tmp')

Export built files.

Parameters:
  • dbDataBase instance
  • dst – filepath of the destination directory
export_eps(dst='/tmp')

Export built EPS files.

Parameters:dst – filepath of the destination directory
export_pdf(dst='/tmp')

Export built PDF files.

Parameters:dst – filepath of the destination directory
export_png(dst='/tmp')

Export built png files.

Parameters:dst – filepath of the destination directory
export_svg(dst='/tmp')

Export built SVG files.

Parameters:dst – filepath of the destination directory
export_tex(dst='/tmp')

Export TEX files.

Parameters:dst – filepath of the destination directory
get_name()

Return the name of the task.

make(db)

Compile the figure in all formats.

make_pdf(db)

Compile the figure in pdf.

class task.Task(filepath, build='build')[source]

Bases: object

Parent Task manager.

Parameters:
  • filepath – filepath of the main file
  • build – relative filepath of the build dir
check_dependencies(db)[source]

Check if dependencies have been modified.

Parameters:dbDataBase instance
check_targets(db, pdf_only=False)[source]

Check if targets have been modified.

Parameters:
  • dbDataBase instance
  • pdf_only – Check only the status for pdf
export(db, dst='/tmp')[source]

Export built files.

Parameters:
  • dbDataBase instance
  • dst – filepath of the destination directory
export_eps(dst='/tmp')[source]

Export built EPS files.

Parameters:dst – filepath of the destination directory
export_pdf(dst='/tmp')[source]

Export built PDF files.

Parameters:dst – filepath of the destination directory
export_png(dst='/tmp')[source]

Export built png files.

Parameters:dst – filepath of the destination directory
export_svg(dst='/tmp')[source]

Export built SVG files.

Parameters:dst – filepath of the destination directory
export_tex(dst='/tmp')[source]

Export TEX files.

Parameters:dst – filepath of the destination directory
get_name()[source]

Return the name of the task.

make(db)[source]

Compile the figure in all formats.

make_pdf(db)[source]

Compile the figure in pdf.

class task.TikzTask(filepath, datafiles=[], build='build')[source]

Bases: task.Task

Tikz Task manager.

check_dependencies(db)

Check if dependencies have been modified.

Parameters:dbDataBase instance
check_targets(db, pdf_only=False)

Check if targets have been modified.

Parameters:
  • dbDataBase instance
  • pdf_only – Check only the status for pdf
export(db, dst='/tmp')

Export built files.

Parameters:
  • dbDataBase instance
  • dst – filepath of the destination directory
export_eps(dst='/tmp')

Export built EPS files.

Parameters:dst – filepath of the destination directory
export_pdf(dst='/tmp')

Export built PDF files.

Parameters:dst – filepath of the destination directory
export_png(dst='/tmp')

Export built png files.

Parameters:dst – filepath of the destination directory
export_svg(dst='/tmp')

Export built SVG files.

Parameters:dst – filepath of the destination directory
export_tex(dst='/tmp')

Export TEX files.

Parameters:dst – filepath of the destination directory
get_name()

Return the name of the task.

make(db)

Compile the figure in all formats.

make_pdf(db)

Compile the figure in pdf.

database

class database.DataBase(db_path)[source]

Bases: object

Custom class to manipulate a json database.

Parameters:db_path – filepath of the database.
get(name, obj)[source]

Get a content from a tree (name–object).

Parameters:
  • name – ID of the element, like filepath
  • obj – Content type (like deps, targets...)
set(name, obj, content)[source]

Set a content to a tree (name–object).

Parameters:
  • name – ID of the element, like filepath
  • obj – Content type (like deps, targets...)
  • content – Content to store, a dict.

detector

detector.detect_datafile(plt, root)[source]

Detect datafiles associated with a plt file.

Parameters:
  • plt – plt filepath
  • root – root filepath
Returns:

list of filepath starting at root

detector.detect_task(directory, root_path)[source]

Detect the task to do depending on file extensions.

Parameters:directory – directory to look at
Returns:list of tasks
detector.detect_tikzsnippets(plt)[source]

Detect tikzsnippets associated with a plt file.

Parameters:plt – plt filepath
Returns:tuple of 2 booleans

collogging