Skip to content

Commit

Permalink
Fix two more issues with ScopeSimple (#514)
Browse files Browse the repository at this point in the history
  • Loading branch information
teutoburg authored Nov 26, 2024
2 parents 4309816 + 97305a7 commit 0c9af30
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
9 changes: 0 additions & 9 deletions scopesim/commands/scopesimple.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
2 changes: 1 addition & 1 deletion scopesim/commands/user_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scopesim/effects/fits_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion scopesim/tests/tests_commands/test_scopesimple.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0c9af30

Please sign in to comment.