Skip to content

Commit

Permalink
Add tests for larger initial field of view
Browse files Browse the repository at this point in the history
  • Loading branch information
hugobuddel committed Jul 3, 2024
1 parent 8137d3f commit e9a286a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 11 additions & 1 deletion scopesim/tests/tests_optics/test_FOVManager.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import pytest
from pytest import approx
import numpy as np

from scopesim.optics.fov_manager import FOVManager
from scopesim.tests.mocks.py_objects import effects_objects as eo
from scopesim.utils import from_currsys


class TestInit:
Expand All @@ -19,8 +21,16 @@ def test_initialises_with_list_of_effects(self):
class TestGenerateFovList:
def test_returns_default_single_entry_fov_list_for_no_effects(self):
fov_man = FOVManager(pixel_scale=1, plate_scale=1)
assert len(fov_man.volumes_list) == 1, "volumes_list should have only 1 element initially."
fov_vol_org = fov_man.volumes_list[0]

chunk_size = from_currsys(fov_man.meta["chunk_size"], fov_man.cmds)
n_vol_x = len(np.arange(fov_vol_org["x_min"], fov_vol_org["x_max"], chunk_size))
n_vol_y = len(np.arange(fov_vol_org["y_min"], fov_vol_org["y_max"], chunk_size))
fovs = list(fov_man.generate_fovs_list())
assert len(fovs) == 1

assert len(fovs) == n_vol_x * n_vol_y, (f"Expected {n_vol_x} * {n_vol_y} = {n_vol_x * n_vol_y} volumes, "
f"but got {len(fovs)} volumes")

def test_returns_single_fov_for_mvs_system(self):
effects = eo._mvs_effects_list()
Expand Down
3 changes: 2 additions & 1 deletion scopesim/tests/tests_optics/test_FovVolumeList.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,13 @@ def test_doesnt_shrink_if_values_too_large(self):

def test_shrink_along_two_axes(self):
fvl = FovVolumeList()
y_min_org = fvl[0]["y_min"]
fvl.shrink(["x", "y"], ([0.1, None], [None, 5]))
print(fvl)

assert fvl[0]["x_min"] == 0.1
assert fvl[0]["y_max"] == 5
assert fvl[0]["y_min"] == -1800
assert fvl[0]["y_min"] == y_min_org

def test_removes_volumes_no_longer_inside_volume_limits(self):
fvl = FovVolumeList()
Expand Down

0 comments on commit e9a286a

Please sign in to comment.