Skip to content
Snippets Groups Projects
Commit efc6c76a authored by Mohamed, Fawzi Roberto (fawzi)'s avatar Mohamed, Fawzi Roberto (fawzi)
Browse files

fixes for python 3 (expand map in band and dos parsing)

parent 879e0820
No related branches found
No related tags found
No related merge requests found
from builtins import map
from builtins import object
import setup_paths
import numpy as np
......@@ -74,10 +73,10 @@ class FhiAimsBandParserContext(object):
for string in section['fhi_aims_band_occupations_eigenvalue_string']:
strings = string.split()
# first number is occupation and then every second one
band_occupations.append(map(float, strings[0::2]))
band_occupations.append([float(x) for x in strings[0::2]])
# second number is eigenvalue and then every second one
# convert units
band_energies.append(map(self.converter, map(float, strings[1::2])))
band_energies.append([self.converter(float(x)) for x in strings[1::2]])
if band_occupations:
# do not need to transpose array since its shape is [n_k_points,n_eigen_values] in the metadata
......
from builtins import map
from builtins import object
import setup_paths
import numpy as np
......@@ -60,7 +59,7 @@ class FhiAimsDosParserContext(object):
if section['fhi_aims_dos_value_string'] is not None:
for string in section['fhi_aims_dos_value_string']:
strings = string.split()
dos_values.append(map(float, strings))
dos_values.append([float(x) for x in strings])
if dos_values:
# need to transpose array since its shape is [number_of_spin_channels,n_dos_values] in the metadata
self.dos_values = np.transpose(np.asarray(dos_values))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment