fluiddyn.io.in_py

IO for python files containing data (fluiddyn.io.in_py)

fluiddyn.io.in_py.save_in_py(path, variables, names=None)[source]

Save data in variables in the file path.

Parameters:
pathstr

Path of the file where the data are saved (has to end with ‘.py’).

variablesdict

Contains the variables to be saved.

namesNone or sequence of str.

If None, all variables in variables are saved, else, only the variables with name in names of the variables to be saved.

Examples

a = 1
b = 'str'
c = np.ones(2)

save_in_py('myfile.py', locals(), ('a', 'b', 'c'))

or from a dictionary:

d = {'a': 1, 'b': 'str', 'c': np.ones(2)}
save_in_py('myfile.py', d)

Functions

save_in_py(path, variables[, names])

Save data in variables in the file path.