aeroframe.fileio package

Submodules

aeroframe.fileio.serialise module

Serialise and deserialise objects

aeroframe.fileio.serialise.dump_json_def_fields(filename, def_fields)

Dump a JSON deformation field

Args:
filename:(str) Output file name
def_fields:(array) Array of the displacement field
aeroframe.fileio.serialise.dump_pretty_json(obj, fp, *, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=<class 'commonlibs.fileio.json.NDArrayEncoder'>, indent=4, separators=(', ', ': '), default=None, sort_keys=False, **kw)

Serialize obj as a JSON formatted stream to fp (a .write()-supporting file-like object).

If skipkeys is true then dict keys that are not basic types (str, int, float, bool, None) will be skipped instead of raising a TypeError.

If ensure_ascii is false, then the strings written to fp can contain non-ASCII characters if they appear in strings contained in obj. Otherwise, all such characters are escaped in JSON strings.

If check_circular is false, then the circular reference check for container types will be skipped and a circular reference will result in an OverflowError (or worse).

If allow_nan is false, then it will be a ValueError to serialize out of range float values (nan, inf, -inf) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (NaN, Infinity, -Infinity).

If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation.

If specified, separators should be an (item_separator, key_separator) tuple. The default is (', ', ': ') if indent is None and (',', ': ') otherwise. To get the most compact JSON representation, you should specify (',', ':') to eliminate whitespace.

default(obj) is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError.

If sort_keys is true (default: False), then the output of dictionaries will be sorted by key.

To use a custom JSONEncoder subclass (e.g. one that overrides the .default() method to serialize additional types), specify it with the cls kwarg; otherwise JSONEncoder is used.

aeroframe.fileio.serialise.load_json_def_fields(filename)

Load a deformation field from a JSON file and return a deformation field

Args:
filename:(str) Output file name
Returns:
def_fields:(array) Array of the displacement field

aeroframe.fileio.settings module

File IO

class aeroframe.fileio.settings.PATHS

Bases: object

class DIRS

Bases: object

CFD = 'cfd'
STRUCTURE = 'structure'
class FILES

Bases: object

DEFAULT_SETTINGS = 'aeroframe_settings.json'
class GROUPS

Bases: object

CFD = 'cfd'
INIT = 'init'
STRUCTURE = 'structure'
class aeroframe.fileio.settings.Settings(root_dir=None, make_dirs=True)

Bases: object

get_wrappers()

Load wrapper modules dynamically

Args:
aeroframe_files:
 file structure of aeroframe program
init_dirs()

Create directories belonging to ‘init’ group

init_emtpy_settings_file(overwrite=False)

Create a settings file with default values

Args:
overwrite:(bool) If True, overwrite an existing settings file
load_root_settings()

Load and return the root settings file

Args:
aeroframe_files:
 file structure of aeroframe program
aeroframe.fileio.settings.dump_pretty_json(obj, fp, *, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=<class 'commonlibs.fileio.json.NDArrayEncoder'>, indent=4, separators=(', ', ': '), default=None, sort_keys=False, **kw)

Serialize obj as a JSON formatted stream to fp (a .write()-supporting file-like object).

If skipkeys is true then dict keys that are not basic types (str, int, float, bool, None) will be skipped instead of raising a TypeError.

If ensure_ascii is false, then the strings written to fp can contain non-ASCII characters if they appear in strings contained in obj. Otherwise, all such characters are escaped in JSON strings.

If check_circular is false, then the circular reference check for container types will be skipped and a circular reference will result in an OverflowError (or worse).

If allow_nan is false, then it will be a ValueError to serialize out of range float values (nan, inf, -inf) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (NaN, Infinity, -Infinity).

If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation.

If specified, separators should be an (item_separator, key_separator) tuple. The default is (', ', ': ') if indent is None and (',', ': ') otherwise. To get the most compact JSON representation, you should specify (',', ':') to eliminate whitespace.

default(obj) is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError.

If sort_keys is true (default: False), then the output of dictionaries will be sorted by key.

To use a custom JSONEncoder subclass (e.g. one that overrides the .default() method to serialize additional types), specify it with the cls kwarg; otherwise JSONEncoder is used.

Module contents