diff --git a/scopesim/commands/scopesimple.py b/scopesim/commands/scopesimple.py index 8517cf59..3812395c 100644 --- a/scopesim/commands/scopesimple.py +++ b/scopesim/commands/scopesimple.py @@ -181,15 +181,6 @@ def readout( List of HDUs containing simulation results. """ - # If we have AutoExposure in the optical train and no dit or ndit was - # passed, assume the user wants to re-estimate them from given exptime. - if "auto_exposure" in self.optical_train: - kwargs["dit"] = kwargs.get("dit") - kwargs["ndit"] = kwargs.get("ndit") - else: - # Without AutoExposure, we need to get dit, ndit into !OBS - self.settings["!OBS.dit"] = kwargs.get("dit") - self.settings["!OBS.ndit"] = kwargs.get("ndit") self._last_readout = self.optical_train.readout(filename, **kwargs) return self.last_readout[0] diff --git a/scopesim/commands/user_commands.py b/scopesim/commands/user_commands.py index eaba04e0..9549e3fc 100644 --- a/scopesim/commands/user_commands.py +++ b/scopesim/commands/user_commands.py @@ -291,7 +291,7 @@ def update(self, other=None, /, **kwargs): mode_yaml = self.modes_dict[mode_name] self._load_yaml_dict(mode_yaml) - if modes := kwargs.get("set_modes"): + if modes := list(kwargs.get("set_modes", [])): self.set_modes(*modes) # Calling underlying NestedMapping's update method to avoid recursion diff --git a/scopesim/effects/fits_headers.py b/scopesim/effects/fits_headers.py index 7fc6de56..779f2c87 100644 --- a/scopesim/effects/fits_headers.py +++ b/scopesim/effects/fits_headers.py @@ -459,7 +459,7 @@ def apply_to(self, hdul, **kwargs): eff_name = eff_name.split()[0] # get a resolved meta dict from the effect - eff_meta = deepcopy(opt_train[f"#{eff_name}.!"]) + eff_meta = deepcopy(opt_train[eff_name].meta) if self.meta["add_excluded_effects"] and not eff_meta["include"]: continue diff --git a/scopesim/tests/tests_commands/test_scopesimple.py b/scopesim/tests/tests_commands/test_scopesimple.py index c194edf8..f63b9872 100644 --- a/scopesim/tests/tests_commands/test_scopesimple.py +++ b/scopesim/tests/tests_commands/test_scopesimple.py @@ -19,7 +19,14 @@ def test_instrument_name_in_str(self): simple = Simulation("basic_instrument") assert "basic_instrument" in str(simple) - @pytest.mark.xfail(reason="DIT, NDIT currently broken") + def test_default_mode_works(self): + simple = Simulation("basic_instrument") + assert simple.mode == "imaging" + + def test_init_mode_works(self): + simple = Simulation("basic_instrument", "spectroscopy") + assert simple.mode == "spectroscopy" + def test_full_workflow_runs(self): simple = Simulation("basic_instrument") src = st.star(flux=15)