Skip to content

Update pre-commit-config and add deps to pyproject#223

Open
Kitchi wants to merge 2 commits intomainfrom
179-add-nbstripout-to-pre-commit
Open

Update pre-commit-config and add deps to pyproject#223
Kitchi wants to merge 2 commits intomainfrom
179-add-nbstripout-to-pre-commit

Conversation

@Kitchi
Copy link
Copy Markdown
Contributor

@Kitchi Kitchi commented Apr 8, 2026

Update the pre-commit config YAML file to include nbstripout. It also removes an old poetry config that was failing, and added a fix for the AWS credential check failing if it didn't find any valid credentials.

Add nbstripout and pre-commit to the pyproject [all] dependency list.

Update the pre-commit config YAML file to include nbstripout. It also removes
an old poetry config that was failing, and added a fix for the AWS credential
check failing if it didn't find any valid credentials.

Add nbstripout and pre-commit to the pyproject [all] dependency list.
@Kitchi Kitchi requested a review from Copilot April 8, 2026 15:03
@Kitchi Kitchi linked an issue Apr 8, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the repository’s development tooling configuration by refining pre-commit hooks (including adding nbstripout) and ensuring the relevant tooling dependencies are included in the pyproject.toml optional [all] extras.

Changes:

  • Add pre-commit and nbstripout to the all optional dependency set in pyproject.toml.
  • Update .pre-commit-config.yaml by removing Poetry hooks, adding nbstripout, adjusting detect-aws-credentials behavior, and bumping/adjusting some hook configurations (e.g., pyupgrade, isort).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pyproject.toml Adds pre-commit and nbstripout to the [project.optional-dependencies].all extras list.
.pre-commit-config.yaml Removes Poetry hooks, adds nbstripout, and updates hook args/versions (including AWS credentials hook behavior).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2026

❌ 13 Tests Failed:

Tests completed Failed Passed Skipped
528 13 515 0
View the top 3 failed test(s) by shortest run time
tests/unit/core/imaging/imaging_utils/test_standard_image_grid_preparation.py::TestStandardImGridPrep::test_remove_padding
Stack Traces | 0.008s run time
self = <test_standard_image_grid_preparation.TestStandardImGridPrep testMethod=test_remove_padding>

    def test_remove_padding(self):
        a = self.make_image_xds()
        ra_o, dec_o = (
>           a.right_ascension[99, 99].data,
            ^^^^^^^^^^^^^^^^^
            a.declination[99, 99].data,
        )

