Skip to content

Commit 4c23843

Browse files
committed
format
Signed-off-by: Martijn Govers <[email protected]>
1 parent 6ce871a commit 4c23843

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/power_grid_model_io/converters/pandapower_converter.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ def _create_pgm_input_lines(self):
425425
pgm_lines["tan1"] = np.divide(
426426
self._get_pp_attr("line", "g_us_per_km", expected_type="f8", default=0),
427427
c_nf_per_km * (2 * np.pi * self.system_frequency * 1e-3),
428-
where= c_nf_per_km != 0.0,
428+
where=c_nf_per_km != 0.0,
429429
)
430430
pgm_lines["tan1"][np.equal(c_nf_per_km, 0.0)] = 0.0
431431
pgm_lines["i_n"] = (
@@ -439,7 +439,7 @@ def _create_pgm_input_lines(self):
439439
pgm_lines["tan0"] = np.divide(
440440
self._get_pp_attr("line", "g0_us_per_km", expected_type="f8", default=0),
441441
c0_nf_per_km * (2 * np.pi * self.system_frequency * 1e-3),
442-
where= c0_nf_per_km != 0.0,
442+
where=c0_nf_per_km != 0.0,
443443
)
444444
pgm_lines["tan0"][np.equal(c0_nf_per_km, 0.0)] = 0.0
445445
assert ComponentType.line not in self.pgm_input_data
@@ -1384,8 +1384,9 @@ def _pp_trafos_output(self):
13841384
if self.trafo_loading == "current":
13851385
ui_from = pgm_output_transformers["i_from"] * pgm_input_transformers["u1"]
13861386
ui_to = pgm_output_transformers["i_to"] * pgm_input_transformers["u2"]
1387-
loading = (np.sqrt(3) * np.maximum(ui_from, ui_to) /
1388-
pgm_input_transformers["sn"]) * loading_multiplier * 1e2
1387+
loading = (
1388+
(np.sqrt(3) * np.maximum(ui_from, ui_to) / pgm_input_transformers["sn"]) * loading_multiplier * 1e2
1389+
)
13891390
elif self.trafo_loading == "power":
13901391
loading = pgm_output_transformers["loading"] * loading_multiplier * 1e2
13911392
else:
@@ -1716,9 +1717,8 @@ def join_currents(table: str, bus_name: str, i_name: str) -> pd.DataFrame:
17161717
pp_switches_output.loc[link_ids, "i_ka"] = links["i_from"] * 1e-3
17171718
in_ka = self.pp_input_data["switch"]["in_ka"].values
17181719
pp_switches_output["loading_percent"] = np.nan
1719-
pp_switches_output["loading_percent"] = np.divide(pp_switches_output["i_ka"],
1720-
in_ka, where= in_ka != 0)
1721-
1720+
pp_switches_output["loading_percent"] = np.divide(pp_switches_output["i_ka"], in_ka, where=in_ka != 0)
1721+
17221722
assert "res_switch" not in self.pp_output_data
17231723
self.pp_output_data["res_switch"] = pp_switches_output
17241724

tests/unit/converters/test_pandapower_converter_output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ def test_pp_switch_output():
770770
"element": [10, 10, 10, 10, 10, 11, 11, 77, 88],
771771
"et": ["t", "t", "t3", "t3", "t3", "l", "l", "b", "b"],
772772
"closed": [True, True, True, True, True, True, True, True, True],
773-
"in_ka": [np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan],
773+
"in_ka": [np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan],
774774
},
775775
index=[40, 41, 42, 43, 44, 45, 46, 47, 48],
776776
),

tests/validation/converters/test_pandapower_converter_input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ def test_extra_info__serializable(extra_info):
117117
# Assert
118118
json.dumps(actual, cls=JsonEncoder) # expect no exception
119119

120+
120121
@pytest.mark.filterwarnings("error:.*invalid value encountered in divide.*:RuntimeWarning")
121122
def test_pgm_input_lines__cnf_zero():
122123
pp_network = pp_net_3ph_minimal_trafo()
@@ -128,4 +129,3 @@ def test_pgm_input_lines__cnf_zero():
128129
pp_network.line.c0_nf_per_km = 0
129130
data, _ = pp_converter.load_input_data(pp_network)
130131
assert data[ComponentType.line]["tan0"] == 0
131-

tests/validation/converters/test_pandapower_converter_output.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def load_validation_data_3ph(trafo_loading="power") -> PandaPowerData:
7878
return pp.file_io.from_json(PP_V2_NET_3PH_OUTPUT_FILE_CURRENT_LOADING)
7979

8080

81-
@pytest.fixture(params = ["power", "current"])
81+
@pytest.fixture(params=["power", "current"])
8282
def output_data(request) -> Tuple[PandaPowerData, PandaPowerData]:
8383
"""
8484
Load the pandapower network and the json file, and return the output_data
@@ -88,7 +88,7 @@ def output_data(request) -> Tuple[PandaPowerData, PandaPowerData]:
8888
return actual, expected
8989

9090

91-
@pytest.fixture(params = ["power", "current"])
91+
@pytest.fixture(params=["power", "current"])
9292
def output_data_3ph(request) -> Tuple[PandaPowerData, PandaPowerData]:
9393
"""
9494
Load the pandapower network and the json file, and return the output_data
@@ -264,7 +264,7 @@ def test_attributes(output_data: Tuple[PandaPowerData, PandaPowerData], componen
264264
pd.testing.assert_series_equal(actual_values, expected_values, atol=5e-4, rtol=1e-4)
265265

266266

267-
@pytest.mark.parametrize(("component", "attribute"), component_attributes_df(load_and_convert_pgm_data_3ph()))
267+
@pytest.mark.parametrize(("component", "attribute"), component_attributes_df(load_and_convert_pgm_data_3ph()))
268268
def test_attributes_3ph(output_data_3ph: Tuple[PandaPowerData, PandaPowerData], component: str, attribute: str):
269269
"""
270270
For each attribute, check if the actual values are consistent with the expected values for asym

0 commit comments

Comments
 (0)