Open JakobBD opened 1 month ago
Further:
Started working on this #43 but I have a couple of questions on the existing logic (see also comments in the pr). I guess dividing by the "total" mass balance is just to give us an idea of how important any imbalances are? It's not really clear to me why the total is defined the way it is.
Yes, the total is just meant to give a reference.
Before, we had a hard-coded absolute tolerance. We meant to make this more universal by dividing by the total.
If check_mass_balance
gets a tolerance as an argument, I'd also be okay with deleting get_mass_totals
and defining that tolerance as an absolute one.
But that would leave defining a meaningful tolerance to the user, which may be an obstacle.
Third option: as a reference, take max([np.max(np.absolute(f.values)) for f in self.flows.values()])
instead of get_mass_totals
. That would be much shorter and probably just as good.
The "total" shouldn't be in this function. Instead, there should be a function calling
get_mass_balance
and dividing it by a total.