#210 correction in toolbox function reindex_junctions

Closed Daniel Lohmeier dlohmeier
Coverage Reach
component_models/abstract_models/branch_models.py component_models/abstract_models/branch_w_internals_models.py component_models/abstract_models/branch_wo_internals_models.py component_models/abstract_models/const_flow_models.py component_models/abstract_models/branch_wzerolength_models.py component_models/abstract_models/circulation_pump.py component_models/abstract_models/base_component.py component_models/abstract_models/node_models.py component_models/abstract_models/__init__.py component_models/abstract_models/node_element_models.py component_models/auxiliaries/build_system_matrix.py component_models/auxiliaries/derivative_toolbox.py component_models/auxiliaries/component_toolbox.py component_models/auxiliaries/__init__.py component_models/pipe_component.py component_models/ext_grid_component.py component_models/junction_component.py component_models/pump_component.py component_models/heat_exchanger_component.py component_models/valve_component.py component_models/circulation_pump_pressure_component.py component_models/circulation_pump_mass_component.py component_models/__init__.py component_models/sink_component.py component_models/source_component.py plotting/collections.py plotting/patch_makers.py plotting/simple_plot.py plotting/generic_geodata.py plotting/__init__.py plotting/plotting_toolbox.py multinet/control/controller/multinet_control.py multinet/control/controller/__init__.py multinet/control/run_control_multinet.py multinet/control/__init__.py multinet/timeseries/run_time_series_multinet.py multinet/timeseries/__init__.py multinet/multinet.py multinet/create_multinet.py multinet/__init__.py networks/simple_water_networks.py networks/simple_gas_networks.py networks/simple_heat_transfer_networks.py networks/nw_aux.py networks/__init__.py properties/fluids.py properties/properties_toolbox.py properties/__init__.py create.py pipeflow_setup.py pipeflow.py toolbox.py io/io_utils.py io/file_io.py io/convert_format.py io/__init__.py std_types/std_type.py std_types/std_type_toolbox.py std_types/__init__.py topology/create_graph.py topology/__init__.py timeseries/run_time_series.py timeseries/__init__.py idx_branch.py internals_toolbox.py pandapipes_net.py idx_node.py control/run_control.py control/__init__.py __init__.py constants.py

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -4,6 +4,7 @@
Loading
4 4
5 5
import numpy as np
6 6
7 +
7 8
def _sum_by_group_sorted(indices, *values):
8 9
    """Auxiliary function to sum up values by some given indices (both as numpy arrays). Expects the
9 10
    indices and values to already be sorted.
@@ -56,24 +57,27 @@
Loading
56 57
57 58
def select_from_pit(table_index_array, input_array, data):
58 59
    """
59 -
        Auxiliary function to retrieve values from a table like a pit. Each data entry corresponds to a
60 -
        table_index_array entry. Example: velocities are indexed by the corresponding from_nodes stored in the
61 -
        pipe pit.
62 -
63 -
        The function inputs another array which consists of some table_index_array entries the user wants to retrieve.
64 -
        The function is used in pandapipes results evaluation. The input array is the list of from_junction entries,
65 -
        corresponding only to the junction elements, not containing additional pipe nodes. The table_index_array
66 -
        is the complete list of from_nodes consisting of junction element entries and additional pipe section nodes.
67 -
        Data corresponds to the gas velocities.
68 -
69 -
        :param indices:
70 -
        :type indices:
71 -
        :param values:
72 -
        :type values:
60 +
        Auxiliary function to retrieve values from a table like a pit. Each data entry corresponds
61 +
        to a table_index_array entry. Example: velocities are indexed by the corresponding
62 +
        from_nodes stored in the pipe pit.
63 +
64 +
        The function inputs another array which consists of some table_index_array entries the user
65 +
        wants to retrieve. The function is used in pandapipes results evaluation. The input array is
66 +
        the list of from_junction entries, corresponding only to the junction elements, not
67 +
        containing additional pipe nodes. The table_index_array is the complete list of from_nodes
68 +
        consisting of junction element entries and additional pipe section nodes. Data corresponds
69 +
        to the gas velocities.
70 +
71 +
        :param table_index_array:
72 +
        :type table_index_array:
73 +
        :param input_array:
74 +
        :type input_array:
75 +
        :param data:
76 +
        :type data:
73 77
        :return:
74 78
        :rtype:
75 79
        """
76 80
    sorter = np.argsort(table_index_array)
77 81
    indices = sorter[np.searchsorted(table_index_array, input_array, sorter=sorter)]
78 82
79 -
    return data[indices]

@@ -185,7 +185,7 @@
Loading
185 185
    if hasattr(net, "res_junction"):
186 186
        net.res_junction.index = get_indices(net.res_junction.index, junction_lookup)
187 187
188 -
    for element, value in element_junction_tuples():
188 +
    for element, value in element_junction_tuples(net=net):
189 189
        if element in net.keys():
190 190
            net[element][value] = get_indices(net[element][value], junction_lookup)
191 191
    net["junction_geodata"].set_index(get_indices(net["junction_geodata"].index, junction_lookup),
@@ -400,7 +400,7 @@
Loading
400 400
    if "res_pipe" in net.keys():
401 401
        res_pipes = net.res_pipe.index.intersection(pipes)
402 402
        net["res_pipe"].drop(res_pipes, inplace=True)
403 -
    logger.info("dropped %d pipes" % len(pipes))
403 +
    logger.info("dropped %d pipes" % len(list(pipes)))
404 404
405 405
406 406
# TODO: change to pumps??

Learn more Showing 2 files with coverage changes found.

Changes in pandapipes/toolbox.py
-4
+4
Loading file...
Changes in pandapipes/internals_toolbox.py
+1
Loading file...
Files Coverage
pandapipes -0.11% 90.93%
Project Totals (71 files) 90.93%
Loading