libscifig API¶
Tasks¶
A Task
is composed of the following steps:
- Transform the source files to a tex file
- convert tex to pdf with
_tex_to_pdf()
- convert pdf to svg with
_pdf_to_svg()
- convert pdf to eps with
_pdf_to_eps()
- 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: db – DataBase instance
-
check_targets
(db, pdf_only=False)¶ Check if targets have been modified.
Parameters: - db – DataBase instance
- pdf_only – Check only the status for pdf
-
export
(db, dst='/tmp')¶ Export built files.
Parameters: - db – DataBase 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: db – DataBase instance
-
check_targets
(db, pdf_only=False)[source]¶ Check if targets have been modified.
Parameters: - db – DataBase instance
- pdf_only – Check only the status for pdf
-
export
(db, dst='/tmp')[source]¶ Export built files.
Parameters: - db – DataBase 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
-
class
task.
TikzTask
(filepath, datafiles=[], build='build')[source]¶ Bases:
task.Task
Tikz Task manager.
-
check_dependencies
(db)¶ Check if dependencies have been modified.
Parameters: db – DataBase instance
-
check_targets
(db, pdf_only=False)¶ Check if targets have been modified.
Parameters: - db – DataBase instance
- pdf_only – Check only the status for pdf
-
export
(db, dst='/tmp')¶ Export built files.
Parameters: - db – DataBase 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.
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