Results class

class pymeasure.experiment.results.CSVFormatter(columns, delimiter=',')

Formatter of data results

format(record)

Formats a record as csv.

Parameters:

record (dict) – record to format.

Returns:

a string

class pymeasure.experiment.results.Results(procedure, data_filename)

The Results class provides a convenient interface to reading and writing data in connection with a Procedure object.

Variables:
  • COMMENT – The character used to identify a comment (default: #)

  • DELIMITER – The character used to delimit the data (default: ,)

  • LINE_BREAK – The character used for line breaks (default n)

  • CHUNK_SIZE – The length of the data chuck that is read

Parameters:
  • procedure – Procedure object

  • data_filename – The data filename where the data is or should be stored

format(data)

Returns a formatted string containing the data to be written to a file

header()

Returns a text header to accompany a datafile so that the procedure can be reconstructed

labels()

Returns the columns labels as a string to be written to the file

static load(data_filename, procedure_class=None)

Returns a Results object with the associated Procedure object and data

parse(line)

Returns a dictionary containing the data from the line

static parse_header(header, procedure_class=None)

Returns a Procedure object with the parameters as defined in the header text.

reload()

Preforms a full reloading of the file data, neglecting any changes in the comments

pymeasure.experiment.results.unique_filename(directory, prefix='DATA', suffix='', ext='csv', dated_folder=False, index=True, datetimeformat='%Y-%m-%d')

Returns a unique filename based on the directory and prefix