class openpnm.io.MAT[source]

Bases: openpnm.io.GenericIO.GenericIO

MAT files are a format used by Matlab


The ‘mat’ file must contain data formatted as follows:

  1. The file can contain either or both pore and throat data.

2. The property names should be in the format of pore_volume or throat_surface_area. In OpenPNM the first ‘_’ will be replaced by a ‘.’ to give 'pore.volume' or 'throat.surface_area'.

3. Boolean data represented as 1’s and 0’s will be converted to the Python boolean True and False. These will become 'labels' in OpenPNM.

classmethod export_data(network, phases=[], filename='')[source]

Write Network to a Mat file for exporting to Matlab.

  • network (OpenPNM Network Object) –

  • filename (string) – Desired file name, defaults to network name if not given

  • phases (list of phase objects ([])) – Phases that have properties we want to write to file

classmethod import_data(filename, project=None)[source]

Loads data from an appropriately formatted ‘mat’ file (i.e. MatLAB output).

  • filename (string (optional)) – The name of the file containing the data to import. The formatting of this file is outlined below.

  • project (OpenPNM Project object) – A GenericNetwork is created and added to the specified Project. If no Project object is supplied then one will be created and returned.


Return type

If no project object is supplied then one will be created and returned.

classmethod load(*args, **kwargs)[source]

This method is being deprecated. Using import_data instead.

classmethod save(*args, **kwargs)[source]

This method is being deprecated. Using export_data instead.