Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix two more issues with ScopeSimple #514

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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