solidipes.loaders package

Submodules

Module contents

class solidipes.loaders.Abaqus(**kwargs)[source]

Bases: CodeSnippet

elements(part)[source]
property mesh
property meshes
nodes(part)[source]
property parts
property structure
supported_mime_types = {'application/fem/abaqus': 'inp'}

List of supported mime types. Override in subclasses.

property xml
class solidipes.loaders.Binary(**kwargs)[source]

Bases: File

File of unsupported type

_valid_extension()[source]
property text
class solidipes.loaders.CachedMetadata(**kwargs)[source]

Bases: DataContainer

classmethod _cancel_scheduled_commit()[source]

Cancel scheduled commit

classmethod _commit()[source]

Update cached metadata database

_get_default_cached_attributes() set[source]

Build the list of cached fields from the class description

classmethod _get_zodb_file_storage(path: str) FileStorage[source]
_global_cached_metadata = None
classmethod _init_cached_metadata(initial_path='.')[source]
classmethod _populate_cached_metadata_from_yaml(initial_path='.')[source]

Populate cached metadata from YAML file

classmethod _schedule_commit()[source]

Schedule later update of metadata database

_scheduled_commit = None
_scheduler = <sched.scheduler object>
_storage = None
_transaction_manager = <transaction._manager.TransactionManager object>
classmethod _write_cached_metadata_to_yaml(initial_path='.')[source]

Write cached metadata to YAML file

class cached_loadable(func)

Bases: loadable

Decorator class to indicate that a loadable must be cached

foo(obj, *args, **kwargs)
foo_setter(obj, value, *args, **kwargs)
class cached_property(fget=None, fset=None, fdel=None, doc=None)

Bases: property

Decorator class to indicate that a property must be cached

classmethod clear_cache()[source]
clear_cached_metadata(fields=[])[source]
classmethod close_cached_metadata()[source]
get_cached_metadata()[source]
static get_global_cached_metadata() OOBTree[source]
property global_cached_metadata: OOBTree
is_cache_invalid()[source]
load_cached_metadata()[source]

Load cached metadata and put in _data_collection (as attributes)

property modified_time[source]
save_field_to_cache(key)[source]
set_cached_metadata_entry(key, value)[source]
update_cached_metadata()[source]

Update cached metadata with instance’s fields listed in cached_attributes

classmethod update_global_cached_metadata(unique_identifier=None)[source]

Update cached metadata dictionary

class solidipes.loaders.CodeSnippet(**kwargs)[source]

Bases: Text

_valid_loading()[source]
property lint
property lint_errors
property lint_raw
supported_mime_types = {'application/mathematica-notebook': ['nb'], 'program/C': ['c', 'h'], 'program/C++': ['cc', 'cpp', 'hh'], 'program/matlab': ['m'], 'program/xfig': ['fig', 'xfig'], 'text/x-script.python': 'py', 'text/x-sh': 'sh', 'text/x-shellscript': 'sh', 'text/x-tex': ['tex', 'latex', 'sty']}

List of supported mime types. Override in subclasses.

property text
class solidipes.loaders.DataContainer(initial_data={}, name=None, unique_identifier=None, **kwargs)[source]

Bases: object

Container class for other structured data containers

_data_collection

Dictionary of other DataContainer or arbitrary objects. Set entry to “None” to mark as loadable.

_has_native_attr(key)[source]

Check if attribute is present, outside of _data_collection, without using __getattr__

_valid_loading()[source]
add(key, data=None)[source]

Add an arbitrary object to the data collection

copy()[source]

Returns a shallow copy without the need to read from disk again

property data

Load all data if necessary and return it

Accessing this property for the first time will load the data. If self.__loaded_data has only one entry, returns it directly.

Override the _load_data method in subclasses to define how data is loaded or built using other data containers.

property data_info

Returns a multi-line string with information about data keys

default_viewer

Default viewer for this file. Optionally override this in subclasses.

errors

stores the error messages during loading

get(key)[source]

Get a data object by key, loading it if necessary

has(key)[source]

Check if data is available in this container

load_all(*args, **kwargs)[source]
class loadable(func)

Bases: property

foo(obj, *args, **kwargs)
foo_setter(obj, value, *args, **kwargs)
remove(key)[source]

