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

An idea - Drop casacore #167

Closed
wants to merge 3 commits into from
Closed
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
6 changes: 4 additions & 2 deletions flint/bandpass.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Optional, Union

import numpy as np
from casacore.tables import table, taql
from casatools.table import table as table_object

from flint.calibrate.aocalibrate import AOSolutions, calibrate_apply_ms
from flint.flagging import flag_ms_aoflagger
Expand All @@ -14,6 +14,8 @@
from flint.naming import create_ms_name
from flint.sky_model import KNOWN_1934_FILES, get_1934_model

table = table_object()


def plot_solutions(solutions_path: Path, ref_ant: Optional[int] = 0) -> None:
"""Plot solutions for AO-style solutions
Expand Down Expand Up @@ -165,7 +167,7 @@ def extract_correct_bandpass_pointing(

logger.info(f"Will create a MS, writing to {out_path}")
with table(f"{str(ms.path)}") as tab:
field_ms = taql(f"select * from $tab where FIELD_ID=={field_id}")
field_ms = table.taql(f"select * from $tab where FIELD_ID=={field_id}")
field_ms.copy(str(out_path), deep=True)

return ms.with_options(path=out_path, beam=ms_summary.beam)
Expand Down
5 changes: 3 additions & 2 deletions flint/flagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
from argparse import ArgumentParser
from pathlib import Path
from typing import Collection, NamedTuple, Optional, Union

import numpy as np
from casacore.tables import table
from casatools.table import table as table_object

from flint.exceptions import MSError
from flint.logging import logger
from flint.ms import MS, check_column_in_ms, critical_ms_interaction, describe_ms
from flint.sclient import run_singularity_command
from flint.utils import get_packaged_resource_path

table = table_object()


class AOFlaggerCommand(NamedTuple):
"""The command to use when running aoflagger"""
Expand Down
6 changes: 4 additions & 2 deletions flint/ms.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import numpy as np
from astropy.coordinates import EarthLocation, SkyCoord
from astropy.time import Time
from casacore.tables import table, taql
from casatools.table import table as table_object
from fixms.fix_ms_corrs import fix_ms_corrs
from fixms.fix_ms_dir import fix_ms_dir

Expand All @@ -32,6 +32,8 @@
from flint.options import MS
from flint.utils import copy_directory, rsync_copy_directory

table = table_object()


class MSSummary(NamedTuple):
"""Small structure to contain overview of a MS"""
Expand Down Expand Up @@ -399,7 +401,7 @@ def split_by_field(
with table(str(ms.path), ack=False) as tab: # noqa: F841
for split_name, split_idx in zip(fields, field_idxs):
logger.info(f"Selecting FIELD={split_name}")
sub_ms = taql(f"select * from $tab where FIELD_ID=={split_idx}")
sub_ms = table.taql(f"select * from $tab where FIELD_ID=={split_idx}")

out_ms_str = create_ms_name(ms_path=ms.path, field=split_name)
out_path = ms_out_dir / Path(out_ms_str).name
Expand Down
4 changes: 3 additions & 1 deletion flint/peel/potato.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import numpy as np
from astropy.coordinates import SkyCoord
from astropy.table import Table
from casacore.tables import table
from casatools.table import table as table_object

from flint.imager.wsclean import WSCleanOptions
from flint.logging import logger
Expand All @@ -38,6 +38,8 @@
get_packaged_resource_path,
)

table = table_object()


class PotatoConfigOptions(NamedTuple):
"""Container class to hold options that go into the potatopy
Expand Down
4 changes: 3 additions & 1 deletion flint/selfcal/casa.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from shutil import copytree
from typing import Any, Dict, NamedTuple, Optional

from casacore.tables import table
from casatools.table import table as table_object
from casatasks import applycal, cvel, gaincal, mstransform

from flint.exceptions import GainCalError, MSError
Expand All @@ -20,6 +20,8 @@
from flint.naming import get_selfcal_ms_name
from flint.utils import remove_files_folders, rsync_copy_directory, zip_folder

table = table_object()


class GainCalOptions(NamedTuple):
"""Options provided to the casatasks gaincal function. Most options correspond to those in gaincal."""
Expand Down
4 changes: 3 additions & 1 deletion flint/sky_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
from astropy.coordinates import Angle, SkyCoord
from astropy.table import QTable, Table
from astropy.table.row import Row
from casacore.tables import table
from casatools.table import table as table_object
from scipy.optimize import curve_fit

from flint.catalogue import KNOWN_REFERENCE_CATALOGUES, Catalogue
from flint.logging import logger
from flint.utils import get_packaged_resource_path

table = table_object()

KNOWN_PB_TYPES = ("gaussian", "sincsquared", "airy")


Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ include = [
python = "3.8"
astropy = "*"
numpy = "<1.24"
python-casacore = "*"
scipy = "*"
spython = "^0.3.1"
fixms = ">=0.2.6"
Expand All @@ -28,7 +27,7 @@ prefect = "^2.10.0"
prefect-dask = "^0.2.4"
dask-jobqueue = "*"
casadata = "^2023.7.3"
#casatools = "6.5.3.28"
casatools = "*"
casatasks = "6.5.1.23"
RACS-tools = "^2.2.4"
aegeantools = "2.3.0"
Expand Down
4 changes: 3 additions & 1 deletion tests/test_flagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@

import numpy as np
import pytest
from casacore.tables import table
from casatools.table import table as table_object

from flint.flagging import flag_ms_zero_uvws
from flint.utils import get_packaged_resource_path

table = table_object()


@pytest.fixture
def ms_example(tmpdir):
Expand Down
8 changes: 6 additions & 2 deletions tests/test_ms.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import numpy as np
import pytest
from casacore.tables import table
from casatools.table import table as table_object

from flint.calibrate.aocalibrate import ApplySolutions
from flint.exceptions import MSError
Expand All @@ -21,6 +21,8 @@
)
from flint.utils import get_packaged_resource_path

table = table_object()


def test_find_mss(tmpdir):
tmpdir = Path(tmpdir)
Expand Down Expand Up @@ -61,7 +63,9 @@ def casda_example(tmpdir):
def _test_the_data(ms):
"""Some very simple tests for the rotation. The expected numbers come from manually
stabbing the MSs"""
from casacore.tables import table
from casatools.table import table as table_object

table = table_object()

with table(str(ms), ack=False) as tab:
data = tab.getcol("DATA")
Expand Down
Loading