Skip to content

Commit

Permalink
Fix padding when attribute is nested w/o index
Browse files Browse the repository at this point in the history
  • Loading branch information
smcolby committed Aug 9, 2023
1 parent 77f0a23 commit fc4b7f5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions isicle/conformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,15 @@ def reduce(self, attr, func='boltzmann', **kwargs):
for key in safelist(attr):
value = [x.get(key) for x in value]

# Check for index
# Check nested values
if isinstance(value[0], dict):
# Check index
if 'index' in value[0]:
index = np.array([x['index'] for x in value]).flatten()
pad = int(len(index) / len(self))
else:
index = None
pad = 1

# Check atom
if 'atom' in value[0]:
Expand All @@ -496,9 +498,7 @@ def reduce(self, attr, func='boltzmann', **kwargs):
else:
value = np.array([x[attr] for x in value]).flatten()

pad = int(len(index) / len(self))

# No index
# Not nested
else:
index = None
atom = None
Expand Down

0 comments on commit fc4b7f5

Please sign in to comment.