Draft
Conversation
…py` to include it in the API
Add `open_msv2()` and supporting infrastructure for lazily opening a CASA MSv2 as an MSv4-schema `xr.DataTree` backed by dask arrays, without triggering a full msv2→msv4 conversion. - `open_msv2.py`: new entry point; builds partitions lazily via `_build_partition_lazy()`; adds a TTL-based partition cache to avoid re-scanning the MS on repeated calls; hardens OBSERVATION subtable and FIELD/SOURCE table reads with graceful fallbacks. - `read.py`: add `read_col_conversion_dask_sparse()` and its per-chunk helper `_load_col_chunk_sparse()` for MSv2 files where not every time step contains every baseline (antenna dropouts, flagged-row removal, etc.). Uses `np.bincount` + cumulative row offsets to correctly map rows to `(time, baseline)` slots without assuming a constant stride. Thread-safety: move `SerializableLock` import to module level and pass the lock through to `load_col_chunk`. - `conversion.py`: extend `get_read_col_conversion_function()` to dispatch to the new sparse reader when `parallel_mode="sparse"`; update docstring to reflect three modes (`none`, `time`, `sparse`). - `_msv2_backend.py`: new xarray `BackendEntrypoint` registering the `xradio:msv2` engine, so `xr.open_datatree(path, engine="xradio:msv2")` works out of the box.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While Zarr-backed lazy reading after paying a one-time conversion cost is certainly the right performance choice, there might still be scientific use cases where directly opening an MSv2 lazily — without converting — is preferable -- even it might be slightly sluggish:
This is a draft proposal and still a work in progress. And certain ideas are borrowed from xarray-ms. I vaguely remember there was earlier support, but it was later dropped? If this doesn't fit the library design, I could also spin it off to a separate repo.
On the other hand, I am not sure about the plan or what has been done on profiling and adding the arcea backend. Some elements from that proposal could be relevant here.