Remove a data object from the data collection

view(**kwargs)[source]

View the file using the default viewer

class solidipes.loaders.File(path=None)[source]

Bases: CachedMetadata, DataContainer

Abstract container class for file metadata

A File can be read from disk and may contain multiple DataContainer entries.

classmethod _supported_extensions()[source]
_valid_extension()[source]
_valid_loading()[source]
_valid_non_empty()[source]
add_message(author, msg)[source]
archive_discussions(flag=True)[source]
property archived_discussions
classmethod check_file_support(path)[source]

Check mime type, then extension of file

property discussions
property file_info
property file_stats
property modified_time
property preferred_loader_name
supported_mime_types = {}

List of supported mime types. Override in subclasses.

property valid_loading
class solidipes.loaders.FileSequence(pattern, paths)[source]

Bases: Sequence, CachedMetadata, Group

Sequence of files

_abc_impl = <_abc._abc_data object>
static _find_groups(is_dir_path_dict: dict[str, bool]) dict[str, list[str]][source]

Find groups of file and directory names.

From a list of file and directory names (on a single level), return a dictionary with - key: pattern, - value: list of file and directory names that belong to the group.

_load_element(n)[source]

Must raise KeyError if element does not exist

Override this method in subclasses.

_set_total_size()[source]
property modified_time
property paths
select_file(n)[source]
class solidipes.loaders.GeofMesh(**kwargs)[source]

Bases: PyvistaMesh

Mesh file loaded with pyvista

property mesh
supported_mime_types = {'meshing/z-set': 'geof'}

List of supported mime types. Override in subclasses.

class solidipes.loaders.GnuPlot(**kwargs)[source]

Bases: CodeSnippet

property image
supported_mime_types = {'drawing/gnuplot': ['gp', 'gpu', 'gih']}

List of supported mime types. Override in subclasses.

class solidipes.loaders.Group(pattern: str, paths: list[str], **kwargs)[source]

Bases: ABC

Group of files and directories.

_abc_impl = <_abc._abc_data object>
abstract static _find_groups(is_dir_path_dict: dict[str, bool]) dict[str, list[str]][source]

Find groups of file and directory names.

From a list of file and directory names (on a single level), return a dictionary with - key: pattern, - value: list of file and directory names that belong to the group.

class solidipes.loaders.HDF5(**kwargs)[source]

Bases: File

HDF5 loader

property datasets
supported_mime_types = {'application/x-hdf': ['h5', 'hdf5'], 'application/x-hdf5': ['hdf', 'h5', 'hdf5']}

List of supported mime types. Override in subclasses.

class solidipes.loaders.Image(**kwargs)[source]

Bases: File

Image loaded with PIL

