Skip to content

Commit

Permalink
Merge pull request #2862 from PMEAL/fixing_pickle_problem
Browse files Browse the repository at this point in the history
Added try/except to getitem in Phase in case some settings are missing #bug
  • Loading branch information
jgostick authored Nov 20, 2023
2 parents 79e81d6 + 03a9638 commit e5dd5af
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions openpnm/phase/_phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,16 @@ def __getitem__(self, key):
if element + '.' + prop in self.keys():
vals = super().__getitem__(element + '.' + prop)
else: # If above are not triggered then try to interpolate
if self.settings['auto_interpolate']:
if (element == 'pore') and ('throat.'+prop not in self.keys()):
try:
if self.settings['auto_interpolate']:
if (element == 'pore') and ('throat.'+prop not in self.keys()):
raise KeyError(key)
elif (element == 'throat') and ('pore.'+prop not in self.keys()):
raise KeyError(key)
vals = self.interpolate_data(element + '.' + prop)
else:
raise KeyError(key)
elif (element == 'throat') and ('pore.'+prop not in self.keys()):
raise KeyError(key)
vals = self.interpolate_data(element + '.' + prop)
else:
except AttributeError:
raise KeyError(key)

# Finally get locs
Expand Down

0 comments on commit e5dd5af

Please sign in to comment.