Skip to content

Commit

Permalink
[pre-commit.ci] Automatic python and c++ formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Oct 20, 2024
1 parent d8e43a9 commit 0c07fe6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
8 changes: 4 additions & 4 deletions docs/source/user_guide/user_guide_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ Since the beginning of GATE, a lot of changes have happened in the fields of com
Despite its usefulness and its unique features (collaborative, open source, dedicated to medical physics), we think that the legacy GATE software is showing its age, from a computer science and software development point of view. The source code has been worked on for almost 20 years by literally hundreds of different developers. The current GitHub repository indicates around 70 unique [contributors](https://github.com/OpenGATE/Gate/blob/develop/AUTHORS), but it has been set up only around 2012 and a lot of early contributors are not mentioned in this list. This diversity is the source of a lot of innovation and experiments (and fun!), but also leads to maintenance issues. Some parts of the code are "abandoned", some others are somehow duplicated. Also, the C++ language standard has evolved tremendously during the last 20 years, with very efficient and convenient concepts such as smart pointers, lambda functions, 'auto' keyword, etc., that make C++ code more robust and easier to write and maintain.

## Towards new frontiers
Keeping in mind the core pillars of GATE's principles (community-based, open-source, medical physics oriented), we decided to start a project to propose a new way of performing Monte Carlo simulations in medical physics.
The goal of GATE 10 is to provide a simple-to-use yet flexible Python-based interface to the user through which Geant4 simulations can be set up. Internally, GATE 10 aims to provide developers and contributors with structures and interfaces that make implementing and maintaining new feature as simple as possible.
Keeping in mind the core pillars of GATE's principles (community-based, open-source, medical physics oriented), we decided to start a project to propose a new way of performing Monte Carlo simulations in medical physics.
The goal of GATE 10 is to provide a simple-to-use yet flexible Python-based interface to the user through which Geant4 simulations can be set up. Internally, GATE 10 aims to provide developers and contributors with structures and interfaces that make implementing and maintaining new feature as simple as possible.

We took off into this (cray?) experiment, well aware of the huge effort it would require to complete it. At the beginning, we were not sure if the goal was feasible. Today, we are proud that GATE 10 is a fully functional Monte Carlo software that can (almost) replace the legacy Gate 9.x code. This has become possible not only thanks to the group of developers tirelessly working on the new software, but also thanks to audacious users who have tried the new GATE 10 even at an early stage and have provided valuable feedback.
We took off into this (cray?) experiment, well aware of the huge effort it would require to complete it. At the beginning, we were not sure if the goal was feasible. Today, we are proud that GATE 10 is a fully functional Monte Carlo software that can (almost) replace the legacy Gate 9.x code. This has become possible not only thanks to the group of developers tirelessly working on the new software, but also thanks to audacious users who have tried the new GATE 10 even at an early stage and have provided valuable feedback.

There are plenty of exciting and fun features waiting to be developed and implemented, so take a seat and hope on board.
There are plenty of exciting and fun features waiting to be developed and implemented, so take a seat and hope on board.

Never stop exploring !

Expand Down
12 changes: 6 additions & 6 deletions opengate/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,7 @@ def make_docstring_for_user_info(name, default_value, options):


def make_docstring(cls, user_info_defaults):
docstring = (
f"The class {cls.__qualname__} has the following user input parameters and default values:\n\n"
)
docstring = f"The class {cls.__qualname__} has the following user input parameters and default values:\n\n"
for k, v in user_info_defaults.items():
default_value = v[0]
options = v[1]
Expand All @@ -367,12 +365,14 @@ def make_docstring(cls, user_info_defaults):


def help_on_user_info(obj):
if hasattr(obj, '__user_info_doc__'):
if hasattr(obj, "__user_info_doc__"):
print(obj.__user_info_doc__)
elif type(obj) is property and hasattr(obj, '__doc__'):
elif type(obj) is property and hasattr(obj, "__doc__"):
print(obj.__doc__)
else:
raise GateImplementationError(f"No __user_info_doc__ or __doc__ available for {obj}. ")
raise GateImplementationError(
f"No __user_info_doc__ or __doc__ available for {obj}. "
)


def restore_userinfo_properties(cls, attributes):
Expand Down
33 changes: 19 additions & 14 deletions opengate/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ class Simulation(GateObject):
"INFO",
{
"doc": "Gate pre-run verbosity. "
"Will display more or fewer messages during initialization. ",
"Will display more or fewer messages during initialization. ",
"allowed_values": (
"NONE",
"INFO",
Expand All @@ -1269,37 +1269,42 @@ class Simulation(GateObject):
),
"running_verbose_level": (
0,
{"doc": "Gate verbosity while the simulation is running.",
"allowed_values": (0, logger.RUN, logger.EVENT)}),
{
"doc": "Gate verbosity while the simulation is running.",
"allowed_values": (0, logger.RUN, logger.EVENT),
},
),
"g4_verbose_level": (
1,
# For an unknown reason, when verbose_level == 0, there are some
# additional print after the G4RunManager destructor. So we default at 1
{"doc": "Geant4 verbosity. With level 0, Geant4 is mostly silent. "
"Level 1 already gives quite a bit of verbose output. "
"Level 2 is very detailed and might affect performance. "},
{
"doc": "Geant4 verbosity. With level 0, Geant4 is mostly silent. "
"Level 1 already gives quite a bit of verbose output. "
"Level 2 is very detailed and might affect performance. "
},
),
"g4_verbose": (False, {"doc": "Switch on/off Geant4's verbose output."}),
"g4_verbose_level_tracking": (
-1,
{
"doc": "Activate verbose tracking in Geant4 "
"via G4 command '/tracking/verbose g4_verbose_level_tracking'."
"via G4 command '/tracking/verbose g4_verbose_level_tracking'."
},
),
"visu": (
False,
{
"doc": "Activate visualization? "
"Note: Use low number of primaries if you activate visualization. "
"Note: Use low number of primaries if you activate visualization. "
},
),
"visu_type": (
"vrml",
{
"doc": "The type of visualization to be used. "
"'qt' will start a Geant4 Qt interface. "
"The Geant4 visualisation commands can be adapted via the parameter visu_commands.",
"'qt' will start a Geant4 Qt interface. "
"The Geant4 visualisation commands can be adapted via the parameter visu_commands.",
"allowed_values": (
"qt",
"vrml",
Expand All @@ -1326,10 +1331,10 @@ class Simulation(GateObject):
read_mac_file_to_commands("default_visu_commands_qt.mac"),
{
"doc": "Geant4 commands needed to handle the visualization. "
"By default, the Geant4 visualisation commands are the ones "
"provided in the file ``opengate/mac/default_visu_commands_qt.mac``. "
"Custom commands can be loaded via a .mac file, e.g. "
"``sim.visu_commands = gate.read_mac_file_to_commands('my_visu_commands.mac')``.",
"By default, the Geant4 visualisation commands are the ones "
"provided in the file ``opengate/mac/default_visu_commands_qt.mac``. "
"Custom commands can be loaded via a .mac file, e.g. "
"``sim.visu_commands = gate.read_mac_file_to_commands('my_visu_commands.mac')``.",
},
),
"visu_commands_vrml": (
Expand Down

0 comments on commit 0c07fe6

Please sign in to comment.