property exif_data
get_exif_data()[source]
property image
supported_mime_types = {'application/postscript': ['eps', 'ps'], 'image/aces': ['exr'], 'image/apng': ['apng'], 'image/avci': ['avci'], 'image/avcs': ['avcs'], 'image/avif': ['avif', 'hif'], 'image/bmp': ['bmp'], 'image/cgm': ['cgm'], 'image/dicom-rle': ['drle'], 'image/dpx': ['dpx'], 'image/emf': ['emf'], 'image/example': [], 'image/fits': ['fits', 'fit', 'fts'], 'image/g3fax': [], 'image/gif': ['gif'], 'image/heic': ['heic'], 'image/heic-sequence': ['heics'], 'image/heif': ['heif'], 'image/heif-sequence': ['heifs'], 'image/hej2k': ['hej2'], 'image/hsj2': ['hsj2'], 'image/ief': ['ief'], 'image/jls': ['jls'], 'image/jp2': ['jp2', 'jpg2'], 'image/jpeg': ['jpeg', 'jpg', 'jpe', 'jfif'], 'image/jph': ['jph'], 'image/jphc': ['jhc', 'jphc'], 'image/jpm': ['jpm', 'jpgm'], 'image/jpx': ['jpx', 'jpf'], 'image/jxl': ['jxl'], 'image/jxr': ['jxr'], 'image/jxrA': ['jxra'], 'image/jxrS': ['jxrs'], 'image/jxs': ['jxs'], 'image/jxsc': ['jxsc'], 'image/jxsi': ['jxsi'], 'image/jxss': ['jxss'], 'image/ktx': ['ktx'], 'image/ktx2': ['ktx2'], 'image/naplps': [], 'image/png': ['png'], 'image/prs.btif': ['btif', 'btf'], 'image/prs.pti': ['pti'], 'image/pwg-raster': [], 'image/svg+xml': ['svg', 'svgz'], 'image/t38': [], 'image/tiff': ['tiff', 'tif'], 'image/tiff-fx': ['tfx'], 'image/vnd.adobe.photoshop': ['psd'], 'image/vnd.airzip.accelerator.azv': ['azv'], 'image/vnd.cns.inf2': [], 'image/vnd.dece.graphic': ['uvi', 'uvvi', 'uvg', 'uvvg'], 'image/vnd.djvu': ['djvu', 'djv'], 'image/vnd.dvb.subtitle': [], 'image/vnd.dwg': ['dwg'], 'image/vnd.dxf': ['dxf'], 'image/vnd.fastbidsheet': ['fbs'], 'image/vnd.fpx': ['fpx'], 'image/vnd.fst': ['fst'], 'image/vnd.fujixerox.edmics-mmr': ['mmr'], 'image/vnd.fujixerox.edmics-rlc': ['rlc'], 'image/vnd.globalgraphics.pgb': ['PGB', 'pgb'], 'image/vnd.microsoft.icon': ['ico'], 'image/vnd.mix': [], 'image/vnd.ms-modi': ['mdi'], 'image/vnd.net-fpx': [], 'image/vnd.pco.b16': ['b16'], 'image/vnd.radiance': ['hdr', 'rgbe', 'xyze'], 'image/vnd.sealed.png': ['spng', 'spn', 's1n'], 'image/vnd.sealedmedia.softseal.gif': ['sgif', 'sgi', 's1g'], 'image/vnd.sealedmedia.softseal.jpg': ['sjpg', 'sjp', 's1j'], 'image/vnd.svf': [], 'image/vnd.tencent.tap': ['tap'], 'image/vnd.valve.source.texture': ['vtf'], 'image/vnd.wap.wbmp': ['wbmp'], 'image/vnd.xiff': ['xif'], 'image/vnd.zbrush.pcx': ['pcx'], 'image/webp': ['webp'], 'image/wmf': ['wmf'], 'image/x-canon-cr2': ['cr2'], 'image/x-canon-crw': ['crw'], 'image/x-cmu-raster': ['ras'], 'image/x-coreldraw': ['cdr'], 'image/x-coreldrawpattern': ['pat'], 'image/x-coreldrawtemplate': ['cdt'], 'image/x-corelphotopaint': ['cpt'], 'image/x-epson-erf': ['erf'], 'image/x-jg': ['art'], 'image/x-jng': ['jng'], 'image/x-nikon-nef': ['nef'], 'image/x-olympus-orf': ['orf'], 'image/x-portable-anymap': ['pnm'], 'image/x-portable-bitmap': ['pbm'], 'image/x-portable-graymap': ['pgm'], 'image/x-portable-pixmap': ['ppm'], 'image/x-rgb': ['rgb'], 'image/x-xbitmap': ['xbm'], 'image/x-xcf': ['xcf'], 'image/x-xpixmap': ['xpm'], 'image/x-xwindowdump': ['xwd']}

List of supported mime types. Override in subclasses.

class solidipes.loaders.Markdown(**kwargs)[source]

Bases: Text

Markdown file

supported_mime_types = {'text/markdown': 'md'}

List of supported mime types. Override in subclasses.

class solidipes.loaders.MatlabData(**kwargs)[source]

Bases: File

Matlab .mat file

property arrays
supported_mime_types = {'application/x-matlab-data': 'mat'}

List of supported mime types. Override in subclasses.

class solidipes.loaders.Meshio(**kwargs)[source]

Bases: File

File loaded with meshio

property mesh
class solidipes.loaders.Notebook(**kwargs)[source]

Bases: File

Notebook file, in Jupyter style

property notebook
supported_mime_types = {'application/jupyter-notebook': 'ipynb'}

List of supported mime types. Override in subclasses.

class solidipes.loaders.PDF(**kwargs)[source]

