io
Submodule handling the input/output operations.
load_pullf(pullf_files)
¶
Load filenames and resturns them as list.
Filenames can be taken from file or glob them from globpattern.
Parameters:
-
pullf_files
(Str
) –file which contains
pullf
filenames or globpattern
Returns:
-
filenames
((List[Str], Str1DArray)
) –list/array of filenames
Examples:
>>> from dcTMD.io import load_pullf
>>> # load filenames form file
>>> filenames = load_pullf('pullf_files.txt')
>>> # load filenames with glob pattern
>>> filenames = load_pullf('data/*.pullf.xvg')
Source code in src/dcTMD/io.py
write_output(out, estimator, filetype=('dat', 'npz'))
¶
Take all calculated quantities and save them.
Parameters:
-
out
(Str
) –Output name. By default f'{out}_N{n_traj}'
-
estimator
–Either a ForceEstimator or WorkEstimator instance.
-
filetype
–Output filetype, either 'dat', 'npz' or both ('dat', 'npz').
Examples:
>>> from dcTMD.storing import load
>>> from dcTMD.io import write_output
>>> from dcTMD.dcTMD import WorkEstimator
>>> # Save the results from WorkEstimator
>>> # (ForceEstimator works similarly)
>>> # calculate dcTMD results from workset
>>> work = load('my_work_set')
>>> work_estimator = WorkEstimator(temperature=290.15)
>>> work_estimator.fit(work)
>>> out = 'my_dcTMD_results'
>>> # save results as 'npz' file
>>> write_output(out, work_estimator, filetype='npz')
>>> # results saves as 'my_dcTMD_results_N100.npz'
>>> # save results as 'dat' file
>>> write_output(out, work_estimator, filetype='dat')
>>> # save results as 'dat' and 'npz' file
>>> write_output(out, work_estimator, filetype=('dat', 'npz'))
Source code in src/dcTMD/io.py
load_output(filepath)
¶
Load file produced by write_output
.
Parameters:
-
filepath
(str
) –Path to the .dat or .npz file to be loaded.
Returns:
-
Dict[str, Any]
–A dictionary containing the loaded data. Keys correspond to the quantities saved in the .npz file, such as 'x', 'Wmean', 'Wdiss', 'dG', 'Gamma', and optionally 's_W_mean', 's_W_diss', 's_dG', 'Gamma_smooth', 's_Gamma' if they were present during saving.
Examples:
>>> from dcTMD.storing import load
>>> from dcTMD.io import write_output, load_output
>>> from dcTMD.dcTMD import WorkEstimator
>>> # Save the results from WorkEstimator
>>> work = load('my_work_set')
>>> work_estimator = WorkEstimator(temperature=290.15)
>>> work_estimator.fit(work)
>>> # save results as '.npz' file
>>> out = 'my_dcTMD_results'
>>> write_output(out, work_estimator, filetype='npz')
>>> # load results
>>> results = load_output('my_dcTMD_results_N100.npz')
>>> positions = results['x']
>>> mean_work = results['Wmean']
>>> dG = results['dG']