Skip to content

Commit d443991

Browse files
committed
Fix Flake8 warnings
1 parent 9f25841 commit d443991

File tree

6 files changed

+9
-10
lines changed

6 files changed

+9
-10
lines changed

src/pownet/core/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" This is the core module.
1+
""" This is the core module.
22
"""
33

44
from .builder import ModelBuilder

src/pownet/modeling/constraint.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
"""constraint.py: Contains functions for constructing the objective function and constraints of the optimization model.
22
Throughout this module, the number 24 is the number of hours in a day. This number is used to calculate the index of the next day in the optimization model."""
33

4+
from pownet.core.input import SystemInput
45
import gurobipy as gp
56
import networkx as nx
67
import pandas as pd
78

8-
from pownet.core import SystemInput
9-
109

1110
"""Functions for thermal-unit constraints
1211
"""

src/pownet/modeling/objfunc.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""model_formulation.py: Contains functions for constructing the objective function and constraints of the optimization model."""
22

3-
from pownet.core import SystemInput
4-
3+
from pownet.core.input import SystemInput
54

65
""" Functions for the objective function
76
"""

src/pownet/modeling/rounding_algo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def optimize_with_rounding(
166166

167167
# If no integer solution is found after max_rounding_iter
168168
print(
169-
f"\nPowNet: The rounding heuristic has terminated before finding an integer solution."
169+
"\nPowNet: The rounding heuristic has terminated before finding an integer solution."
170170
)
171171
model.optimize()
172172
return model

src/pownet/reservoir/reservoir_operator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def get_hourly_hydropower(self) -> pd.DataFrame:
8181
return self.hourly_hydropower
8282

8383
def export_hydropower_csv(self, timestep: str, output_folder: str) -> None:
84-
csv_name = f"pownet_hydropower.csv"
84+
csv_name = "pownet_hydropower.csv"
8585

8686
# Check if the timestep is valid
8787
if timestep not in ["daily", "hourly"]:

src/pownet/stochastic/demand.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ def _get_synthetic(self, exog_data: pd.DataFrame, seed: int) -> pd.Series:
131131
synthetic_y = pd.Series()
132132
for month in self.months:
133133
# Models are fitted for each month
134-
reg_model = self.monthly_reg_models[month]
135134
stl_result = self.monthly_stl_results[month]
136135
sarimax_model = self._monthly_models[month]
137136

@@ -146,10 +145,12 @@ def _get_synthetic(self, exog_data: pd.DataFrame, seed: int) -> pd.Series:
146145
reg_pred = self.monthly_reg_models[month].predict(exog=daily_exog)
147146
reg_pred = pd.Series(reg_pred, index=daily_exog.index)
148147

149-
# Bootstrap the SARIMAX predictions within 75% confidence interval
148+
# Bootstrap the SARIMAX predictions within 95% confidence interval
150149
sarimax_pred = sarimax_model.predict()
151150
sarimax_pred_ci = np.percentile(sarimax_pred, [2.5, 97.5])
152-
sarimax_bootstrap = np.random.choice(sarimax_pred, size=len(daily_exog))
151+
sarimax_bootstrap = np.random.choice(
152+
sarimax_pred_ci, size=len(daily_exog)
153+
)
153154
sarimax_bootstrap = pd.Series(sarimax_bootstrap, index=daily_exog.index)
154155

155156
# Recover electricity demand by adding predictions from the regression model,

0 commit comments

Comments
 (0)