Skip to content

Commit

Permalink
Improved WSClean tests 🚬
Browse files Browse the repository at this point in the history
  • Loading branch information
mpluess committed Oct 1, 2024
1 parent 2abf83e commit e38825a
Showing 1 changed file with 5 additions and 30 deletions.
35 changes: 5 additions & 30 deletions karabo/test/test_imager_wsclean.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import math
import os
from datetime import datetime

from karabo.imaging.imager_base import DirtyImagerConfig
from karabo.imaging.imager_wsclean import (
Expand All @@ -9,10 +8,7 @@
WscleanImageCleanerConfig,
create_image_custom_command,
)
from karabo.simulation.interferometer import InterferometerSimulation
from karabo.simulation.observation import Observation
from karabo.simulation.sky_model import SkyModel
from karabo.simulation.telescope import Telescope
from karabo.simulation.sample_simulation import run_sample_simulation
from karabo.simulation.visibility import Visibility
from karabo.test.conftest import TFiles
from karabo.util.file_handler import FileHandler
Expand Down Expand Up @@ -52,27 +48,8 @@ def test_dirty_image_custom_path(tobject: TFiles):


def _run_sim() -> Visibility:
phase_center = [250, -80]
gleam_sky = SkyModel.get_GLEAM_Sky(min_freq=72e6, max_freq=80e6)
sky = gleam_sky.filter_by_radius(0, 0.55, phase_center[0], phase_center[1])
sky.setup_default_wcs(phase_center=phase_center)
askap_tel = Telescope.constructor("ASKAP")
observation_settings = Observation(
start_frequency_hz=100e6,
start_date_and_time=datetime(2024, 3, 15, 10, 46, 0),
phase_centre_ra_deg=phase_center[0],
phase_centre_dec_deg=phase_center[1],
number_of_channels=16,
number_of_time_steps=24,
)

interferometer_sim = InterferometerSimulation(channel_bandwidth_hz=1e6)

return interferometer_sim.run_simulation(
askap_tel,
sky,
observation_settings,
)
visibility, _, _, _, _, _ = run_sample_simulation()
return visibility


def test_create_cleaned_image():
Expand Down Expand Up @@ -121,12 +98,11 @@ def test_create_cleaned_image_reuse_dirty():

dirty_imager = WscleanDirtyImager(
DirtyImagerConfig(
imaging_npixel=2048,
imaging_cellsize=3.878509448876288e-05,
imaging_npixel=imaging_npixel,
imaging_cellsize=imaging_cellsize,
),
)
dirty_image = dirty_imager.create_dirty_image(visibility)

assert os.path.exists(dirty_image.path)

restored = WscleanImageCleaner(
Expand All @@ -135,7 +111,6 @@ def test_create_cleaned_image_reuse_dirty():
imaging_cellsize=imaging_cellsize,
)
).create_cleaned_image(visibility, dirty_fits_path=dirty_image.path)

assert os.path.exists(dirty_image.path)
assert os.path.exists(restored.path)

Expand Down

0 comments on commit e38825a

Please sign in to comment.