-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
run_sample_simulation: make simulator backend, visibility format conf…
…igurable, return all relevant objects. Visibility: verify path in constructor. Added test for simulation-format-imager combos. 🍥
- Loading branch information
Showing
5 changed files
with
206 additions
and
113 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# TODO files abräumen | ||
import os | ||
|
||
import pytest | ||
|
||
from karabo.imaging.imager_base import DirtyImagerConfig | ||
from karabo.imaging.imager_oskar import OskarDirtyImager, OskarDirtyImagerConfig | ||
from karabo.imaging.imager_rascil import RascilDirtyImager, RascilDirtyImagerConfig | ||
from karabo.imaging.imager_wsclean import WscleanDirtyImager | ||
from karabo.simulation.sample_simulation import run_sample_simulation | ||
from karabo.simulation.visibility import VisibilityFormat | ||
from karabo.simulator_backend import SimulatorBackend | ||
|
||
IMAGING_NPIXEL = 2048 | ||
IMAGING_CELLSIZE = 3.878509448876288e-05 | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"simulator_backend,visibility_format", | ||
[ | ||
(SimulatorBackend.OSKAR, "MS"), | ||
(SimulatorBackend.OSKAR, "OSKAR_VIS"), | ||
# (SimulatorBackend.RASCIL, "MS"), | ||
], | ||
) | ||
def test_oskar_imager( | ||
simulator_backend: SimulatorBackend, visibility_format: VisibilityFormat | ||
) -> None: | ||
visibility, _, _, _, _, _ = run_sample_simulation( | ||
simulator_backend=simulator_backend, | ||
visibility_format=visibility_format, | ||
) | ||
assert os.path.exists(visibility.path) | ||
dirty_image = OskarDirtyImager( | ||
OskarDirtyImagerConfig( | ||
imaging_npixel=IMAGING_NPIXEL, | ||
imaging_cellsize=IMAGING_CELLSIZE, | ||
) | ||
).create_dirty_image(visibility) | ||
assert os.path.isfile(dirty_image.path) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"simulator_backend,visibility_format", | ||
[ | ||
(SimulatorBackend.OSKAR, "MS"), | ||
# (SimulatorBackend.RASCIL, "MS"), | ||
], | ||
) | ||
def test_rascil_imager( | ||
simulator_backend: SimulatorBackend, visibility_format: VisibilityFormat | ||
) -> None: | ||
visibility, _, _, _, _, _ = run_sample_simulation( | ||
simulator_backend=simulator_backend, | ||
visibility_format=visibility_format, | ||
) | ||
assert os.path.exists(visibility.path) | ||
dirty_image = RascilDirtyImager( | ||
RascilDirtyImagerConfig( | ||
imaging_npixel=IMAGING_NPIXEL, | ||
imaging_cellsize=IMAGING_CELLSIZE, | ||
) | ||
).create_dirty_image(visibility) | ||
assert os.path.isfile(dirty_image.path) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"simulator_backend,visibility_format", | ||
[ | ||
(SimulatorBackend.OSKAR, "MS"), | ||
# (SimulatorBackend.RASCIL, "MS"), | ||
], | ||
) | ||
def test_wsclean_imager( | ||
simulator_backend: SimulatorBackend, visibility_format: VisibilityFormat | ||
) -> None: | ||
visibility, _, _, _, _, _ = run_sample_simulation( | ||
simulator_backend=simulator_backend, | ||
visibility_format=visibility_format, | ||
) | ||
assert os.path.exists(visibility.path) | ||
dirty_image = WscleanDirtyImager( | ||
DirtyImagerConfig( | ||
imaging_npixel=IMAGING_NPIXEL, | ||
imaging_cellsize=IMAGING_CELLSIZE, | ||
) | ||
).create_dirty_image(visibility) | ||
assert os.path.isfile(dirty_image.path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters