Skip to content

Commit

Permalink
Moving simulation environment checking to another PR & made appropria…
Browse files Browse the repository at this point in the history
…te changes
  • Loading branch information
DhruvSondhi committed Jun 15, 2021
1 parent df2ae27 commit 941b956
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions tardis/simulation/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from tardis.plasma.standard_plasmas import assemble_plasma
from tardis.io.util import HDFWriterMixin
from tardis.io.config_reader import ConfigurationError
from tardis.util.base import check_simulation_env
from tardis.montecarlo import montecarlo_configuration as mc_config_module
from IPython.display import display
from IPython import get_ipython

# Adding logging support
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -426,7 +426,7 @@ def log_plasma_state(
plasma_state_log["next_w"] = next_w
plasma_state_log.columns.name = "Shell No."

if self.check_notebook():
if check_simulation_env():
logger.info(f"\n\tPlasma stratification:")
logger.info(
display(
Expand All @@ -453,18 +453,6 @@ def log_run_results(self, emitted_luminosity, absorbed_luminosity):
f"\tLuminosity requested = {self.luminosity_requested:.3e}\n"
)

def check_notebook(self):
try:
shell = get_ipython().__class__.__name__
if shell == "ZMQInteractiveShell":
return True
elif shell == "TerminalInteractiveShell":
return False
else:
return False
except NameError:
return False

def _call_back(self):
for cb, args in self._callbacks.values():
cb(self, *args)
Expand Down

0 comments on commit 941b956

Please sign in to comment.