From 941b9567a6f820c635bc098e53a65bffdb3cace7 Mon Sep 17 00:00:00 2001 From: DhruvSondhi Date: Mon, 14 Jun 2021 21:15:58 +0530 Subject: [PATCH] Moving simulation environment checking to another PR & made appropriate changes --- tardis/simulation/base.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/tardis/simulation/base.py b/tardis/simulation/base.py index e97a518e357..364075d2e4a 100644 --- a/tardis/simulation/base.py +++ b/tardis/simulation/base.py @@ -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__) @@ -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( @@ -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)