Skip to content

Commit b8285c4

Browse files
committed
remove comments, ready for version 0.12
Signed-off-by: DONNOT Benjamin <[email protected]>
1 parent 819f70d commit b8285c4

File tree

76 files changed

+93
-382
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+93
-382
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ TODO: in `main.cpp` check the returned policy of pybind11 and also the `py::call
2929
TODO: a cpp class that is able to compute (DC powerflow) ContingencyAnalysis and TimeSeries using PTDF and LODF
3030
TODO: integration test with pandapower (see `pandapower/contingency/contingency.py` and import `lightsim2grid_installed` and check it's True)
3131

32-
[0.12.0] 2026-01-zz
32+
[0.12.0] 2026-01-06
3333
--------------------
3434
- [BREAKING] for better consistency, and following pypowsybl convention, trafo and lines "side"
3535
are now called "1" and "2" instead of "hv" / "lv" (for trafo) or "or" / "ex" for powerlines.

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
author = 'Benjamin DONNOT'
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = "0.11.1.dev0"
26-
version = '0.11'
25+
release = "0.12.0"
26+
version = '0.12'
2727

2828
# -- General configuration ---------------------------------------------------
2929

lightsim2grid/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# SPDX-License-Identifier: MPL-2.0
77
# This file is part of LightSim2grid, LightSim2grid implements a c++ backend targeting the Grid2Op platform.
88

9-
__version__ = "0.11.1.dev0"
9+
__version__ = "0.12.0"
1010

1111
__all__ = [
1212
"newtonpf",
@@ -22,36 +22,36 @@
2222
try:
2323
from lightsim2grid.lightSimBackend import LightSimBackend # noqa: F401
2424
__all__.append("LightSimBackend")
25-
except ImportError as exc_:
25+
except ImportError as exc_: # noqa: F841
2626
# grid2op is not installed, the Backend will not be available
2727
pass
2828

2929
try:
3030
from lightsim2grid.physical_law_checker import PhysicalLawChecker # noqa: F401
3131
__all__.append("PhysicalLawChecker")
32-
except ImportError as exc_:
32+
except ImportError as exc_: # noqa: F841
3333
# grid2op is not installed, the PhysicalLawChecker will not be available
3434
pass
3535

3636
try:
3737
from lightsim2grid.timeSerie import TimeSerie # noqa: F401
3838
__all__.append("TimeSerie")
3939
__all__.append("timeSerie")
40-
except ImportError as exc_:
40+
except ImportError as exc_: # noqa: F841
4141
# grid2op is not installed, the TimeSeries module will not be available
4242
pass
4343

4444
try:
4545
from lightsim2grid.contingencyAnalysis import ContingencyAnalysis # noqa: F401
4646
__all__.append("contingencyAnalysis")
4747
__all__.append("ContingencyAnalysis")
48-
except ImportError as exc_:
48+
except ImportError as exc_: # noqa: F841
4949
# grid2op is not installed, the SecurtiyAnalysis module will not be available
5050
pass
5151

5252
try:
5353
from lightsim2grid.rewards import N1ContingencyReward # noqa: F401
5454
__all__.append("rewards")
55-
except ImportError as exc_:
55+
except ImportError as exc_: # noqa: F841
5656
# grid2op is not installed, the SecurtiyAnalysis module will not be available
5757
pass

lightsim2grid/rewards/n1ContingencyReward.py

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class N1ContingencyReward(BaseReward):
3131
.. code-block:: python
3232
3333
import grid2op
34+
3435
from lightsim2grid.rewards import N1ContingencyReward
3536
l_ids = [0, 1, 7]
3637
env = grid2op.make("l2rpn_case14_sandbox",
@@ -117,8 +118,6 @@ def initialize(self, env: "grid2op.Environment.Environment"):
117118
"without any contingencies !")
118119
self.reward_min = 0.
119120
self.reward_max = len(self._l_ids) if not self._normalize else 1.
120-
# self._contingecy_analyzer = ContingencyAnalysis(self._backend)
121-
# self._contingecy_analyzer.add_multiple_contingencies(self._l_ids)
122121

123122
def __call__(self, action, env, has_error, is_done, is_illegal, is_ambiguous):
124123
if is_done:
@@ -175,31 +174,6 @@ def __call__(self, action, env, has_error, is_done, is_illegal, is_ambiguous):
175174
now_3 = time.perf_counter()
176175
self._timer_post_proc += now_3 - now_2
177176
self._timer_call += time.perf_counter() - beg
178-
# print()
179-
# print("sanity check")
180-
# print("a_or")
181-
# print(f"obs.a_or:\n{env.get_obs().a_or}")
182-
# print(f"backend updated state:\n{self._backend.lines_or_info()[3]}")
183-
# print("gen_p")
184-
# print(f"obs.gen_p:\n{env.get_obs().gen_p}")
185-
# print(f"backend updated state:\n{self._backend.generators_info()[0]}")
186-
# print("shunt_bus")
187-
# print(f"obs._shunt_bus:\n{env.get_obs()._shunt_bus}")
188-
# print(f"backend updated state:\n{self._backend.shunt_info()[-1]}")
189-
# print(f"env backend shunt bus {env.backend._grid.get_shunts()[0].bus_id}")
190-
# print(f"self backend shunt bus {self._backend._grid.get_shunts()[0].bus_id}")
191-
# print("shunt_q")
192-
# print(f"obs._shunt_q:\n{env.get_obs()._shunt_q}")
193-
# print(f"backend updated state:\n{self._backend.shunt_info()[1]}")
194-
# print("load_p")
195-
# print(f"obs.load_p:\n{env.get_obs().load_p}")
196-
# print(f"backend updated state:\n{self._backend.loads_info()[0]}")
197-
# print("")
198-
# print("reward for 0: ")
199-
# print(tmp_res[0])
200-
# print("reward for 3: ")
201-
# print(tmp_res[3])
202-
# print("")
203177
return res
204178

205179
def reset(self, env: "grid2op.Environment.BaseEnv") -> None:

lightsim2grid/tests/test_n1contingencyrewards.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -135,29 +135,14 @@ def _aux_test_reward(self, obs, reward, env=None):
135135
for l_id in self.my_ids:
136136
sim_obs, sim_r, sim_d, sim_i = obs.simulate(self.env.action_space({"set_line_status": [(l_id, -1)]}),
137137
time_step=0)
138-
# if l_id == 0:
139-
# print("simulate for 0")
140-
# print(sim_obs.a_or)
141-
# if l_id == 3:
142-
# print("simulate for 3")
143-
# print(sim_obs.a_or)
144138
if not self.is_dc():
145-
# print(f"for {l_id}: {sim_d = }, {sim_i['exception']}, {(sim_obs.a_or / obs._thermal_limit).max()}")
146139
if np.any(sim_obs.a_or > obs._thermal_limit * self.threshold_margin()) or sim_d:
147140
unsafe_cont += 1
148141
unsafe_conts.append(l_id)
149142
else:
150143
if np.any(np.abs(sim_obs.p_or) > th_lim_p) or sim_d:
151144
unsafe_cont += 1
152-
unsafe_conts.append(l_id)
153-
# print(f"testN1ContReward {env._reward_helper.template_reward._debug_unsafe_conts}")
154-
# print(f"testN1ContReward {unsafe_conts}")
155-
156-
# array([ 0. , 337.96604781, 122.5834584 , 0. ,
157-
# 135.9316308 , 106.3282711 , 280.89072926, 539.72618504,
158-
# 290.85619763, 725.03591688, 180.47842569, 127.51930555,
159-
# 433.16050467, 84.59000012, 370.64622793, 113.72360852,
160-
# 53.04777249, 162.52315174, 1351.44796185, 779.9985506 ])
145+
unsafe_conts.append(l_id)
161146

162147
assert reward == (len(self.my_ids) - unsafe_cont), f"wrong number of lines {reward} vs {(len(self.my_ids) - unsafe_cont)}"
163148
assert (env._reward_helper.template_reward._debug_unsafe_conts == unsafe_conts).all(), "wrong line ids on overflow"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pybind11.setup_helpers import Pybind11Extension, build_ext
1515

1616

17-
__version__ = "0.11.1.dev0"
17+
__version__ = "0.12.0"
1818
KLU_SOLVER_AVAILABLE = False
1919

2020
# Try to link against SuiteSparse (if available)

src/BaseConstants.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020, RTE (https://www.rte-france.com)
1+
// Copyright (c) 2020-2026, RTE (https://www.rte-france.com)
22
// See AUTHORS.txt
33
// This Source Code Form is subject to the terms of the Mozilla Public License, version 2.0.
44
// If a copy of the Mozilla Public License, version 2.0 was not distributed with this file,

src/BaseConstants.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020, RTE (https://www.rte-france.com)
1+
// Copyright (c) 2020-2026, RTE (https://www.rte-france.com)
22
// See AUTHORS.txt
33
// This Source Code Form is subject to the terms of the Mozilla Public License, version 2.0.
44
// If a copy of the Mozilla Public License, version 2.0 was not distributed with this file,

src/ChooseSolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020, RTE (https://www.rte-france.com)
1+
// Copyright (c) 2020-2026, RTE (https://www.rte-france.com)
22
// See AUTHORS.txt
33
// This Source Code Form is subject to the terms of the Mozilla Public License, version 2.0.
44
// If a copy of the Mozilla Public License, version 2.0 was not distributed with this file,

src/ChooseSolver.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020, RTE (https://www.rte-france.com)
1+
// Copyright (c) 2020-2026, RTE (https://www.rte-france.com)
22
// See AUTHORS.txt
33
// This Source Code Form is subject to the terms of the Mozilla Public License, version 2.0.
44
// If a copy of the Mozilla Public License, version 2.0 was not distributed with this file,

0 commit comments

Comments
 (0)