Skip to content
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

Add two band types in JSON output #1100

Merged
Merged
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
4 changes: 4 additions & 0 deletions aiida/orm/data/array/bands.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,11 @@ def _get_bandplot_data(self, cartesian, prettify_format=None, join_symbol=None,
if len(stored_bands.shape) == 2:
bands = stored_bands
band_type_idx = numpy.array([0]*stored_bands.shape[1])
two_band_types = False
elif len(stored_bands.shape) == 3:
bands = numpy.concatenate([_ for _ in stored_bands], axis=1)
band_type_idx = numpy.array([0] * stored_bands.shape[2] + [1] * stored_bands.shape[2])
two_band_types = True
else:
raise ValueError("Unexpected shape of bands")

Expand Down Expand Up @@ -510,6 +512,7 @@ def _get_bandplot_data(self, cartesian, prettify_format=None, join_symbol=None,
'to': label_to,
'values': bands[position_from:position_to + 1, :].transpose().tolist(),
'x': x[position_from:position_to + 1],
'two_band_types': two_band_types,
}
plot_info['paths'].append(path_dict)
else:
Expand All @@ -520,6 +523,7 @@ def _get_bandplot_data(self, cartesian, prettify_format=None, join_symbol=None,
'to': label_to,
'values': bands.transpose().tolist(),
'x': x,
'two_band_types': two_band_types,
}
plot_info['paths'].append(path_dict)
plot_info['path'].append([label_from, label_to])
Expand Down