class mhi.pscad.utilities.clipboard.Clipboard

This Clipboard class allows saving Device Independent Bitmaps (DIBs) to a file

classmethod getFormatName(fmt)

Convert a format identifier (integer) to a readable name

classmethod saveBitmap(filename)

Save the clipboard contents as a Device Independent Bitmap (DIB)

Returns True if successful, or False if the clipboard does not contain DIB content.


class mhi.pscad.utilities.file.File

Useful File utilities

static compare_files(file1, file2)

Compares two text files. Return True if the contents match.

static move_files(src_dir, dest_dir, *exts)

Copies files from the source directory to a destination directory.

The destination directory must not exist; it will be created. Only files which match the given extension(s) are copied.

static copy_files(src_dir, dst_dir, *exts, recursive=False)

Copies files from the source directory to a destination directory.

Only files matching the given extensions are copied. If no extensions are given, all files are copied.

If recursive is True, subdirectories are copied.

static copy_file(file, dest_dir)

Copies a file to the destination directory

static convert_out_to_csv(directory, out_file, csv_file)

Converts PSCAD output file into a csv file

class mhi.pscad.utilities.file.OutFile(basename)

PSCAD Output files utility class


Construct an instance which can manipulate a set of PSCAD output files (<basename>.inf, & <basename>_##.out)


Open all of the internal data files


Close all of the internal data files


Return next row of data, read from all *.out data files


All of the columns in the datafile


Turn a column name into a number


Turn a column number into a column name

toCSV(csv=None, columns=None, start=0, end=inf)

Convert OutFile into a Comma Separated Value (CSV) file

If no csv file is specified, defaults to “<basename>.csv”. If no column names are specified, defaults to all columns. If no start time is given, defaults to start of file. If no end time is given, defaults to end of file.

values_at(time: float, *columns: str, as_dict=False) Union[List[float], Dict[str, float]]

Fetch one or more values from a specific moment in time.

Values from the row in the datafile closest to the given time are returned. If no column names are specified, all columns are returned.

  • time (float) – The desired time to retrieve the column values at

  • columns (List[str]) – the columns to retrieve the values for (optional)

  • as_dict (bool) – Set to true to return a column name=value dictionary (optional)


A list or a dictionary of column values, as indicated by as_dict


E-Mail Helper Utility

class mhi.pscad.utilities.mail.Mail

E-Mail Helper Utility

static send_gmail(sender: str, password: str, recipients: list, subject: str, body: str, attachments: list = None)

Sends a document using a GMail account

static send_outlook_mail(recipients: list, subject: str, body: str, attachments: list = None)

Sends a document using a Microsoft Outlook account


Microsoft Word Document Helper

class mhi.pscad.utilities.word.Word

Microsoft Word Document helper


Adds a Page Break to the current document

textParagraph(text, size=None, bold=None)

Adds a paragraph to the current document


Adds an image from the clipboard to the current document

save(filename=None, close=False)

Save (and possibly close) the current document


Close the current document


Opens the given document


Creates a new document