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

Improve documentation for Line Emission #520

Merged
merged 10 commits into from
Oct 19, 2023
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ htmlcov/
nosetests.xml
coverage.xml
*,cover
karabo/examples/results/

# Translations
*.mo
Expand Down
404 changes: 163 additions & 241 deletions karabo/examples/HIIM_Img_Recovery.ipynb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions karabo/test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def clean_disk():
yield # testing happens here
# Teardown: fill with logic
FileHandler.clean_up_fh_root(force=True, verbose=False)
plt.close("all")


@pytest.fixture(scope="function")
Expand Down
9 changes: 7 additions & 2 deletions karabo/test/test_notebooks.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import os

import nbformat
import nest_asyncio
import pytest
from nbconvert.preprocessors import ExecutePreprocessor

from karabo.test.conftest import IS_GITHUB_RUNNER
from karabo.util.plotting_util import Font

nest_asyncio.apply()

RUN_NOTEBOOK_TESTS = os.environ.get("RUN_NOTEBOOK_TESTS", "false").lower() == "true"

# get notebook-dir not matter cwd
Expand All @@ -24,8 +27,10 @@ def _run_notebook(notebook: str) -> None:
os.chdir(notebook_dir)
try:
assert ep.preprocess(nb) is not None, f"Got empty notebook for {notebook}"
except Exception:
pytest.fail(reason=f"Failed executing {notebook}")
except AssertionError as e:
pytest.fail(reason=f"Assertion error, details: {e}")
except Exception as e:
pytest.fail(reason=f"Failed executing {notebook}, Exception: {e}")
finally:
os.chdir(cwd)

Expand Down
2 changes: 2 additions & 0 deletions karabo/test/test_pinocchio.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
from pathlib import Path

import numpy as np
import pytest

from karabo.simulation.pinocchio import Pinocchio


@pytest.mark.skip(reason="Takes too long on GitHub Runner")
def test_pinocchio_run():
"""Validate a simple PINOCCHIO run.

Expand Down
4 changes: 2 additions & 2 deletions karabo/test/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def test_parallelization_by_observation() -> None:
phase_center = [250, -80]
CENTER_FREQUENCIES_HZ = [100e6, 101e6]
CHANNEL_BANDWIDTHS_HZ = [1.0, 2.0]
N_CHANNELS = [4, 8]
N_CHANNELS = [2, 4]

sky = sky.filter_by_radius(0, 0.55, phase_center[0], phase_center[1])
telescope = Telescope.get_ASKAP_Telescope()
Expand All @@ -269,7 +269,7 @@ def test_parallelization_by_observation() -> None:

for i, vis in enumerate(visibilities):
imager = Imager(
vis, imaging_npixel=2048, imaging_cellsize=3.878509448876288e-05
vis, imaging_npixel=512, imaging_cellsize=3.878509448876288e-05
) # imaging cellsize is over-written in the Imager based on max uv dist.
dirty = imager.get_dirty_image()
with tempfile.TemporaryDirectory() as tmpdir:
Expand Down
4 changes: 2 additions & 2 deletions karabo/test/test_source_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ def test_bdsf_image_blanked():
start_frequency_hz=100e6,
phase_centre_ra_deg=phase_center[0],
phase_centre_dec_deg=phase_center[1],
number_of_channels=64,
number_of_channels=2,
number_of_time_steps=24,
)
interferometer_sim = InterferometerSimulation(channel_bandwidth_hz=1e6)
visibility_askap = interferometer_sim.run_simulation(
askap_tel, sky, observation_settings
)
imaging_npixel = 2048
imaging_npixel = 512
imaging_cellsize = 3.878509448876288e-05
imager_askap = Imager(
visibility_askap,
Expand Down
5 changes: 4 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ pytest==7.3.1
pytest-cov==4.1.0
pre-commit==3.2.2

# for notebook test runs
nest_asyncio

# types for mypy
types-requests

# doc tools
myst-parser
sphinx
sphinx_rtd_theme
sphinx_rtd_theme