Skip to content

Commit

Permalink
Fix download method to be compatible with projections.
Browse files Browse the repository at this point in the history
  • Loading branch information
t-reents committed Feb 22, 2024
1 parent 2692c01 commit 0b6d0c5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/aiidalab_qe/common/bandpdoswidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,17 @@ def download_data(self, _=None):
file_name_bands = "bands_data.json"
file_name_pdos = "dos_data.json"
if self.bands_data:
json_str = json.dumps(self.bands_data)
bands_data_export = {}
for key, value in self.bands_data.items():
if isinstance(value, np.ndarray):
bands_data_export[key] = value.tolist()
else:
bands_data_export[key] = value

json_str = json.dumps(bands_data_export)
b64_str = base64.b64encode(json_str.encode()).decode()
self._download(payload=b64_str, filename=file_name_bands)
if self.dos_data:
if self.pdos_data:
json_str = json.dumps(self.pdos_data)
b64_str = base64.b64encode(json_str.encode()).decode()
self._download(payload=b64_str, filename=file_name_pdos)
Expand Down

0 comments on commit 0b6d0c5

Please sign in to comment.