Skip to content

Commit

Permalink
Update metric_utilities.py
Browse files Browse the repository at this point in the history
include pbias equations
  • Loading branch information
Dobson committed Mar 25, 2024
1 parent 6244556 commit 89dba2e
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions swmmanywhere/metric_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,12 +546,22 @@ def outlet_pbias_length(real_G: nx.Graph,
real_results: pd.DataFrame,
real_subs: gpd.GeoDataFrame,
**kwargs) -> float:
"""Outlet PBIAS length.
r"""Outlet PBIAS length.
Calculate the percent bias of the total edge length in the subgraph that
drains to the dominant outlet node. The dominant outlet node of the 'real'
network is calculated by dominant_outlet, while the dominant outlet node of
the 'synthetic' network is calculated by best_outlet_match.
The percentage bias is calculated as:
.. math::
pbias = \\frac{{syn\_length - real\_length}}{{real\_length}}
where:
- :math:`syn\_length` is the synthetic length,
- :math:`real\_length` is the real length.
"""
# Identify synthetic and real outlet arcs
sg_syn, _ = best_outlet_match(synthetic_G, real_subs)
Expand All @@ -568,12 +578,22 @@ def outlet_pbias_nmanholes(real_G: nx.Graph,
real_results: pd.DataFrame,
real_subs: gpd.GeoDataFrame,
**kwargs) -> float:
"""Outlet PBIAS number of manholes (nodes).
r"""Outlet PBIAS number of manholes (nodes).
Calculate the percent bias of the total number of nodes in the subgraph
that drains to the dominant outlet node. The dominant outlet node of the
'real' network is calculated by dominant_outlet, while the dominant outlet
node of the 'synthetic' network is calculated by best_outlet_match.
The percentage bias is calculated as:
.. math::
pbias = \\frac{{syn\_nnodes - real\_nnodes}}{{real\_nnodes}}
where:
- :math:`syn\_nnodes` is the number of synthetic nodes,
- :math:`real\_nnodes` is the real number of nodes.
"""
# Identify synthetic and real outlet arcs
sg_syn, _ = best_outlet_match(synthetic_G, real_subs)
Expand All @@ -588,12 +608,23 @@ def outlet_pbias_npipes(real_G: nx.Graph,
real_results: pd.DataFrame,
real_subs: gpd.GeoDataFrame,
**kwargs) -> float:
"""Outlet PBIAS number of pipes (edges).
r"""Outlet PBIAS number of pipes (edges).
Calculate the percent bias of the total number of edges in the subgraph
that drains to the dominant outlet node. The dominant outlet node of the
'real' network is calculated by dominant_outlet, while the dominant outlet
node of the 'synthetic' network is calculated by best_outlet_match.
The percentage bias is calculated as:
.. math::
pbias = \\frac{{syn\_nedges - real\_nedges}}{{real\_nedges}}
where:
- :math:`syn\_nedges` is the number of synthetic edges,
- :math:`real\_nedges` is the real number of edges.
"""
# Identify synthetic and real outlet arcs
sg_syn, _ = best_outlet_match(synthetic_G, real_subs)
Expand Down

0 comments on commit 89dba2e

Please sign in to comment.