-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added the capability of loading a single test case for AMBER #71
Changes from 28 commits
c2a4f6a
61f5288
819b2ad
423c13c
7ec895a
5de020b
6cb3792
be6b856
98b8d4e
ea8f255
c761bf1
8957129
32a1094
28b3611
9b52b56
43c8584
32e7e9f
67cb793
4a1f11d
02464ef
6ba30d0
7add57e
ee0bd39
0abec73
e9d32cc
b50d98b
958edbe
ec32c47
f711a06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
"""Accessors for Amber TI datasets. | ||
|
||
""" | ||
|
||
from os.path import dirname, join | ||
from glob import glob | ||
|
||
import warnings | ||
from pathlib import Path | ||
from .. import Bunch | ||
|
||
|
||
|
@@ -20,10 +18,10 @@ def load_bace_improper(): | |
- 'data' : the data files for improper solvated vdw alchemical leg | ||
|
||
""" | ||
module_path = dirname(__file__) | ||
data = {'vdw': glob(join(module_path, 'bace_improper/solvated/vdw/*/ti-*.out.bz2'))} | ||
module_path = Path(__file__).parent | ||
data = {'vdw': list(map(str, module_path.glob('bace_improper/solvated/vdw/*/ti-*.out.bz2')))} | ||
|
||
with open(join(module_path, 'bace_improper', 'descr.rst')) as rst_file: | ||
with open(module_path / 'bace_improper' / 'descr.rst') as rst_file: | ||
fdescr = rst_file.read() | ||
|
||
return Bunch(data=data, | ||
|
@@ -41,20 +39,20 @@ def load_bace_example(): | |
- 'data' : the data files by system and alchemical leg | ||
|
||
""" | ||
module_path = dirname(__file__) | ||
module_path = Path(__file__).parent | ||
data = {'complex': | ||
{'decharge': glob(join(module_path, 'bace_CAT-13d~CAT-17a/complex/decharge/*/ti-*.out.bz2')), | ||
'recharge': glob(join(module_path, 'bace_CAT-13d~CAT-17a/complex/recharge/*/ti-*.out.bz2')), | ||
'vdw': glob(join(module_path, 'bace_CAT-13d~CAT-17a/complex/vdw/*/ti-*.out.bz2')) | ||
{'decharge': list(map(str, module_path.glob('bace_CAT-13d~CAT-17a/complex/decharge/*/ti-*.out.bz2'))), | ||
'recharge': list(map(str, module_path.glob('bace_CAT-13d~CAT-17a/complex/recharge/*/ti-*.out.bz2'))), | ||
'vdw': list(map(str, module_path.glob('bace_CAT-13d~CAT-17a/complex/vdw/*/ti-*.out.bz2'))) | ||
}, | ||
'solvated': | ||
{'decharge': glob(join(module_path, 'bace_CAT-13d~CAT-17a/solvated/decharge/*/ti-*.out.bz2')), | ||
'recharge': glob(join(module_path, 'bace_CAT-13d~CAT-17a/solvated/recharge/*/ti-*.out.bz2')), | ||
'vdw': glob(join(module_path, 'bace_CAT-13d~CAT-17a/solvated/vdw/*/ti-*.out.bz2')) | ||
{'decharge': list(map(str, module_path.glob('bace_CAT-13d~CAT-17a/solvated/decharge/*/ti-*.out.bz2'))), | ||
'recharge': list(map(str, module_path.glob('bace_CAT-13d~CAT-17a/solvated/recharge/*/ti-*.out.bz2'))), | ||
'vdw': list(map(str, module_path.glob('bace_CAT-13d~CAT-17a/solvated/vdw/*/ti-*.out.bz2'))) | ||
} | ||
} | ||
|
||
with open(join(module_path, 'bace_CAT-13d~CAT-17a', 'descr.rst')) as rst_file: | ||
with open(module_path / 'bace_CAT-13d~CAT-17a' / 'descr.rst') as rst_file: | ||
fdescr = rst_file.read() | ||
|
||
return Bunch(data=data, | ||
|
@@ -74,11 +72,11 @@ def load_simplesolvated(): | |
|
||
""" | ||
|
||
module_path = dirname(__file__) | ||
data = {'charge': glob(join(module_path, 'simplesolvated/charge/*/ti-*.out')), | ||
'vdw': glob(join(module_path, 'simplesolvated/vdw/*/ti-*.out'))} | ||
module_path = Path(__file__).parent | ||
data = {'charge': list(map(str, module_path.glob('simplesolvated/charge/*/ti-*.tar.bz2'))), | ||
'vdw': list(map(str, module_path.glob('simplesolvated/vdw/*/ti-*.tar.bz2')))} | ||
|
||
with open(join(module_path, 'simplesolvated', 'descr.rst')) as rst_file: | ||
with open(module_path / 'simplesolvated' / 'descr.rst') as rst_file: | ||
fdescr = rst_file.read() | ||
|
||
return Bunch(data=data, | ||
|
@@ -96,12 +94,60 @@ def load_invalidfiles(): | |
- 'data' : the example of invalid data files | ||
- 'DESCR': the full description of the dataset | ||
|
||
|
||
.. deprecated:: 0.7 | ||
use :func:`load_testfiles` instead | ||
|
||
""" | ||
|
||
module_path = dirname(__file__) | ||
data = [glob(join(module_path, 'invalidfiles/*.out.bz2'))] | ||
warnings.warn( | ||
"load_invalidfiles() was deprecated in 0.7.0 and will be removed in the following release." | ||
" Use load_testfiles() instead", | ||
DeprecationWarning) | ||
module_path = Path(__file__).parent | ||
data = [[ | ||
module_path / 'testfiles' / 'no_useful_data.out.tar.bz2', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just change these file names from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
module_path / 'testfiles' / 'no_control_data.out.tar.bz2', | ||
module_path / 'testfiles' / 'no_temp0_set.out.tar.bz2', | ||
module_path / 'testfiles' / 'no_free_energy_info.out.tar.bz2', | ||
module_path / 'testfiles' / 'no_atomic_section.out.tar.bz2', | ||
module_path / 'testfiles' / 'no_results_section.out.tar.bz2']] | ||
|
||
with open(module_path / 'testfiles' / 'descr_invalid.rst') as rst_file: | ||
fdescr = rst_file.read() | ||
|
||
return Bunch(data=data, | ||
DESCR=fdescr) | ||
|
||
|
||
def load_testfiles(): | ||
"""Load incomplete or wrongly formatted files to be used to test the AMBER parsers. | ||
|
||
Returns | ||
------- | ||
data : Bunch | ||
Dictionary-like object, the interesting attributes are: | ||
|
||
- 'data' : the data files | ||
- 'DESCR': the full description of all the files | ||
|
||
""" | ||
|
||
with open(join(module_path, 'invalidfiles', 'descr.rst')) as rst_file: | ||
testfiles_path = Path(__file__).parent / 'testfiles' | ||
|
||
data = { | ||
"not_finished_run": [testfiles_path / "not_finished_run.out.tar.bz2"], | ||
"none_in_mbar": [testfiles_path / "none_in_mbar.out.tar.bz2"], | ||
"no_useful_data": [testfiles_path / "no_useful_data.out.tar.bz2"], | ||
"no_temp0_set": [testfiles_path / "no_temp0_set.out.tar.bz2"], | ||
"no_results_section": [testfiles_path / "no_results_section.out.tar.bz2"], | ||
"no_free_energy_info": [testfiles_path / "no_free_energy_info.out.tar.bz2"], | ||
"no_dHdl_data_points": [testfiles_path / "no_dHdl_data_points.out.tar.bz2"], | ||
"no_control_data": [testfiles_path / "no_control_data.out.tar.bz2"], | ||
"no_atomic_section": [testfiles_path / "no_atomic_section.out.tar.bz2"], | ||
} | ||
|
||
with open(testfiles_path / 'descr.rst') as rst_file: | ||
fdescr = rst_file.read() | ||
|
||
return Bunch(data=data, | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the start of the function, issue a DeprecationWarning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!