Skip to content

Commit

Permalink
fix check for flow_rate to calculate concentration
Browse files Browse the repository at this point in the history
  • Loading branch information
schumannj committed Oct 14, 2024
1 parent c153c53 commit cc3f0b6
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/nomad_catalysis/schema_packages/catalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,16 +714,17 @@ def normalize(self, archive, logger):
# super().normalize(archive, logger)

check_if_concentration_in_percentage(self, self.gas_concentration_in, logger)

if (
self.flow_rate
and self.m_parent
and getattr(self.m_parent, 'set_total_flow_rate', None)
and self.gas_concentration_in is None
):
total_flow = getattr(self.m_parent, 'set_total_flow_rate', None)
self.gas_concentration_in = self.flow_rate / total_flow

try:
if (
not self.gas_concentration_in
and self.flow_rate
and self.m_parent
and getattr(self.m_parent, 'set_total_flow_rate', None)
):
total_flow = getattr(self.m_parent, 'set_total_flow_rate', None)
self.gas_concentration_in = self.flow_rate / total_flow
except (TypeError, ValueError): # because truth value of array is ambiguous
pass
if self.name is None:
return
if self.name in ['C5-1', 'C6-1', 'nC5', 'nC6', 'Unknown', 'inert', 'P>=5C']:
Expand Down

0 comments on commit cc3f0b6

Please sign in to comment.