Bases: File

Image loaded as base64

property pdf
supported_mime_types = {'application/pdf': 'pdf'}

List of supported mime types. Override in subclasses.

class solidipes.loaders.PyvistaMesh(**kwargs)[source]

Bases: File

Mesh file loaded with pyvista

add_cell_data(array, name)[source]
add_point_data(array, name)[source]
property cell_data_names
copy_pyvista_data_to_collection()[source]

Add pyvista data to data collection

property data_info

Trigger loading of Pyvista mesh and return info

default_viewer

Fully loaded pyvista mesh

get_cell_data(name)[source]
get_point_data(name)[source]
get_warped(data_id, factor=1.0)[source]

Returns another PyvistaMesh with the mesh points displaced by the given data.

Parameters:
  • data (string) – Name of point data. If data is 1D, the mesh is warped along its normals. Otherwise, the data must have the same number dimensionality as the mesh.

  • factor (float) – Factor to multiply the displacements by. Defaults to 1.0.

property mesh
property point_data_names
property pyvista_mesh
remove_cell_data(name)[source]
remove_point_data(name)[source]
set_cell_values(data_id)[source]

Sets the cell values for plotting to the given data.

Parameters:

data (string) – Name of cell data.

set_point_values(data_id)[source]

Sets the point values for plotting to the given data.

Parameters:

data (string) – Name of point data.

supported_mime_types = {'meshing/AVS': 'avs', 'meshing/GMSH': 'msh', 'meshing/StepFile': 'stl', 'meshing/VTK': ['vtu', 'pvtu', 'vtk']}

List of supported mime types. Override in subclasses.

Bases: File

Symbolic link (special file)

_valid_loading()[source]
property linked_file
class solidipes.loaders.TIKZ(**kwargs)[source]

Bases: CodeSnippet

property pdf
supported_mime_types = {'latex/tikz': 'tikz'}

List of supported mime types. Override in subclasses.

class solidipes.loaders.Table(**kwargs)[source]

Bases: File

Table file loaded with Pandas