.../imaging/imaging_utils/test_standard_image_grid_preparation.py:70: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Dataset> Size: 163kB
Dimensions:            (time: 1, frequency: 1, polarization: 1, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
name = 'right_ascension'

    def __getattr__(self, name: str) -> Any:
        if name not in {"__dict__", "__setstate__"}:
            # this avoids an infinite loop when pickle looks for the
            # __setstate__ attribute before the xarray object is initialized
            for source in self._attr_sources:
                with suppress(KeyError):
                    return source[name]
>       raise AttributeError(
            f"{type(self).__name__!r} object has no attribute {name!r}"
        )
E       AttributeError: 'Dataset' object has no attribute 'right_ascension'

.../hostedtoolcache/Python/3.11.15.../x64/lib/python3.11.../xarray/core/common.py:306: AttributeError
tests/unit/core/imaging/test_imager.py::TestEndToEnd::test_stokes_i_only
Stack Traces | 0.125s run time
self = <xarray.Dataset> Size: 323kB
Dimensions:            (time: 1, frequency: 1, polarization: 1, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
name = 'right_ascension'

    def _construct_dataarray(self, name: Hashable) -> DataArray:
        """Construct a DataArray by indexing this dataset"""
        from xarray.core.dataarray import DataArray
    
        try:
>           variable = self._variables[name]
                       ^^^^^^^^^^^^^^^^^^^^^
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1237: KeyError

During handling of the above exception, another exception occurred:

self = <xarray.Dataset> Size: 323kB
Dimensions:            (time: 1, frequency: 1, polarization: 1, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
>               return self._construct_dataarray(key)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1344: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1239: in _construct_dataarray
    _, name, variable = _get_virtual_variable(self._variables, name, self.sizes)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

variables = {'RESIDUAL': <xarray.Variable (time: 1, frequency: 1, polarization: 1, l: 200, m: 200)> Size: 320kB
array([[[[[-0.7090...-04, -2.032622e-04])
Attributes:
    note:     l is the angle measured from the reference direction to the eas..., ...}
key = 'right_ascension'
dim_sizes = Frozen({'time': 1, 'frequency': 1, 'polarization': 1, 'l': 200, 'm': 200, 'beam_params_label': 3})

    def _get_virtual_variable(
        variables, key: Hashable, dim_sizes: Mapping | None = None
    ) -> tuple[Hashable, Hashable, Variable]:
        """Get a virtual variable (e.g., 'time.year') from a dict of xarray.Variable
        objects (if possible)
    
        """
        from xarray.core.dataarray import DataArray
    
        if dim_sizes is None:
            dim_sizes = {}
    
        if key in dim_sizes:
            data = pd.Index(range(dim_sizes[key]), name=key)
            variable = IndexVariable((key,), data)
            return key, key, variable
    
        if not isinstance(key, str):
            raise KeyError(key)
    
        split_key = key.split(".", 1)
        if len(split_key) != 2:
>           raise KeyError(key)
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset_utils.py:79: KeyError

The above exception was the direct cause of the following exception:

self = <tests.unit.core.imaging.test_imager.TestEndToEnd object at 0x7f63706cdcd0>
ms4_copy = ([array([ 93, 122, 111, 104]), array([ 82,  82,  77, 118]), array([1., 1., 1., 1.])], 200, np.float64(2.05315385437059...   WIND_SPEED           (station_name, time_weather) float64 4kB ...
        Attributes:
            type:     weather)
default_params = {'cell_size': (np.float64(-2.053153854370599e-06), np.float64(2.053153854370599e-06)), 'corr_type': 'linear', 'image_size': (200, 200)}

    def test_stokes_i_only(self, ms4_copy, default_params):
        _, npix, _, ms4 = ms4_copy
        params = {**default_params, "stokes": ["I"], "niter": 100, "nmajor": 1}
>       model, residual, _, _ = run_imaging_loop(ms4, params)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../core/imaging/test_imager.py:294: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/imager.py:301: in run_imaging_loop
    return_dict, new_model_xds, residual_xds = deconvolve(
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:198: in deconvolve
    phase_center = get_phase_center(dirty_image_xds)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:34: in get_phase_center
    ra_shape = dirty_image_xds.coords["right_ascension"].shape
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/coordinates.py:927: in __getitem__
    return self._data[key]
           ^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Dataset> Size: 323kB
Dimensions:            (time: 1, frequency: 1, polarization: 1, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
                return self._construct_dataarray(key)
            except KeyError as e:
                message = f"No variable named {key!r}."
    
                best_guess = utils.did_you_mean(key, self.variables.keys())
                if best_guess:
                    message += f" {best_guess}"
                else:
                    message += f" Variables on the dataset include {shorten_list_repr(list(self.variables.keys()), max_items=10)}"
    
                # If someone attempts `ds['foo' , 'bar']` instead of `ds[['foo', 'bar']]`
                if isinstance(key, tuple):
                    message += f"\nHint: use a list to select multiple variables, for example `ds[{list(key)}]`"
>               raise KeyError(message) from e
E               KeyError: "No variable named 'right_ascension'. Variables on the dataset include ['time', 'frequency', 'velocity', 'polarization', 'l', 'm', 'beam_params_label', 'RESIDUAL']"

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1357: KeyError
tests/unit/core/imaging/test_imager.py::TestEndToEnd::test_shapes
Stack Traces | 0.126s run time
self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
name = 'right_ascension'

    def _construct_dataarray(self, name: Hashable) -> DataArray:
        """Construct a DataArray by indexing this dataset"""
        from xarray.core.dataarray import DataArray
    
        try:
>           variable = self._variables[name]
                       ^^^^^^^^^^^^^^^^^^^^^
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1237: KeyError

During handling of the above exception, another exception occurred:

self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
>               return self._construct_dataarray(key)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1344: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1239: in _construct_dataarray
    _, name, variable = _get_virtual_variable(self._variables, name, self.sizes)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

variables = {'RESIDUAL': <xarray.Variable (time: 1, frequency: 1, polarization: 2, l: 200, m: 200)> Size: 640kB
array([[[[[-7.0908...-04, -2.032622e-04])
Attributes:
    note:     l is the angle measured from the reference direction to the eas..., ...}
key = 'right_ascension'
dim_sizes = Frozen({'time': 1, 'frequency': 1, 'polarization': 2, 'l': 200, 'm': 200, 'beam_params_label': 3})

    def _get_virtual_variable(
        variables, key: Hashable, dim_sizes: Mapping | None = None
    ) -> tuple[Hashable, Hashable, Variable]:
        """Get a virtual variable (e.g., 'time.year') from a dict of xarray.Variable
        objects (if possible)
    
        """
        from xarray.core.dataarray import DataArray
    
        if dim_sizes is None:
            dim_sizes = {}
    
        if key in dim_sizes:
            data = pd.Index(range(dim_sizes[key]), name=key)
            variable = IndexVariable((key,), data)
            return key, key, variable
    
        if not isinstance(key, str):
            raise KeyError(key)
    
        split_key = key.split(".", 1)
        if len(split_key) != 2:
>           raise KeyError(key)
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset_utils.py:79: KeyError

The above exception was the direct cause of the following exception:

self = <tests.unit.core.imaging.test_imager.TestEndToEnd object at 0x7f63706ce0d0>
ms4_copy = ([array([ 93, 122, 111, 104]), array([ 82,  82,  77, 118]), array([1., 1., 1., 1.])], 200, np.float64(2.05315385437059...   WIND_SPEED           (station_name, time_weather) float64 4kB ...
        Attributes:
            type:     weather)
default_params = {'cell_size': (np.float64(-2.053153854370599e-06), np.float64(2.053153854370599e-06)), 'corr_type': 'linear', 'image_size': (200, 200)}

    def test_shapes(self, ms4_copy, default_params):
        _, npix, _, ms4 = ms4_copy
        params = {**default_params, "niter": 100, "nmajor": 1}
>       model, residual, _, _ = run_imaging_loop(ms4, params)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../core/imaging/test_imager.py:339: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/imager.py:301: in run_imaging_loop
    return_dict, new_model_xds, residual_xds = deconvolve(
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:198: in deconvolve
    phase_center = get_phase_center(dirty_image_xds)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:34: in get_phase_center
    ra_shape = dirty_image_xds.coords["right_ascension"].shape
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/coordinates.py:927: in __getitem__
    return self._data[key]
           ^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
                return self._construct_dataarray(key)
            except KeyError as e:
                message = f"No variable named {key!r}."
    
                best_guess = utils.did_you_mean(key, self.variables.keys())
                if best_guess:
                    message += f" {best_guess}"
                else:
                    message += f" Variables on the dataset include {shorten_list_repr(list(self.variables.keys()), max_items=10)}"
    
                # If someone attempts `ds['foo' , 'bar']` instead of `ds[['foo', 'bar']]`
                if isinstance(key, tuple):
                    message += f"\nHint: use a list to select multiple variables, for example `ds[{list(key)}]`"
>               raise KeyError(message) from e
E               KeyError: "No variable named 'right_ascension'. Variables on the dataset include ['time', 'frequency', 'velocity', 'polarization', 'l', 'm', 'beam_params_label', 'RESIDUAL']"

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1357: KeyError
tests/unit/core/imaging/test_imager.py::TestEndToEnd::test_auto_stokes_2corr_linear
Stack Traces | 0.127s run time
self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
name = 'right_ascension'

    def _construct_dataarray(self, name: Hashable) -> DataArray:
        """Construct a DataArray by indexing this dataset"""
        from xarray.core.dataarray import DataArray
    
        try:
>           variable = self._variables[name]
                       ^^^^^^^^^^^^^^^^^^^^^
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1237: KeyError

During handling of the above exception, another exception occurred:

self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
>               return self._construct_dataarray(key)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1344: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1239: in _construct_dataarray
    _, name, variable = _get_virtual_variable(self._variables, name, self.sizes)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

variables = {'RESIDUAL': <xarray.Variable (time: 1, frequency: 1, polarization: 2, l: 200, m: 200)> Size: 640kB
array([[[[[-7.0908...-04, -2.032622e-04])
Attributes:
    note:     l is the angle measured from the reference direction to the eas..., ...}
key = 'right_ascension'
dim_sizes = Frozen({'time': 1, 'frequency': 1, 'polarization': 2, 'l': 200, 'm': 200, 'beam_params_label': 3})

    def _get_virtual_variable(
        variables, key: Hashable, dim_sizes: Mapping | None = None
    ) -> tuple[Hashable, Hashable, Variable]:
        """Get a virtual variable (e.g., 'time.year') from a dict of xarray.Variable
        objects (if possible)
    
        """
        from xarray.core.dataarray import DataArray
    
        if dim_sizes is None:
            dim_sizes = {}
    
        if key in dim_sizes:
            data = pd.Index(range(dim_sizes[key]), name=key)
            variable = IndexVariable((key,), data)
            return key, key, variable
    
        if not isinstance(key, str):
            raise KeyError(key)
    
        split_key = key.split(".", 1)
        if len(split_key) != 2:
>           raise KeyError(key)
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset_utils.py:79: KeyError

The above exception was the direct cause of the following exception:

self = <tests.unit.core.imaging.test_imager.TestEndToEnd object at 0x7f63706db210>
ms4_copy = ([array([ 93, 122, 111, 104]), array([ 82,  82,  77, 118]), array([1., 1., 1., 1.])], 200, np.float64(2.05315385437059...   WIND_SPEED           (station_name, time_weather) float64 4kB ...
        Attributes:
            type:     weather)

    def test_auto_stokes_2corr_linear(self, ms4_copy):
        """2-corr linear → ['I', 'Q'] auto-detection produces 2-stokes output."""
        _, npix, cell_rad, ms4 = ms4_copy
        n_corr = len(ms4.coords["polarization"])
        assert n_corr == 2, "Test data should have 2 correlations"
        # Run minimal imaging — niter=1 to avoid deconvolve's niter>0 validation
>       model, _, _, controller = run_imaging_loop(
            ms4,
            {
                "cell_size": (-cell_rad, cell_rad),
                "image_size": (npix, npix),
                "corr_type": "linear",
                "niter": 1,
                "nmajor": 1,
            },
        )

.../core/imaging/test_imager.py:169: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/imager.py:301: in run_imaging_loop
    return_dict, new_model_xds, residual_xds = deconvolve(
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:198: in deconvolve
    phase_center = get_phase_center(dirty_image_xds)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:34: in get_phase_center
    ra_shape = dirty_image_xds.coords["right_ascension"].shape
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/coordinates.py:927: in __getitem__
    return self._data[key]
           ^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
                return self._construct_dataarray(key)
            except KeyError as e:
                message = f"No variable named {key!r}."
    
                best_guess = utils.did_you_mean(key, self.variables.keys())
                if best_guess:
                    message += f" {best_guess}"
                else:
                    message += f" Variables on the dataset include {shorten_list_repr(list(self.variables.keys()), max_items=10)}"
    
                # If someone attempts `ds['foo' , 'bar']` instead of `ds[['foo', 'bar']]`
                if isinstance(key, tuple):
                    message += f"\nHint: use a list to select multiple variables, for example `ds[{list(key)}]`"
>               raise KeyError(message) from e
E               KeyError: "No variable named 'right_ascension'. Variables on the dataset include ['time', 'frequency', 'velocity', 'polarization', 'l', 'm', 'beam_params_label', 'RESIDUAL']"

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1357: KeyError
tests/unit/core/imaging/test_imager.py::TestEndToEnd::test_controller_state_serializable
Stack Traces | 0.127s run time
self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
name = 'right_ascension'

    def _construct_dataarray(self, name: Hashable) -> DataArray:
        """Construct a DataArray by indexing this dataset"""
        from xarray.core.dataarray import DataArray
    
        try:
>           variable = self._variables[name]
                       ^^^^^^^^^^^^^^^^^^^^^
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1237: KeyError

During handling of the above exception, another exception occurred:

self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
>               return self._construct_dataarray(key)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1344: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1239: in _construct_dataarray
    _, name, variable = _get_virtual_variable(self._variables, name, self.sizes)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

variables = {'RESIDUAL': <xarray.Variable (time: 1, frequency: 1, polarization: 2, l: 200, m: 200)> Size: 640kB
array([[[[[-7.0908...-04, -2.032622e-04])
Attributes:
    note:     l is the angle measured from the reference direction to the eas..., ...}
key = 'right_ascension'
dim_sizes = Frozen({'time': 1, 'frequency': 1, 'polarization': 2, 'l': 200, 'm': 200, 'beam_params_label': 3})

    def _get_virtual_variable(
        variables, key: Hashable, dim_sizes: Mapping | None = None
    ) -> tuple[Hashable, Hashable, Variable]:
        """Get a virtual variable (e.g., 'time.year') from a dict of xarray.Variable
        objects (if possible)
    
        """
        from xarray.core.dataarray import DataArray
    
        if dim_sizes is None:
            dim_sizes = {}
    
        if key in dim_sizes:
            data = pd.Index(range(dim_sizes[key]), name=key)
            variable = IndexVariable((key,), data)
            return key, key, variable
    
        if not isinstance(key, str):
            raise KeyError(key)
    
        split_key = key.split(".", 1)
        if len(split_key) != 2:
>           raise KeyError(key)
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset_utils.py:79: KeyError

The above exception was the direct cause of the following exception:

self = <tests.unit.core.imaging.test_imager.TestEndToEnd object at 0x7f63706cec90>
ms4_copy = ([array([ 93, 122, 111, 104]), array([ 82,  82,  77, 118]), array([1., 1., 1., 1.])], 200, np.float64(2.05315385437059...   WIND_SPEED           (station_name, time_weather) float64 4kB ...
        Attributes:
            type:     weather)
default_params = {'cell_size': (np.float64(-2.053153854370599e-06), np.float64(2.053153854370599e-06)), 'corr_type': 'linear', 'image_size': (200, 200)}

    def test_controller_state_serializable(self, ms4_copy, default_params):
        _, _, _, ms4 = ms4_copy
        params = {**default_params, "niter": 100, "nmajor": 1}
>       _, _, _, controller = run_imaging_loop(ms4, params)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../core/imaging/test_imager.py:328: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/imager.py:301: in run_imaging_loop
    return_dict, new_model_xds, residual_xds = deconvolve(
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:198: in deconvolve
    phase_center = get_phase_center(dirty_image_xds)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:34: in get_phase_center
    ra_shape = dirty_image_xds.coords["right_ascension"].shape
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/coordinates.py:927: in __getitem__
    return self._data[key]
           ^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
                return self._construct_dataarray(key)
            except KeyError as e:
                message = f"No variable named {key!r}."
    
                best_guess = utils.did_you_mean(key, self.variables.keys())
                if best_guess:
                    message += f" {best_guess}"
                else:
                    message += f" Variables on the dataset include {shorten_list_repr(list(self.variables.keys()), max_items=10)}"
    
                # If someone attempts `ds['foo' , 'bar']` instead of `ds[['foo', 'bar']]`
                if isinstance(key, tuple):
                    message += f"\nHint: use a list to select multiple variables, for example `ds[{list(key)}]`"
>               raise KeyError(message) from e
E               KeyError: "No variable named 'right_ascension'. Variables on the dataset include ['time', 'frequency', 'velocity', 'polarization', 'l', 'm', 'beam_params_label', 'RESIDUAL']"

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1357: KeyError
tests/unit/core/imaging/test_imager.py::TestEndToEnd::test_dtype_is_float
Stack Traces | 0.127s run time
self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
name = 'right_ascension'

    def _construct_dataarray(self, name: Hashable) -> DataArray:
        """Construct a DataArray by indexing this dataset"""
        from xarray.core.dataarray import DataArray
    
        try:
>           variable = self._variables[name]
                       ^^^^^^^^^^^^^^^^^^^^^
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1237: KeyError

During handling of the above exception, another exception occurred:

self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
>               return self._construct_dataarray(key)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1344: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1239: in _construct_dataarray
    _, name, variable = _get_virtual_variable(self._variables, name, self.sizes)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

variables = {'RESIDUAL': <xarray.Variable (time: 1, frequency: 1, polarization: 2, l: 200, m: 200)> Size: 640kB
array([[[[[-7.0908...-04, -2.032622e-04])
Attributes:
    note:     l is the angle measured from the reference direction to the eas..., ...}
key = 'right_ascension'
dim_sizes = Frozen({'time': 1, 'frequency': 1, 'polarization': 2, 'l': 200, 'm': 200, 'beam_params_label': 3})

    def _get_virtual_variable(
        variables, key: Hashable, dim_sizes: Mapping | None = None
    ) -> tuple[Hashable, Hashable, Variable]:
        """Get a virtual variable (e.g., 'time.year') from a dict of xarray.Variable
        objects (if possible)
    
        """
        from xarray.core.dataarray import DataArray
    
        if dim_sizes is None:
            dim_sizes = {}
    
        if key in dim_sizes:
            data = pd.Index(range(dim_sizes[key]), name=key)
            variable = IndexVariable((key,), data)
            return key, key, variable
    
        if not isinstance(key, str):
            raise KeyError(key)
    
        split_key = key.split(".", 1)
        if len(split_key) != 2:
>           raise KeyError(key)
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset_utils.py:79: KeyError

The above exception was the direct cause of the following exception:

self = <tests.unit.core.imaging.test_imager.TestEndToEnd object at 0x7f63706cf3d0>
ms4_copy = ([array([ 93, 122, 111, 104]), array([ 82,  82,  77, 118]), array([1., 1., 1., 1.])], 200, np.float64(2.05315385437059...   WIND_SPEED           (station_name, time_weather) float64 4kB ...
        Attributes:
            type:     weather)
default_params = {'cell_size': (np.float64(-2.053153854370599e-06), np.float64(2.053153854370599e-06)), 'corr_type': 'linear', 'image_size': (200, 200)}

    def test_dtype_is_float(self, ms4_copy, default_params):
        """Regression: 2026-02-09 complex dtype bugfix."""
        _, _, _, ms4 = ms4_copy
        params = {**default_params, "niter": 100, "nmajor": 1}
>       model, residual, _, _ = run_imaging_loop(ms4, params)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../core/imaging/test_imager.py:352: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/imager.py:301: in run_imaging_loop
    return_dict, new_model_xds, residual_xds = deconvolve(
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:198: in deconvolve
    phase_center = get_phase_center(dirty_image_xds)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:34: in get_phase_center
    ra_shape = dirty_image_xds.coords["right_ascension"].shape
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/coordinates.py:927: in __getitem__
    return self._data[key]
           ^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
                return self._construct_dataarray(key)
            except KeyError as e:
                message = f"No variable named {key!r}."
    
                best_guess = utils.did_you_mean(key, self.variables.keys())
                if best_guess:
                    message += f" {best_guess}"
                else:
                    message += f" Variables on the dataset include {shorten_list_repr(list(self.variables.keys()), max_items=10)}"
    
                # If someone attempts `ds['foo' , 'bar']` instead of `ds[['foo', 'bar']]`
                if isinstance(key, tuple):
                    message += f"\nHint: use a list to select multiple variables, for example `ds[{list(key)}]`"
>               raise KeyError(message) from e
E               KeyError: "No variable named 'right_ascension'. Variables on the dataset include ['time', 'frequency', 'velocity', 'polarization', 'l', 'm', 'beam_params_label', 'RESIDUAL']"

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1357: KeyError
tests/unit/core/imaging/test_imager.py::TestEndToEnd::test_keys_and_fields
Stack Traces | 0.127s run time
self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
name = 'right_ascension'

    def _construct_dataarray(self, name: Hashable) -> DataArray:
        """Construct a DataArray by indexing this dataset"""
        from xarray.core.dataarray import DataArray
    
        try:
>           variable = self._variables[name]
                       ^^^^^^^^^^^^^^^^^^^^^
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1237: KeyError

During handling of the above exception, another exception occurred:

self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
>               return self._construct_dataarray(key)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1344: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1239: in _construct_dataarray
    _, name, variable = _get_virtual_variable(self._variables, name, self.sizes)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

variables = {'RESIDUAL': <xarray.Variable (time: 1, frequency: 1, polarization: 2, l: 200, m: 200)> Size: 640kB
array([[[[[-7.0908...-04, -2.032622e-04])
Attributes:
    note:     l is the angle measured from the reference direction to the eas..., ...}
key = 'right_ascension'
dim_sizes = Frozen({'time': 1, 'frequency': 1, 'polarization': 2, 'l': 200, 'm': 200, 'beam_params_label': 3})

    def _get_virtual_variable(
        variables, key: Hashable, dim_sizes: Mapping | None = None
    ) -> tuple[Hashable, Hashable, Variable]:
        """Get a virtual variable (e.g., 'time.year') from a dict of xarray.Variable
        objects (if possible)
    
        """
        from xarray.core.dataarray import DataArray
    
        if dim_sizes is None:
            dim_sizes = {}
    
        if key in dim_sizes:
            data = pd.Index(range(dim_sizes[key]), name=key)
            variable = IndexVariable((key,), data)
            return key, key, variable
    
        if not isinstance(key, str):
            raise KeyError(key)
    
        split_key = key.split(".", 1)
        if len(split_key) != 2:
>           raise KeyError(key)
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset_utils.py:79: KeyError

The above exception was the direct cause of the following exception:

self = <tests.unit.core.imaging.test_imager.TestEndToEnd object at 0x7f63706cda90>
ms4_copy = ([array([ 93, 122, 111, 104]), array([ 82,  82,  77, 118]), array([1., 1., 1., 1.])], 200, np.float64(2.05315385437059...   WIND_SPEED           (station_name, time_weather) float64 4kB ...
        Attributes:
            type:     weather)
default_params = {'cell_size': (np.float64(-2.053153854370599e-06), np.float64(2.053153854370599e-06)), 'corr_type': 'linear', 'image_size': (200, 200)}

    def test_keys_and_fields(self, ms4_copy, default_params):
        _, _, _, ms4 = ms4_copy
        params = {**default_params, "niter": 500, "nmajor": 2}
>       _, _, return_dict, controller = run_imaging_loop(ms4, params)
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../core/imaging/test_imager.py:305: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/imager.py:301: in run_imaging_loop
    return_dict, new_model_xds, residual_xds = deconvolve(
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:198: in deconvolve
    phase_center = get_phase_center(dirty_image_xds)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:34: in get_phase_center
    ra_shape = dirty_image_xds.coords["right_ascension"].shape
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/coordinates.py:927: in __getitem__
    return self._data[key]
           ^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
                return self._construct_dataarray(key)
            except KeyError as e:
                message = f"No variable named {key!r}."
    
                best_guess = utils.did_you_mean(key, self.variables.keys())
                if best_guess:
                    message += f" {best_guess}"
                else:
                    message += f" Variables on the dataset include {shorten_list_repr(list(self.variables.keys()), max_items=10)}"
    
                # If someone attempts `ds['foo' , 'bar']` instead of `ds[['foo', 'bar']]`
                if isinstance(key, tuple):
                    message += f"\nHint: use a list to select multiple variables, for example `ds[{list(key)}]`"
>               raise KeyError(message) from e
E               KeyError: "No variable named 'right_ascension'. Variables on the dataset include ['time', 'frequency', 'velocity', 'polarization', 'l', 'm', 'beam_params_label', 'RESIDUAL']"

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1357: KeyError
tests/unit/core/imaging/test_imager.py::TestEndToEnd::test_model_is_finite_and_nonzero
Stack Traces | 0.127s run time
self = <xarray.Dataset> Size: 323kB
Dimensions:            (time: 1, frequency: 1, polarization: 1, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
name = 'right_ascension'

    def _construct_dataarray(self, name: Hashable) -> DataArray:
        """Construct a DataArray by indexing this dataset"""
        from xarray.core.dataarray import DataArray
    
        try:
>           variable = self._variables[name]
                       ^^^^^^^^^^^^^^^^^^^^^
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1237: KeyError

During handling of the above exception, another exception occurred:

self = <xarray.Dataset> Size: 323kB
Dimensions:            (time: 1, frequency: 1, polarization: 1, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
>               return self._construct_dataarray(key)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1344: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1239: in _construct_dataarray
    _, name, variable = _get_virtual_variable(self._variables, name, self.sizes)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

variables = {'RESIDUAL': <xarray.Variable (time: 1, frequency: 1, polarization: 1, l: 200, m: 200)> Size: 320kB
array([[[[[-0.7090...-04, -2.032622e-04])
Attributes:
    note:     l is the angle measured from the reference direction to the eas..., ...}
key = 'right_ascension'
dim_sizes = Frozen({'time': 1, 'frequency': 1, 'polarization': 1, 'l': 200, 'm': 200, 'beam_params_label': 3})

    def _get_virtual_variable(
        variables, key: Hashable, dim_sizes: Mapping | None = None
    ) -> tuple[Hashable, Hashable, Variable]:
        """Get a virtual variable (e.g., 'time.year') from a dict of xarray.Variable
        objects (if possible)
    
        """
        from xarray.core.dataarray import DataArray
    
        if dim_sizes is None:
            dim_sizes = {}
    
        if key in dim_sizes:
            data = pd.Index(range(dim_sizes[key]), name=key)
            variable = IndexVariable((key,), data)
            return key, key, variable
    
        if not isinstance(key, str):
            raise KeyError(key)
    
        split_key = key.split(".", 1)
        if len(split_key) != 2:
>           raise KeyError(key)
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset_utils.py:79: KeyError

The above exception was the direct cause of the following exception:

self = <tests.unit.core.imaging.test_imager.TestEndToEnd object at 0x7f63706ce750>
ms4_copy = ([array([ 93, 122, 111, 104]), array([ 82,  82,  77, 118]), array([1., 1., 1., 1.])], 200, np.float64(2.05315385437059...   WIND_SPEED           (station_name, time_weather) float64 4kB ...
        Attributes:
            type:     weather)
default_params = {'cell_size': (np.float64(-2.053153854370599e-06), np.float64(2.053153854370599e-06)), 'corr_type': 'linear', 'image_size': (200, 200)}

    def test_model_is_finite_and_nonzero(self, ms4_copy, default_params):
        _, _, _, ms4 = ms4_copy
        params = {
            **default_params,
            "stokes": ["I"],
            "niter": 5,
            "nmajor": 1,
            "threshold": 0.0,
        }
>       model, residual, _, controller = run_imaging_loop(ms4, params)
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../core/imaging/test_imager.py:281: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/imager.py:301: in run_imaging_loop
    return_dict, new_model_xds, residual_xds = deconvolve(
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:198: in deconvolve
    phase_center = get_phase_center(dirty_image_xds)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:34: in get_phase_center
    ra_shape = dirty_image_xds.coords["right_ascension"].shape
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/coordinates.py:927: in __getitem__
    return self._data[key]
           ^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Dataset> Size: 323kB
Dimensions:            (time: 1, frequency: 1, polarization: 1, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
                return self._construct_dataarray(key)
            except KeyError as e:
                message = f"No variable named {key!r}."
    
                best_guess = utils.did_you_mean(key, self.variables.keys())
                if best_guess:
                    message += f" {best_guess}"
                else:
                    message += f" Variables on the dataset include {shorten_list_repr(list(self.variables.keys()), max_items=10)}"
    
                # If someone attempts `ds['foo' , 'bar']` instead of `ds[['foo', 'bar']]`
                if isinstance(key, tuple):
                    message += f"\nHint: use a list to select multiple variables, for example `ds[{list(key)}]`"
>               raise KeyError(message) from e
E               KeyError: "No variable named 'right_ascension'. Variables on the dataset include ['time', 'frequency', 'velocity', 'polarization', 'l', 'm', 'beam_params_label', 'RESIDUAL']"

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1357: KeyError
tests/unit/core/imaging/test_imager.py::TestEndToEnd::test_single_major
Stack Traces | 0.128s run time
self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
name = 'right_ascension'

    def _construct_dataarray(self, name: Hashable) -> DataArray:
        """Construct a DataArray by indexing this dataset"""
        from xarray.core.dataarray import DataArray
    
        try:
>           variable = self._variables[name]
                       ^^^^^^^^^^^^^^^^^^^^^
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1237: KeyError

During handling of the above exception, another exception occurred:

self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
>               return self._construct_dataarray(key)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1344: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1239: in _construct_dataarray
    _, name, variable = _get_virtual_variable(self._variables, name, self.sizes)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

variables = {'RESIDUAL': <xarray.Variable (time: 1, frequency: 1, polarization: 2, l: 200, m: 200)> Size: 640kB
array([[[[[-7.0908...-04, -2.032622e-04])
Attributes:
    note:     l is the angle measured from the reference direction to the eas..., ...}
key = 'right_ascension'
dim_sizes = Frozen({'time': 1, 'frequency': 1, 'polarization': 2, 'l': 200, 'm': 200, 'beam_params_label': 3})

    def _get_virtual_variable(
        variables, key: Hashable, dim_sizes: Mapping | None = None
    ) -> tuple[Hashable, Hashable, Variable]:
        """Get a virtual variable (e.g., 'time.year') from a dict of xarray.Variable
        objects (if possible)
    
        """
        from xarray.core.dataarray import DataArray
    
        if dim_sizes is None:
            dim_sizes = {}
    
        if key in dim_sizes:
            data = pd.Index(range(dim_sizes[key]), name=key)
            variable = IndexVariable((key,), data)
            return key, key, variable
    
        if not isinstance(key, str):
            raise KeyError(key)
    
        split_key = key.split(".", 1)
        if len(split_key) != 2:
>           raise KeyError(key)
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset_utils.py:79: KeyError

The above exception was the direct cause of the following exception:

self = <tests.unit.core.imaging.test_imager.TestEndToEnd object at 0x7f63706d9850>
ms4_copy = ([array([ 93, 122, 111, 104]), array([ 82,  82,  77, 118]), array([1., 1., 1., 1.])], 200, np.float64(2.05315385437059...   WIND_SPEED           (station_name, time_weather) float64 4kB ...
        Attributes:
            type:     weather)
default_params = {'cell_size': (np.float64(-2.053153854370599e-06), np.float64(2.053153854370599e-06)), 'corr_type': 'linear', 'image_size': (200, 200)}

    def test_single_major(self, ms4_copy, default_params):
        _, _, _, ms4 = ms4_copy
        params = {**default_params, "nmajor": 1, "niter": 500}
>       _, _, _, controller = run_imaging_loop(ms4, params)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../core/imaging/test_imager.py:231: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/imager.py:301: in run_imaging_loop
    return_dict, new_model_xds, residual_xds = deconvolve(
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:198: in deconvolve
    phase_center = get_phase_center(dirty_image_xds)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:34: in get_phase_center
    ra_shape = dirty_image_xds.coords["right_ascension"].shape
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/coordinates.py:927: in __getitem__
    return self._data[key]
           ^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
                return self._construct_dataarray(key)
            except KeyError as e:
                message = f"No variable named {key!r}."
    
                best_guess = utils.did_you_mean(key, self.variables.keys())
                if best_guess:
                    message += f" {best_guess}"
                else:
                    message += f" Variables on the dataset include {shorten_list_repr(list(self.variables.keys()), max_items=10)}"
    
                # If someone attempts `ds['foo' , 'bar']` instead of `ds[['foo', 'bar']]`
                if isinstance(key, tuple):
                    message += f"\nHint: use a list to select multiple variables, for example `ds[{list(key)}]`"
>               raise KeyError(message) from e
E               KeyError: "No variable named 'right_ascension'. Variables on the dataset include ['time', 'frequency', 'velocity', 'polarization', 'l', 'm', 'beam_params_label', 'RESIDUAL']"

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1357: KeyError
tests/unit/core/imaging/test_imager.py::TestEndToEnd::test_stops_at_nmajor
Stack Traces | 0.128s run time
self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
name = 'right_ascension'

    def _construct_dataarray(self, name: Hashable) -> DataArray:
        """Construct a DataArray by indexing this dataset"""
        from xarray.core.dataarray import DataArray
    
        try:
>           variable = self._variables[name]
                       ^^^^^^^^^^^^^^^^^^^^^
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1237: KeyError

During handling of the above exception, another exception occurred:

self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
>               return self._construct_dataarray(key)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1344: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1239: in _construct_dataarray
    _, name, variable = _get_virtual_variable(self._variables, name, self.sizes)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

variables = {'RESIDUAL': <xarray.Variable (time: 1, frequency: 1, polarization: 2, l: 200, m: 200)> Size: 640kB
array([[[[[-7.0908...-04, -2.032622e-04])
Attributes:
    note:     l is the angle measured from the reference direction to the eas..., ...}
key = 'right_ascension'
dim_sizes = Frozen({'time': 1, 'frequency': 1, 'polarization': 2, 'l': 200, 'm': 200, 'beam_params_label': 3})

    def _get_virtual_variable(
        variables, key: Hashable, dim_sizes: Mapping | None = None
    ) -> tuple[Hashable, Hashable, Variable]:
        """Get a virtual variable (e.g., 'time.year') from a dict of xarray.Variable
        objects (if possible)
    
        """
        from xarray.core.dataarray import DataArray
    
        if dim_sizes is None:
            dim_sizes = {}
    
        if key in dim_sizes:
            data = pd.Index(range(dim_sizes[key]), name=key)
            variable = IndexVariable((key,), data)
            return key, key, variable
    
        if not isinstance(key, str):
            raise KeyError(key)
    
        split_key = key.split(".", 1)
        if len(split_key) != 2:
>           raise KeyError(key)
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset_utils.py:79: KeyError

The above exception was the direct cause of the following exception:

self = <tests.unit.core.imaging.test_imager.TestEndToEnd object at 0x7f63706cf890>
ms4_copy = ([array([ 93, 122, 111, 104]), array([ 82,  82,  77, 118]), array([1., 1., 1., 1.])], 200, np.float64(2.05315385437059...   WIND_SPEED           (station_name, time_weather) float64 4kB ...
        Attributes:
            type:     weather)
default_params = {'cell_size': (np.float64(-2.053153854370599e-06), np.float64(2.053153854370599e-06)), 'corr_type': 'linear', 'image_size': (200, 200)}

    def test_stops_at_nmajor(self, ms4_copy, default_params):
        _, _, _, ms4 = ms4_copy
        params = {**default_params, "nmajor": 2, "niter": 5000, "threshold": 0.0}
>       _, _, _, controller = run_imaging_loop(ms4, params)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../core/imaging/test_imager.py:192: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/imager.py:301: in run_imaging_loop
    return_dict, new_model_xds, residual_xds = deconvolve(
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:198: in deconvolve
    phase_center = get_phase_center(dirty_image_xds)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:34: in get_phase_center
    ra_shape = dirty_image_xds.coords["right_ascension"].shape
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/coordinates.py:927: in __getitem__
    return self._data[key]
           ^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
                return self._construct_dataarray(key)
            except KeyError as e:
                message = f"No variable named {key!r}."
    
                best_guess = utils.did_you_mean(key, self.variables.keys())
                if best_guess:
                    message += f" {best_guess}"
                else:
                    message += f" Variables on the dataset include {shorten_list_repr(list(self.variables.keys()), max_items=10)}"
    
                # If someone attempts `ds['foo' , 'bar']` instead of `ds[['foo', 'bar']]`
                if isinstance(key, tuple):
                    message += f"\nHint: use a list to select multiple variables, for example `ds[{list(key)}]`"
>               raise KeyError(message) from e
E               KeyError: "No variable named 'right_ascension'. Variables on the dataset include ['time', 'frequency', 'velocity', 'polarization', 'l', 'm', 'beam_params_label', 'RESIDUAL']"

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1357: KeyError
tests/unit/core/imaging/test_imager.py::TestEndToEnd::test_stops_at_niter
Stack Traces | 0.129s run time
self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
name = 'right_ascension'

    def _construct_dataarray(self, name: Hashable) -> DataArray:
        """Construct a DataArray by indexing this dataset"""
        from xarray.core.dataarray import DataArray
    
        try:
>           variable = self._variables[name]
                       ^^^^^^^^^^^^^^^^^^^^^
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1237: KeyError

During handling of the above exception, another exception occurred:

self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
>               return self._construct_dataarray(key)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1344: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1239: in _construct_dataarray
    _, name, variable = _get_virtual_variable(self._variables, name, self.sizes)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

variables = {'RESIDUAL': <xarray.Variable (time: 1, frequency: 1, polarization: 2, l: 200, m: 200)> Size: 640kB
array([[[[[-7.0908...-04, -2.032622e-04])
Attributes:
    note:     l is the angle measured from the reference direction to the eas..., ...}
key = 'right_ascension'
dim_sizes = Frozen({'time': 1, 'frequency': 1, 'polarization': 2, 'l': 200, 'm': 200, 'beam_params_label': 3})

    def _get_virtual_variable(
        variables, key: Hashable, dim_sizes: Mapping | None = None
    ) -> tuple[Hashable, Hashable, Variable]:
        """Get a virtual variable (e.g., 'time.year') from a dict of xarray.Variable
        objects (if possible)
    
        """
        from xarray.core.dataarray import DataArray
    
        if dim_sizes is None:
            dim_sizes = {}
    
        if key in dim_sizes:
            data = pd.Index(range(dim_sizes[key]), name=key)
            variable = IndexVariable((key,), data)
            return key, key, variable
    
        if not isinstance(key, str):
            raise KeyError(key)
    
        split_key = key.split(".", 1)
        if len(split_key) != 2:
>           raise KeyError(key)
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset_utils.py:79: KeyError

The above exception was the direct cause of the following exception:

self = <tests.unit.core.imaging.test_imager.TestEndToEnd object at 0x7f63706db790>
ms4_copy = ([array([ 93, 122, 111, 104]), array([ 82,  82,  77, 118]), array([1., 1., 1., 1.])], 200, np.float64(2.05315385437059...   WIND_SPEED           (station_name, time_weather) float64 4kB ...
        Attributes:
            type:     weather)
default_params = {'cell_size': (np.float64(-2.053153854370599e-06), np.float64(2.053153854370599e-06)), 'corr_type': 'linear', 'image_size': (200, 200)}

    def test_stops_at_niter(self, ms4_copy, default_params):
        _, _, _, ms4 = ms4_copy
        params = {**default_params, "niter": 10, "nmajor": 20, "threshold": 0.0}
>       _, _, _, controller = run_imaging_loop(ms4, params)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../core/imaging/test_imager.py:185: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/imager.py:301: in run_imaging_loop
    return_dict, new_model_xds, residual_xds = deconvolve(
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:198: in deconvolve
    phase_center = get_phase_center(dirty_image_xds)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:34: in get_phase_center
    ra_shape = dirty_image_xds.coords["right_ascension"].shape
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/coordinates.py:927: in __getitem__
    return self._data[key]
           ^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Dataset> Size: 643kB
Dimensions:            (time: 1, frequency: 1, polarization: 2, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
                return self._construct_dataarray(key)
            except KeyError as e:
                message = f"No variable named {key!r}."
    
                best_guess = utils.did_you_mean(key, self.variables.keys())
                if best_guess:
                    message += f" {best_guess}"
                else:
                    message += f" Variables on the dataset include {shorten_list_repr(list(self.variables.keys()), max_items=10)}"
    
                # If someone attempts `ds['foo' , 'bar']` instead of `ds[['foo', 'bar']]`
                if isinstance(key, tuple):
                    message += f"\nHint: use a list to select multiple variables, for example `ds[{list(key)}]`"
>               raise KeyError(message) from e
E               KeyError: "No variable named 'right_ascension'. Variables on the dataset include ['time', 'frequency', 'velocity', 'polarization', 'l', 'm', 'beam_params_label', 'RESIDUAL']"

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1357: KeyError
tests/unit/core/imaging/test_imager.py::TestEndToEnd::test_residual_below_dirty_peak
Stack Traces | 0.171s run time
self = <xarray.Dataset> Size: 323kB
Dimensions:            (time: 1, frequency: 1, polarization: 1, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
name = 'right_ascension'

    def _construct_dataarray(self, name: Hashable) -> DataArray:
        """Construct a DataArray by indexing this dataset"""
        from xarray.core.dataarray import DataArray
    
        try:
>           variable = self._variables[name]
                       ^^^^^^^^^^^^^^^^^^^^^
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1237: KeyError

During handling of the above exception, another exception occurred:

self = <xarray.Dataset> Size: 323kB
Dimensions:            (time: 1, frequency: 1, polarization: 1, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
>               return self._construct_dataarray(key)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1344: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1239: in _construct_dataarray
    _, name, variable = _get_virtual_variable(self._variables, name, self.sizes)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

variables = {'RESIDUAL': <xarray.Variable (time: 1, frequency: 1, polarization: 1, l: 200, m: 200)> Size: 320kB
array([[[[[-0.7090...-04, -2.032622e-04])
Attributes:
    note:     l is the angle measured from the reference direction to the eas..., ...}
key = 'right_ascension'
dim_sizes = Frozen({'time': 1, 'frequency': 1, 'polarization': 1, 'l': 200, 'm': 200, 'beam_params_label': 3})

    def _get_virtual_variable(
        variables, key: Hashable, dim_sizes: Mapping | None = None
    ) -> tuple[Hashable, Hashable, Variable]:
        """Get a virtual variable (e.g., 'time.year') from a dict of xarray.Variable
        objects (if possible)
    
        """
        from xarray.core.dataarray import DataArray
    
        if dim_sizes is None:
            dim_sizes = {}
    
        if key in dim_sizes:
            data = pd.Index(range(dim_sizes[key]), name=key)
            variable = IndexVariable((key,), data)
            return key, key, variable
    
        if not isinstance(key, str):
            raise KeyError(key)
    
        split_key = key.split(".", 1)
        if len(split_key) != 2:
>           raise KeyError(key)
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset_utils.py:79: KeyError

The above exception was the direct cause of the following exception:

self = <tests.unit.core.imaging.test_imager.TestEndToEnd object at 0x7f63707de810>
ms4_copy = ([array([ 93, 122, 111, 104]), array([ 82,  82,  77, 118]), array([1., 1., 1., 1.])], 200, np.float64(2.05315385437059...   WIND_SPEED           (station_name, time_weather) float64 4kB ...
        Attributes:
            type:     weather)
default_params = {'cell_size': (np.float64(-2.053153854370599e-06), np.float64(2.053153854370599e-06)), 'corr_type': 'linear', 'image_size': (200, 200)}

    def test_residual_below_dirty_peak(self, ms4_copy, default_params):
        _, _, _, ms4 = ms4_copy
        # Get initial dirty image peak
        from astroviper.core.imaging.imaging_utils.corr_to_stokes import (
            image_corr_to_stokes,
        )
    
        dirty_corr = grid_visibilities(
            ms4,
            image_size=default_params["image_size"],
            cell_size=default_params["cell_size"],
        )
        dirty_I = image_corr_to_stokes(
            dirty_corr, corr_type="linear", pol_axis=1, stokes_out=["I"]
        )
        initial_peak = np.max(np.abs(dirty_I))
    
        # Run 1 major cycle with few iterations
        params = {
            **default_params,
            "stokes": ["I"],
            "niter": 10,
            "nmajor": 1,
            "threshold": 0.0,
        }
>       _, residual, return_dict, _ = run_imaging_loop(ms4, params)
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../core/imaging/test_imager.py:259: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/imager.py:301: in run_imaging_loop
    return_dict, new_model_xds, residual_xds = deconvolve(
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:198: in deconvolve
    phase_center = get_phase_center(dirty_image_xds)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:34: in get_phase_center
    ra_shape = dirty_image_xds.coords["right_ascension"].shape
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/coordinates.py:927: in __getitem__
    return self._data[key]
           ^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Dataset> Size: 323kB
Dimensions:            (time: 1, frequency: 1, polarization: 1, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
                return self._construct_dataarray(key)
            except KeyError as e:
                message = f"No variable named {key!r}."
    
                best_guess = utils.did_you_mean(key, self.variables.keys())
                if best_guess:
                    message += f" {best_guess}"
                else:
                    message += f" Variables on the dataset include {shorten_list_repr(list(self.variables.keys()), max_items=10)}"
    
                # If someone attempts `ds['foo' , 'bar']` instead of `ds[['foo', 'bar']]`
                if isinstance(key, tuple):
                    message += f"\nHint: use a list to select multiple variables, for example `ds[{list(key)}]`"
>               raise KeyError(message) from e
E               KeyError: "No variable named 'right_ascension'. Variables on the dataset include ['time', 'frequency', 'velocity', 'polarization', 'l', 'm', 'beam_params_label', 'RESIDUAL']"

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1357: KeyError
tests/unit/core/imaging/test_imager.py::TestEndToEnd::test_stops_at_threshold
Stack Traces | 0.173s run time
self = <xarray.Dataset> Size: 323kB
Dimensions:            (time: 1, frequency: 1, polarization: 1, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
name = 'right_ascension'

    def _construct_dataarray(self, name: Hashable) -> DataArray:
        """Construct a DataArray by indexing this dataset"""
        from xarray.core.dataarray import DataArray
    
        try:
>           variable = self._variables[name]
                       ^^^^^^^^^^^^^^^^^^^^^
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1237: KeyError

During handling of the above exception, another exception occurred:

self = <xarray.Dataset> Size: 323kB
Dimensions:            (time: 1, frequency: 1, polarization: 1, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
>               return self._construct_dataarray(key)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1344: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1239: in _construct_dataarray
    _, name, variable = _get_virtual_variable(self._variables, name, self.sizes)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

variables = {'RESIDUAL': <xarray.Variable (time: 1, frequency: 1, polarization: 1, l: 200, m: 200)> Size: 320kB
array([[[[[-0.7090...-04, -2.032622e-04])
Attributes:
    note:     l is the angle measured from the reference direction to the eas..., ...}
key = 'right_ascension'
dim_sizes = Frozen({'time': 1, 'frequency': 1, 'polarization': 1, 'l': 200, 'm': 200, 'beam_params_label': 3})

    def _get_virtual_variable(
        variables, key: Hashable, dim_sizes: Mapping | None = None
    ) -> tuple[Hashable, Hashable, Variable]:
        """Get a virtual variable (e.g., 'time.year') from a dict of xarray.Variable
        objects (if possible)
    
        """
        from xarray.core.dataarray import DataArray
    
        if dim_sizes is None:
            dim_sizes = {}
    
        if key in dim_sizes:
            data = pd.Index(range(dim_sizes[key]), name=key)
            variable = IndexVariable((key,), data)
            return key, key, variable
    
        if not isinstance(key, str):
            raise KeyError(key)
    
        split_key = key.split(".", 1)
        if len(split_key) != 2:
>           raise KeyError(key)
E           KeyError: 'right_ascension'

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset_utils.py:79: KeyError

The above exception was the direct cause of the following exception:

self = <tests.unit.core.imaging.test_imager.TestEndToEnd object at 0x7f63706cf1d0>
ms4_copy = ([array([ 93, 122, 111, 104]), array([ 82,  82,  77, 118]), array([1., 1., 1., 1.])], 200, np.float64(2.05315385437059...   WIND_SPEED           (station_name, time_weather) float64 4kB ...
        Attributes:
            type:     weather)
default_params = {'cell_size': (np.float64(-2.053153854370599e-06), np.float64(2.053153854370599e-06)), 'corr_type': 'linear', 'image_size': (200, 200)}

    def test_stops_at_threshold(self, ms4_copy, default_params):
        _, _, _, ms4 = ms4_copy
        # Use Stokes I only and conservative niter to avoid divergence
        # with high PSF sidelobes
        from astroviper.core.imaging.imaging_utils.corr_to_stokes import (
            image_corr_to_stokes,
        )
    
        dirty_corr = grid_visibilities(
            ms4,
            image_size=default_params["image_size"],
            cell_size=default_params["cell_size"],
        )
        dirty_I = image_corr_to_stokes(
            dirty_corr, corr_type="linear", pol_axis=1, stokes_out=["I"]
        )
        initial_peak = np.max(np.abs(dirty_I))
        # Set threshold to 80% of initial peak — easily reachable in 1 cycle
        threshold = initial_peak * 0.8
        params = {
            **default_params,
            "stokes": ["I"],
            "threshold": threshold,
            "niter": 500,
            "nmajor": 5,
        }
>       _, residual, _, controller = run_imaging_loop(ms4, params)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.../core/imaging/test_imager.py:222: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/imager.py:301: in run_imaging_loop
    return_dict, new_model_xds, residual_xds = deconvolve(
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:198: in deconvolve
    phase_center = get_phase_center(dirty_image_xds)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../core/imaging/deconvolution.py:34: in get_phase_center
    ra_shape = dirty_image_xds.coords["right_ascension"].shape
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/coordinates.py:927: in __getitem__
    return self._data[key]
           ^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Dataset> Size: 323kB
Dimensions:            (time: 1, frequency: 1, polarization: 1, l: 200, m: 200,
         ...{}}
    coordinate_system_info:  {'reference_direction': {'attrs': {'frame': 'fk5...
    type:                    image
key = 'right_ascension'

    def __getitem__(
        self, key: Mapping[Any, Any] | Hashable | Iterable[Hashable]
    ) -> Self | DataArray:
        """Access variables or coordinates of this dataset as a
        :py:class:`~xarray.DataArray` or a subset of variables or a indexed dataset.
    
        Indexing with a list of names will return a new ``Dataset`` object.
        """
        from xarray.core.formatting import shorten_list_repr
    
        if utils.is_dict_like(key):
            return self.isel(**key)
        if utils.hashable(key):
            try:
                return self._construct_dataarray(key)
            except KeyError as e:
                message = f"No variable named {key!r}."
    
                best_guess = utils.did_you_mean(key, self.variables.keys())
                if best_guess:
                    message += f" {best_guess}"
                else:
                    message += f" Variables on the dataset include {shorten_list_repr(list(self.variables.keys()), max_items=10)}"
    
                # If someone attempts `ds['foo' , 'bar']` instead of `ds[['foo', 'bar']]`
                if isinstance(key, tuple):
                    message += f"\nHint: use a list to select multiple variables, for example `ds[{list(key)}]`"
>               raise KeyError(message) from e
E               KeyError: "No variable named 'right_ascension'. Variables on the dataset include ['time', 'frequency', 'velocity', 'polarization', 'l', 'm', 'beam_params_label', 'RESIDUAL']"

.../hostedtoolcache/Python/3.11.15.........................../x64/lib/python3.11.../xarray/core/dataset.py:1357: KeyError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add nbstripout to pre-commit

2 participants