Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions kinisi/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
from .due import Doi, due

DIMENSIONALITY = {
'x': np.s_[0],
'y': np.s_[1],
'z': np.s_[2],
'x': np.s_[0:1],
'y': np.s_[1:2],
'z': np.s_[2:3],
'xy': np.s_[:2],
'xz': np.s_[::2],
'yz': np.s_[1:],
'xyz': np.s_[:],
b'x': np.s_[0],
b'y': np.s_[1],
b'z': np.s_[2],
b'x': np.s_[0:1],
b'y': np.s_[1:2],
b'z': np.s_[2:3],
b'xy': np.s_[:2],
b'xz': np.s_[::2],
b'yz': np.s_[1:],
Expand Down
12 changes: 12 additions & 0 deletions kinisi/tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,18 @@ def test_parser_dt(self):
data = parser.Parser(coords, latt, time_step, step_skip, dt, specie_indices, drift_indices, dimension=dimension)
assert_equal(data.dt.size, 140)

def test_parser_one_dimension(self):
data = parser.Parser(coords, latt, time_step, step_skip, dt, specie_indices, drift_indices, dimension='x')
assert_equal(data.displacements.sizes['dimension'], 1)

def test_parser_two_dimension(self):
data = parser.Parser(coords, latt, time_step, step_skip, dt, specie_indices, drift_indices, dimension='xy')
assert_equal(data.displacements.sizes['dimension'], 2)

def test_parser_three_dimension(self):
data = parser.Parser(coords, latt, time_step, step_skip, dt, specie_indices, drift_indices, dimension='xyz')
assert_equal(data.displacements.sizes['dimension'], 3)

def test_parser_datagroup_round_trip(self):
data = parser.Parser(coords, latt, time_step, step_skip, dt, specie_indices, drift_indices, dimension=dimension)
datagroup = data._to_datagroup()
Expand Down