Skip to content

Commit 1998441

Browse files
database: Added strict loading
1 parent 79081de commit 1998441

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

opxrd/database/opxrd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def load(cls, root_dirpath : str, download : bool = True, *args, **kwargs) -> Pa
2020

2121

2222
print(f'- Loading patterns from local files')
23-
return super().load(dirpath=root_dirpath)
23+
return super().load(dirpath=root_dirpath, strict=True)
2424

2525
@staticmethod
2626
def _download_zenodo_opxrd(output_fpath : str):

tests/t_download.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
from opxrd import OpXRD
77

88

9-
class TestDownload(Unittest):
9+
class TestLoading(Unittest):
1010
def test_dl(self):
11-
dl_dir = tempfile.mktemp()
12-
opxrd = OpXRD.load(root_dirpath=dl_dir, download=True)
13-
self.assertTrue(os.path.isdir(dl_dir))
14-
self.assertTrue(len(opxrd.patterns) > 1)
11+
dl_dirpath = tempfile.mktemp()
12+
opxrd = OpXRD.load(root_dirpath=dl_dirpath, download=True)
13+
self.assertTrue(os.path.isdir(dl_dirpath))
14+
self.assertTrue(len(opxrd.patterns) > 10**4)
1515

16+
if self.is_manual_mode:
17+
opxrd.plot_quantity(attr='primary_phase.spacegroup')
1618

1719
if __name__ == "__main__":
18-
TestDownload.execute_all()
20+
TestLoading.execute_all()

0 commit comments

Comments
 (0)