plotting

class PlotOutput(*args, **kwargs)[source]

Bases: pimlico.datatypes.files.NamedFileCollection

Output from matplotlib plotting.

Contains the dataset being plotted, a script to build the plot, and the output PDF.

datatype_supports_python2 = True
class Writer(*args, **kwargs)[source]

Bases: pimlico.datatypes.files.Writer

Writes out source data, a Python script for the plotting using Matplotlib and a PDF of the resulting plot, if the script completes successfully.

This approach means that a plot is produced immediately, but can easily be tweaked and customized for later use elsewhere by copying and editing the Python plotting script.

Use writer.write_file("data.csv", text=True) to write the source data and writer.write_file("plot.py", text=True) to write the plotting script, which should output a file plot.pdf. Then call writer.plot() to execute the script. If this fails, at least the other files are there so the user can correct the errors and use them if they want.

plot()[source]

Runs the plotting script. Errors are not caught, so if there’s a problem in the script they’ll be raised.

data_path
code_path
plot_path
metadata_defaults = {}
writer_param_defaults = {}
class Reader(datatype, setup, pipeline, module=None)

Bases: pimlico.datatypes.base.Reader

Reader class for NamedFileCollection

class Setup(datatype, data_paths)

Bases: pimlico.datatypes.base.Setup

Setup class for NamedFileCollection.Reader

get_required_paths()

May be overridden by subclasses to provide a list of paths (absolute, or relative to the data dir) that must exist for the data to be considered ready.

reader_type

alias of NamedFileCollection.Reader

absolute_filenames

For backwards compatibility: use absolute_paths by preference

absolute_paths
get_absolute_path(filename)
open_file(filename=None, mode='r')
process_setup()

Do any processing of the setup object (e.g. retrieving values and setting attributes on the reader) that should be done when the reader is instantiated.

read_file(filename=None, mode='r', text=False)

Read a file from the collection.

Parameters:
  • filename – string filename, which should be one of the filenames specified for this collection; or an integer, in which case the ith file in the collection is read. If not given, the first file is read
  • mode
  • text – if True, the file is treated as utf-8-encoded text and a unicode object is returned. Otherwise, a bytes object is returned.
Returns:

read_files(mode='r', text=False)