Skip to content

Commit

Permalink
A single try/except looks a little cleaner, especially when we are go…
Browse files Browse the repository at this point in the history
…ing to expand the conditionals in the future. Spaces around mathematical operators, division in this case, for better readability.
  • Loading branch information
HannoSpreeuw committed Aug 7, 2024
1 parent 3d2e627 commit 1c83fac
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions marlpde/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,22 +226,19 @@ def __post_init__(self):
'''
Filter out solver settings that are mutually incompatible.
'''
if self.solver != "scipy":
try:
try:
if self.solver != "scipy":
del self.__dataclass_fields__["method"]
del self.__dataclass_fields__["lband"]
del self.__dataclass_fields__["uband"]
except KeyError:
pass
else:
try:
else:
del self.__dataclass_fields__["scheme"]
del self.__dataclass_fields__["adaptive"]
if self.method != "LSODA":
del self.__dataclass_fields__["lband"]
del self.__dataclass_fields__["uband"]
except KeyError:
pass
except KeyError:
pass


@dataclass
Expand All @@ -250,7 +247,7 @@ class Tracker:
Initialises all the tracking parameters, such as tracker interval.
Also indicates the quantities to be tracked, as boolean values.
'''
progress_tracker_interval: float = Solver().t_range/ 1_000
progress_tracker_interval: float = Solver().t_range / 1_000
live_plotting: bool = False
plotting_interval: str = '0:05'
data_tracker_interval: float = 0.01
Expand Down

0 comments on commit 1c83fac

Please sign in to comment.