property header
read_csv(fname, **kwargs)[source]
read_numpy(fname, **kwargs)[source]
supported_mime_types = {'application/numpy/array': 'npy', 'application/vnd.ms-excel': 'xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'xlsx', 'text/csv': 'csv'}

List of supported mime types. Override in subclasses.

property table
validate_header(header)[source]
class solidipes.loaders.Text(**kwargs)[source]

Bases: File

Text file, potentially formatted with markdown

supported_mime_types = {'application/lammps': ['in', 'data'], 'text/plain': 'txt'}

List of supported mime types. Override in subclasses.

property text
class solidipes.loaders.Video(**kwargs)[source]

Bases: File

Video file

supported_mime_types = {'video/1d-interleaved-parityfec': [], 'video/3gpp': [], 'video/3gpp-tt': [], 'video/3gpp2': [], 'video/AV1': [], 'video/BMPEG': [], 'video/BT656': [], 'video/CelB': [], 'video/DV': [], 'video/FFV1': [], 'video/H261': [], 'video/H263': [], 'video/H263-1998': [], 'video/H263-2000': [], 'video/H264': [], 'video/H264-RCDO': [], 'video/H264-SVC': [], 'video/H265': [], 'video/H266': [], 'video/JPEG': [], 'video/MP1S': [], 'video/MP2P': [], 'video/MP2T': [], 'video/MP4V-ES': [], 'video/MPV': [], 'video/SMPTE292M': [], 'video/VP8': [], 'video/VP9': [], 'video/annodex': ['axv'], 'video/dv': ['dif', 'dv'], 'video/encaprtp': [], 'video/example': [], 'video/flexfec': [], 'video/fli': ['fli'], 'video/gl': ['gl'], 'video/iso.segment': ['m4s'], 'video/jpeg2000': [], 'video/jxsv': [], 'video/mj2': ['mj2', 'mjp2'], 'video/mp4': ['mp4', 'mpg4', 'm4v'], 'video/mpeg': ['mpeg', 'mpg', 'mpe', 'm1v', 'm2v'], 'video/mpeg4-generic': [], 'video/nv': [], 'video/ogg': ['ogv'], 'video/parityfec': [], 'video/pointer': [], 'video/quicktime': ['qt', 'mov'], 'video/raptorfec': [], 'video/raw': [], 'video/rtp-enc-aescm128': [], 'video/rtploopback': [], 'video/rtx': [], 'video/scip': [], 'video/smpte291': [], 'video/ulpfec': [], 'video/vc1': [], 'video/vc2': [], 'video/vnd.CCTV': [], 'video/vnd.dece.hd': ['uvh', 'uvvh'], 'video/vnd.dece.mobile': ['uvm', 'uvvm'], 'video/vnd.dece.mp4': ['uvu', 'uvvu'], 'video/vnd.dece.pd': ['uvp', 'uvvp'], 'video/vnd.dece.sd': ['uvs', 'uvvs'], 'video/vnd.dece.video': ['uvv', 'uvvv'], 'video/vnd.directv.mpeg': [], 'video/vnd.directv.mpeg-tts': [], 'video/vnd.dlna.mpeg-tts': [], 'video/vnd.dvb.file': ['dvb'], 'video/vnd.fvt': ['fvt'], 'video/vnd.hns.video': [], 'video/vnd.iptvforum.1dparityfec-1010': [], 'video/vnd.iptvforum.1dparityfec-2005': [], 'video/vnd.iptvforum.2dparityfec-1010': [], 'video/vnd.iptvforum.2dparityfec-2005': [], 'video/vnd.iptvforum.ttsavc': [], 'video/vnd.iptvforum.ttsmpeg2': [], 'video/vnd.motorola.video': [], 'video/vnd.motorola.videop': [], 'video/vnd.mpegurl': ['mxu', 'm4u'], 'video/vnd.ms-playready.media.pyv': ['pyv'], 'video/vnd.nokia.interleaved-multimedia': ['nim'], 'video/vnd.nokia.mp4vr': [], 'video/vnd.nokia.videovoip': [], 'video/vnd.objectvideo': [], 'video/vnd.radgamettools.bink': ['bik', 'bk2'], 'video/vnd.radgamettools.smacker': ['smk'], 'video/vnd.sealed.mpeg1': ['smpg', 's11'], 'video/vnd.sealed.mpeg4': ['s14'], 'video/vnd.sealed.swf': ['sswf', 'ssw'], 'video/vnd.sealedmedia.softseal.mov': ['smov', 'smo', 's1q'], 'video/vnd.uvvu.mp4': [], 'video/vnd.vivo': ['viv'], 'video/vnd.youtube.yt': ['yt'], 'video/webm': ['webm'], 'video/x-flv': ['flv'], 'video/x-la-asf': ['lsf', 'lsx'], 'video/x-matroska': ['mpv', 'mkv'], 'video/x-mng': ['mng'], 'video/x-ms-wm': ['wm'], 'video/x-ms-wmv': ['wmv'], 'video/x-ms-wmx': ['wmx'], 'video/x-ms-wvx': ['wvx'], 'video/x-msvideo': ['avi'], 'video/x-sgi-movie': ['movie']}

List of supported mime types. Override in subclasses.

property video
class solidipes.loaders.XDMF(**kwargs)[source]

Bases: Sequence, XML

property _element_count
_load_element(n)[source]

Load a single frame

_load_hdf5_data_item(item)[source]
_load_xdmf_data_item(item)[source]
property domain
find_dataitem_from_ref(ref)[source]
property grid
property grids
property mesh
property mesh_name
property n_frames
select_frame(frame)[source]
supported_mime_types = {'mesh/XDMF': 'xdmf'}

List of supported mime types. Override in subclasses.

property version
property xdmf
class solidipes.loaders.XML(**kwargs)[source]

Bases: Text

supported_mime_types = {'application/paraview/state': 'xml', 'application/xml': 'xml', 'text/xml': 'xml'}

List of supported mime types. Override in subclasses.

property xml
solidipes.loaders.load_file(path)[source]

Load a file from path into the appropriate object type

solidipes.loaders.load_groups(is_dir_path_dict: dict[str, bool], root_path: str) tuple[dict[str, Group], dict[str, bool]][source]

Load groups of files and directories.

Return a dictionary of {pattern: loaded groups} and a dictionary with the remaining file and directory names.