Skip to content

Commit f0d98a7

Browse files
parsing/examples: Updated aimat.json
1 parent 93583a0 commit f0d98a7

File tree

6 files changed

+7
-10
lines changed

6 files changed

+7
-10
lines changed

tests/base_pattern.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class ParserBaseTest(Unittest):
99
def setUpClass(cls):
1010
cls.pattern: XrdPattern = XrdPattern.load(fpath=DataExamples.get_bruker_fpath())
1111
cls.parser : MasterParser = MasterParser()
12+
cls.pattern.save(fpath=DataExamples.get_aimat_fpath(), force_overwrite=True)
1213

1314
def check_data_ok(self, two_theta_values : list[float], intensities : list[float]):
1415
data_view = str(two_theta_values)[:100]+ '...' + str(two_theta_values)[-100:]

tests/t_parsing/t_parser.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ def test_db_parsing_ok(self):
8181
self.assertIsInstance(all_db, PatternDB)
8282

8383

84-
8584
if __name__ == "__main__":
8685
TestParserDatabase.execute_all()
8786
# TestCustomFormats.execute_all()

tests/t_pattern/t_pattern.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
# ---------------------------------------------------------
1515

1616
class TestXrdPattern(ParserBaseTest):
17-
@classmethod
18-
def get_fpath(cls) -> str:
19-
return DataExamples.get_aimat_fpath()
20-
2117
def test_save_load_roundtrip(self):
2218
unlabeled_pattern = XrdPattern.load(fpath=DataExamples.get_bruker_fpath())
2319
labeled_pattern = XrdPattern.load(fpath=DataExamples.get_bruker_fpath())

xrdpattern/crystal/components/crystal.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
import json
44
import logging
55
from dataclasses import dataclass, asdict
6-
from types import NoneType
76
from typing import Optional, Literal
87

98
from distlib.util import cached_property
109
from pymatgen.core import Structure, Lattice, Species, Element
1110
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
1211

13-
from xrdpattern.serialization import JsonDataclass, Serializable
12+
from xrdpattern.serialization import JsonDataclass
1413
from .atomic_site import AtomSite
1514
from .base import CrystalBasis
1615

xrdpattern/parsing/examples/aimat.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

xrdpattern/xrd/experiment.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ def from_cif(cls, cif_content : str) -> PowderExperiment:
6767
# properties
6868

6969
def is_nonempty(self) -> bool:
70-
xray_info_nonemtpy = self.xray_info.primary_wavelength or self.xray_info.secondary_wavelength
71-
70+
xray_info_nonemtpy = not self.xray_info.primary_wavelength is None or not self.xray_info.secondary_wavelength is None
71+
if len(self.phases) == 0:
72+
return xray_info_nonemtpy
73+
7274
primary_phase = self.phases[0]
7375
composition_nonempty = primary_phase.chemical_composition
7476

0 commit comments

Comments
 (0)