xradio 0.0.37__tar.gz → 0.0.39__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. {xradio-0.0.37/src/xradio.egg-info → xradio-0.0.39}/PKG-INFO +4 -5
  2. {xradio-0.0.37 → xradio-0.0.39}/pyproject.toml +4 -5
  3. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/_utils/common.py +41 -0
  4. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/_tables/load.py +5 -6
  5. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/_tables/read.py +57 -51
  6. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/conversion.py +1 -5
  7. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_utils/xds_helper.py +10 -12
  8. {xradio-0.0.37 → xradio-0.0.39/src/xradio.egg-info}/PKG-INFO +4 -5
  9. {xradio-0.0.37 → xradio-0.0.39}/src/xradio.egg-info/requires.txt +2 -3
  10. {xradio-0.0.37 → xradio-0.0.39}/LICENSE.txt +0 -0
  11. {xradio-0.0.37 → xradio-0.0.39}/MANIFEST.in +0 -0
  12. {xradio-0.0.37 → xradio-0.0.39}/README.md +0 -0
  13. {xradio-0.0.37 → xradio-0.0.39}/setup.cfg +0 -0
  14. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/__init__.py +0 -0
  15. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/_utils/__init__.py +0 -0
  16. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/_utils/_casacore/tables.py +0 -0
  17. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/_utils/list_and_array.py +0 -0
  18. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/_utils/schema.py +0 -0
  19. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/_utils/zarr/__init__.py +0 -0
  20. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/_utils/zarr/common.py +0 -0
  21. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/image/__init__.py +0 -0
  22. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/image/_util/__init__.py +0 -0
  23. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/image/_util/_casacore/__init__.py +0 -0
  24. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/image/_util/_casacore/common.py +0 -0
  25. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/image/_util/_casacore/xds_from_casacore.py +0 -0
  26. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/image/_util/_casacore/xds_to_casacore.py +0 -0
  27. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/image/_util/_fits/xds_from_fits.py +0 -0
  28. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/image/_util/_zarr/common.py +0 -0
  29. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/image/_util/_zarr/xds_from_zarr.py +0 -0
  30. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/image/_util/_zarr/xds_to_zarr.py +0 -0
  31. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/image/_util/_zarr/zarr_low_level.py +0 -0
  32. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/image/_util/casacore.py +0 -0
  33. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/image/_util/common.py +0 -0
  34. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/image/_util/fits.py +0 -0
  35. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/image/_util/image_factory.py +0 -0
  36. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/image/_util/zarr.py +0 -0
  37. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/image/image.py +0 -0
  38. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/schema/__init__.py +0 -0
  39. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/schema/bases.py +0 -0
  40. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/schema/check.py +0 -0
  41. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/schema/dataclass.py +0 -0
  42. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/schema/metamodel.py +0 -0
  43. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/schema/typing.py +0 -0
  44. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/__init__.py +0 -0
  45. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_processing_set.py +0 -0
  46. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/__init__.py +0 -0
  47. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/_tables/load_main_table.py +0 -0
  48. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/_tables/read_main_table.py +0 -0
  49. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/_tables/read_subtables.py +0 -0
  50. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/_tables/table_query.py +0 -0
  51. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/_tables/write.py +0 -0
  52. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/_tables/write_exp_api.py +0 -0
  53. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/chunks.py +0 -0
  54. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/create_antenna_xds.py +0 -0
  55. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/create_field_and_source_xds.py +0 -0
  56. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/descr.py +0 -0
  57. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/msv2_msv3.py +0 -0
  58. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/msv2_to_msv4_meta.py +0 -0
  59. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/msv4_infos.py +0 -0
  60. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/msv4_sub_xdss.py +0 -0
  61. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/optimised_functions.py +0 -0
  62. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/partition_queries.py +0 -0
  63. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/partitions.py +0 -0
  64. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_ms/subtables.py +0 -0
  65. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_utils/cds.py +0 -0
  66. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_utils/partition_attrs.py +0 -0
  67. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_utils/stokes_types.py +0 -0
  68. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_zarr/encoding.py +0 -0
  69. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_zarr/read.py +0 -0
  70. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/_zarr/write.py +0 -0
  71. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/ms.py +0 -0
  72. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/_vis_utils/zarr.py +0 -0
  73. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/convert_msv2_to_processing_set.py +0 -0
  74. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/load_processing_set.py +0 -0
  75. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/read_processing_set.py +0 -0
  76. {xradio-0.0.37 → xradio-0.0.39}/src/xradio/vis/schema.py +0 -0
  77. {xradio-0.0.37 → xradio-0.0.39}/src/xradio.egg-info/SOURCES.txt +0 -0
  78. {xradio-0.0.37 → xradio-0.0.39}/src/xradio.egg-info/dependency_links.txt +0 -0
  79. {xradio-0.0.37 → xradio-0.0.39}/src/xradio.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xradio
3
- Version: 0.0.37
3
+ Version: 0.0.39
4
4
  Summary: Xarray Radio Astronomy Data IO
5
5
  Author-email: Jan-Willem Steeb <jsteeb@nrao.edu>
6
6
  License: BSD 3-Clause License
@@ -37,17 +37,16 @@ License: BSD 3-Clause License
37
37
  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38
38
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
39
 
40
- Requires-Python: <3.12,>=3.9
40
+ Requires-Python: <3.13,>=3.9
41
41
  Description-Content-Type: text/markdown
42
42
  License-File: LICENSE.txt
43
43
  Requires-Dist: astropy
44
- Requires-Dist: casadata
45
44
  Requires-Dist: dask
46
45
  Requires-Dist: distributed
47
46
  Requires-Dist: graphviper
48
47
  Requires-Dist: matplotlib
49
48
  Requires-Dist: numba>=0.57.0
50
- Requires-Dist: numpy<2.0.0
49
+ Requires-Dist: numpy
51
50
  Requires-Dist: prettytable
52
51
  Requires-Dist: pytest
53
52
  Requires-Dist: pytest-cov
@@ -58,7 +57,7 @@ Requires-Dist: tqdm
58
57
  Requires-Dist: xarray
59
58
  Requires-Dist: zarr
60
59
  Requires-Dist: pyarrow
61
- Requires-Dist: python_casacore>=3.5.2; sys_platform != "darwin"
60
+ Requires-Dist: python_casacore>=3.6.1; sys_platform != "darwin"
62
61
  Requires-Dist: typing_extensions; python_version < "3.10"
63
62
  Requires-Dist: typeguard
64
63
  Provides-Extra: docs
@@ -1,23 +1,22 @@
1
1
  [project]
2
2
  name = "xradio"
3
- version = "0.0.37"
3
+ version = "0.0.39"
4
4
  description = " Xarray Radio Astronomy Data IO"
5
5
  authors = [
6
6
  {name = "Jan-Willem Steeb", email="jsteeb@nrao.edu"},
7
7
  ]
8
8
  license = {file = "LICENSE.txt"}
9
9
  readme = "README.md"
10
- requires-python = ">= 3.9, < 3.12"
10
+ requires-python = ">= 3.9, < 3.13"
11
11
 
12
12
  dependencies = [
13
13
  'astropy',
14
- 'casadata',
15
14
  'dask',
16
15
  'distributed',
17
16
  'graphviper',
18
17
  'matplotlib',
19
18
  'numba>=0.57.0',
20
- 'numpy<2.0.0',
19
+ 'numpy',
21
20
  'prettytable',
22
21
  'pytest',
23
22
  'pytest-cov',
@@ -28,7 +27,7 @@ dependencies = [
28
27
  'xarray',
29
28
  'zarr',
30
29
  'pyarrow',
31
- 'python_casacore>=3.5.2; sys_platform != "darwin" ',
30
+ 'python_casacore>=3.6.1; sys_platform != "darwin" ',
32
31
  'typing_extensions; python_version < "3.10"',
33
32
  'typeguard'
34
33
  ]
@@ -10,6 +10,47 @@ def cast_to_str(x):
10
10
  return x
11
11
 
12
12
 
13
+ def get_pad_value(col_dtype: np.dtype) -> object:
14
+ """
15
+ Produce a padding/missing/nan value appropriate for a casacore data column
16
+ (for when we need to pad data vars coming from columns with rows of
17
+ variable size array values)
18
+
19
+ Parameters
20
+ ----------
21
+ col_dtype : dtype
22
+ dtype of data being loaded from a table column
23
+
24
+ Returns
25
+ -------
26
+ object
27
+ pad value ("missing" / "fill") for the type given
28
+ """
29
+ # Fill values for missing/NaN data in integer variables, based on usual
30
+ # numpy fill values. See https://github.com/numpy/numpy/issues/21166,
31
+ # https://github.com/casangi/xradio/issues/219, https://github.com/casangi/xradio/pull/177
32
+ fill_value_int32 = np.int32(-2147483648)
33
+ fill_value_int64 = np.int64(-9223372036854775808)
34
+
35
+ if col_dtype == np.int32:
36
+ return fill_value_int32
37
+ elif col_dtype == np.int64 or col_dtype == "int":
38
+ return fill_value_int64
39
+ elif np.issubdtype(col_dtype, np.floating):
40
+ return np.nan
41
+ elif np.issubdtype(col_dtype, np.complexfloating):
42
+ return complex(np.nan, np.nan)
43
+ elif np.issubdtype(col_dtype, np.bool_):
44
+ return False
45
+ elif np.issubdtype(col_dtype, str):
46
+ return ""
47
+ else:
48
+ raise RuntimeError(
49
+ "Padding / missing value not defined for the type requested: "
50
+ f"{col_dtype} (of type: {type(col_dtype)})"
51
+ )
52
+
53
+
13
54
  def convert_to_si_units(xds):
14
55
  for data_var in xds.data_vars:
15
56
  if "units" in xds[data_var].attrs:
@@ -1,8 +1,10 @@
1
1
  from typing import Tuple
2
2
 
3
- from casacore import tables
4
3
  import numpy as np
5
4
 
5
+ from casacore import tables
6
+ from ....._utils.common import get_pad_value
7
+
6
8
 
7
9
  def load_col_chunk(
8
10
  tb_tool: tables.table,
@@ -53,11 +55,8 @@ def load_col_chunk(
53
55
  data = tb_tool.getcolslice(col, (d1[0], d2[0]), (d1[1], d2[1]), [], 0, -1)
54
56
 
55
57
  # full data is the maximum of the data shape and chunk shape dimensions
56
- policy = "warn"
57
- if np.issubdtype(data.dtype, np.integer):
58
- policy = "ignore"
59
- with np.errstate(invalid=policy):
60
- chunk = np.full(cshape, np.nan, dtype=data.dtype)
58
+ fill_value = get_pad_value(data.dtype)
59
+ chunk = np.full(cshape, np.fill_value, dtype=data.dtype)
61
60
  if len(didxs) > 0:
62
61
  chunk[tidxs[didxs], bidxs[didxs]] = data[didxs]
63
62
 
@@ -12,6 +12,7 @@ import astropy.units
12
12
  from casacore import tables
13
13
 
14
14
  from .table_query import open_query, open_table_ro
15
+ from ....._utils.common import get_pad_value
15
16
 
16
17
  CASACORE_TO_PD_TIME_CORRECTION = 3_506_716_800.0
17
18
  SECS_IN_DAY = 86400
@@ -393,35 +394,6 @@ def make_freq_attrs(spw_xds: xr.Dataset, spw_id: int) -> Dict[str, Any]:
393
394
  return cf_attrs
394
395
 
395
396
 
396
- def get_pad_nan(col: np.ndarray) -> np.ndarray:
397
- """
398
- Produce a padding/nan value appropriate for a data column
399
- (for when we need to pad data vars coming from columns with rows of
400
- variable size array values)
401
-
402
- Parameters
403
- ----------
404
- col : np.ndarray
405
- data being loaded from a table column
406
-
407
- Returns
408
- -------
409
- np.ndarray
410
- nan ("nan") value for the type of the input column
411
- """
412
- # This is causing frequent warnings for integers. Cast of nan to "int nan"
413
- # produces -2147483648 but also seems to trigger a
414
- # "RuntimeWarning: invalid value encountered in cast" (new in numpy>=1.24)
415
- policy = "warn"
416
- col_type = np.array(col).dtype
417
- if np.issubdtype(col_type, np.integer):
418
- policy = "ignore"
419
- with np.errstate(invalid=policy):
420
- pad_nan = np.array([np.nan]).astype(col_type)[0]
421
-
422
- return pad_nan
423
-
424
-
425
397
  def redimension_ms_subtable(xds: xr.Dataset, subt_name: str) -> xr.Dataset:
426
398
  """
427
399
  Expand a MeasurementSet subtable xds from single dimension (row)
@@ -471,13 +443,12 @@ def redimension_ms_subtable(xds: xr.Dataset, subt_name: str) -> xr.Dataset:
471
443
  # (ANTENNA_ID=0, TIME=0) and no other columns to figure out the right IDs, such
472
444
  # as "NS_WX_STATION_ID" or similar. (example: X425.pm04.scan4.ms)
473
445
  # - Some GBT MSs have duplicated (ANTENNA_ID=0, TIME=xxx). (example: analytic_variable.ms)
474
- with np.errstate(invalid="ignore"):
475
- rxds = (
476
- rxds.set_index(row=key_dims)
477
- .drop_duplicates("row")
478
- .unstack("row")
479
- .transpose(*key_dims, ...)
480
- )
446
+ rxds = (
447
+ rxds.set_index(row=key_dims)
448
+ .drop_duplicates("row")
449
+ .unstack("row")
450
+ .transpose(*key_dims, ...)
451
+ )
481
452
  # unstack changes type to float when it needs to introduce NaNs, so
482
453
  # we need to reset to the original type.
483
454
  for var in rxds.data_vars:
@@ -999,13 +970,47 @@ def raw_col_data_to_coords_vars(
999
970
  return array_type, array_data
1000
971
 
1001
972
 
973
+ def get_pad_value_in_tablerow_column(trows: tables.tablerow, col: str) -> object:
974
+ """
975
+ Gets the pad value for the type of a column (IMPORTANTLY) as froun in the
976
+ the type specified in the row / column value dict returned by tablerow.
977
+ This can differ from the type of the column as given in the casacore
978
+ column descriptions. See https://github.com/casangi/xradio/issues/242.
979
+
980
+ Parameters
981
+ ----------
982
+ trows : tables.tablerow
983
+ list of rows from a table as loaded by tables.row()
984
+ col: str
985
+ get the pad value for this column
986
+
987
+ Returns
988
+ -------
989
+ object
990
+ pad value as produced by get_pad_value for the appropriate data type from
991
+ tablerow
992
+ """
993
+ col_value = trows[0][col]
994
+ if isinstance(col_value, np.ndarray):
995
+ col_dtype = col_value.dtype
996
+ elif isinstance(col_value, list):
997
+ col_dtype = type(col_value[0])
998
+ else:
999
+ raise RuntimeError(
1000
+ "Found unexpected type (not np.array or list) in column value of "
1001
+ f"first row of column {col}: {col_value}"
1002
+ )
1003
+
1004
+ return get_pad_value(col_dtype)
1005
+
1006
+
1002
1007
  def handle_variable_col_issues(
1003
1008
  inpath: str, col: str, col_type: str, trows: tables.tablerow
1004
1009
  ) -> np.ndarray:
1005
1010
  """
1006
- load variable-size array columns, padding with nans wherever
1007
- needed. This happens for example often in the SPECTRAL_WINDOW
1008
- table (CHAN_WIDTH, EFFECTIVE_BW, etc.).
1011
+ load variable-size array columns, padding with missing/fill/nans
1012
+ wherever needed. This happens for example often in the
1013
+ SPECTRAL_WINDOW table (CHAN_WIDTH, EFFECTIVE_BW, etc.).
1009
1014
  Also handle exceptions gracefully when trying to load the rows.
1010
1015
 
1011
1016
  Parameters
@@ -1015,7 +1020,7 @@ def handle_variable_col_issues(
1015
1020
  col : str
1016
1021
  column being loaded
1017
1022
  col_type : str
1018
- type of the column cell values
1023
+ type of the column cell values (as numpy dtype string)
1019
1024
  trows : tables.tablerow
1020
1025
  rows from a table as loaded by tables.row()
1021
1026
 
@@ -1030,7 +1035,8 @@ def handle_variable_col_issues(
1030
1035
 
1031
1036
  mshape = np.array(max([np.array(row[col]).shape for row in trows]))
1032
1037
  try:
1033
- pad_nan = get_pad_nan(np.array((), dtype=col_type))
1038
+ pad_val = None
1039
+ pad_val = get_pad_value_in_tablerow_column(trows, col)
1034
1040
 
1035
1041
  # TODO
1036
1042
  # benchmark np.stack() performance
@@ -1044,13 +1050,13 @@ def handle_variable_col_issues(
1044
1050
  ),
1045
1051
  [(0, ss) for ss in mshape - np.array(row[col]).shape],
1046
1052
  "constant",
1047
- constant_values=pad_nan,
1053
+ constant_values=pad_val,
1048
1054
  )
1049
1055
  for row in trows
1050
1056
  ]
1051
1057
  )
1052
1058
  except Exception as exc:
1053
- msg = f"{inpath}: failed to load data for column {col}: {exc}"
1059
+ msg = f"{inpath}: failed to load data for column {col}, with {pad_val=}: {exc}"
1054
1060
  if col in known_misbehaving_cols:
1055
1061
  logger.debug(msg)
1056
1062
  else:
@@ -1178,12 +1184,8 @@ def read_col_chunk(
1178
1184
  elif len(cshape) == 4: # DATA and FLAG
1179
1185
  data = query.getcolslice(col, (d1[0], d2[0]), (d1[1], d2[1]), [], 0, -1)
1180
1186
 
1181
- policy = "warn"
1182
- if np.issubdtype(data.dtype, np.integer):
1183
- policy = "ignore"
1184
- with np.errstate(invalid=policy):
1185
- # full data is the maximum of the data shape and chunk shape dimensions
1186
- fulldata = np.full(cshape, np.nan, dtype=data.dtype)
1187
+ fill_value = get_pad_value(data.dtype)
1188
+ fulldata = np.full(cshape, fill_value, dtype=data.dtype)
1187
1189
 
1188
1190
  if len(didxs) > 0:
1189
1191
  fulldata[tidxs[didxs], bidxs[didxs]] = data[didxs]
@@ -1250,9 +1252,11 @@ def read_col_conversion(
1250
1252
 
1251
1253
  # Get dtype of the column. Only read first row from disk
1252
1254
  col_dtype = np.array(tb_tool.col(col)[0]).dtype
1255
+ # Use a custom/safe fill value (https://github.com/casangi/xradio/issues/219)
1256
+ fill_value = get_pad_value(col_dtype)
1253
1257
 
1254
1258
  # Construct a numpy array to populate. `data` has shape (n_times, n_baselines, n_frequencies, n_polarizations)
1255
- data = np.full(cshape + extra_dimensions, np.nan, dtype=col_dtype)
1259
+ data = np.full(cshape + extra_dimensions, fill_value, dtype=col_dtype)
1256
1260
 
1257
1261
  # Use built-in casacore table iterator to populate the data column by unique times.
1258
1262
  if use_table_iter:
@@ -1261,7 +1265,9 @@ def read_col_conversion(
1261
1265
  num_rows = ts.nrows()
1262
1266
 
1263
1267
  # Create small temporary array to store the partial column
1264
- tmp_arr = np.full((num_rows,) + extra_dimensions, np.nan, dtype=col_dtype)
1268
+ tmp_arr = np.full(
1269
+ (num_rows,) + extra_dimensions, fill_value, dtype=col_dtype
1270
+ )
1265
1271
 
1266
1272
  # Note we don't use `getcol()` because it's less safe. See:
1267
1273
  # https://github.com/casacore/python-casacore/issues/130#issuecomment-463202373
@@ -976,11 +976,7 @@ def convert_and_write_partition(
976
976
 
977
977
  file_name = os.path.join(
978
978
  out_file,
979
- pathlib.Path(out_file)
980
- .name.replace(".vis.zarr", "")
981
- .replace(".zarr", "")
982
- + "_"
983
- + str(ms_v4_id),
979
+ pathlib.Path(in_file).name.replace(".ms", "") + "_" + str(ms_v4_id),
984
980
  )
985
981
 
986
982
  if "line_name" in field_and_source_xds.coords:
@@ -1,4 +1,4 @@
1
- from importlib_metadata import version
1
+ from importlib.metadata import version
2
2
  import graphviper.utils.logger as logger, multiprocessing, psutil
3
3
  from typing import Any, Dict, List, Tuple, Union
4
4
 
@@ -7,6 +7,7 @@ import xarray as xr
7
7
 
8
8
  from .cds import CASAVisSet
9
9
  from .stokes_types import stokes_types
10
+ from ...._utils.common import get_pad_value
10
11
 
11
12
 
12
13
  def make_coords(
@@ -195,7 +196,8 @@ def expand_xds(xds: xr.Dataset) -> xr.Dataset:
195
196
  except Exception as exc:
196
197
  logger.warning(
197
198
  f"WARNING: Cannot expand rows to (time, baseline), "
198
- f"possibly duplicate values in (time, baseline). Exception: {exc}"
199
+ f"possibly duplicate values in (time, baseline). Exception: {exc}."
200
+ f"\nDataset: {txds=}"
199
201
  )
200
202
  txds = xds.copy()
201
203
 
@@ -214,10 +216,8 @@ def flatten_xds(xds: xr.Dataset) -> xr.Dataset:
214
216
  Returns
215
217
  -------
216
218
  xr.Dataset
219
+ Dataset in flat form (back to 'row' dimension as read by casacore tables)
217
220
  """
218
- # known invalid cast warning when casting to integer
219
- with np.errstate(invalid="ignore"):
220
- nan_int = np.array([np.nan]).astype("int32")[0]
221
221
  txds = xds.copy()
222
222
 
223
223
  # flatten the time x baseline dimensions of main table
@@ -226,14 +226,12 @@ def flatten_xds(xds: xr.Dataset) -> xr.Dataset:
226
226
  # compute for issue https://github.com/hainegroup/oceanspy/issues/332
227
227
  # drop=True silently does compute (or at least used to)
228
228
 
229
- # Skip this step for now since on Mac nan_int=0. See issue https://github.com/casangi/xradio/issues/219
230
- # txds = txds.where(
231
- # ((txds.STATE_ID != nan_int) & (txds.FIELD_ID != nan_int)).compute(),
232
- # drop=True,
233
- # ) # .unify_chunks()
234
-
229
+ fill_value_int32 = get_pad_value(np.int32)
235
230
  txds = txds.where(
236
- ~np.isnan(txds["EXPOSURE"]).compute(),
231
+ (
232
+ (txds.STATE_ID != fill_value_int32)
233
+ & (txds.FIELD_ID != fill_value_int32)
234
+ ).compute(),
237
235
  drop=True,
238
236
  ) # .unify_chunks()
239
237
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xradio
3
- Version: 0.0.37
3
+ Version: 0.0.39
4
4
  Summary: Xarray Radio Astronomy Data IO
5
5
  Author-email: Jan-Willem Steeb <jsteeb@nrao.edu>
6
6
  License: BSD 3-Clause License
@@ -37,17 +37,16 @@ License: BSD 3-Clause License
37
37
  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38
38
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
39
 
40
- Requires-Python: <3.12,>=3.9
40
+ Requires-Python: <3.13,>=3.9
41
41
  Description-Content-Type: text/markdown
42
42
  License-File: LICENSE.txt
43
43
  Requires-Dist: astropy
44
- Requires-Dist: casadata
45
44
  Requires-Dist: dask
46
45
  Requires-Dist: distributed
47
46
  Requires-Dist: graphviper
48
47
  Requires-Dist: matplotlib
49
48
  Requires-Dist: numba>=0.57.0
50
- Requires-Dist: numpy<2.0.0
49
+ Requires-Dist: numpy
51
50
  Requires-Dist: prettytable
52
51
  Requires-Dist: pytest
53
52
  Requires-Dist: pytest-cov
@@ -58,7 +57,7 @@ Requires-Dist: tqdm
58
57
  Requires-Dist: xarray
59
58
  Requires-Dist: zarr
60
59
  Requires-Dist: pyarrow
61
- Requires-Dist: python_casacore>=3.5.2; sys_platform != "darwin"
60
+ Requires-Dist: python_casacore>=3.6.1; sys_platform != "darwin"
62
61
  Requires-Dist: typing_extensions; python_version < "3.10"
63
62
  Requires-Dist: typeguard
64
63
  Provides-Extra: docs
@@ -1,11 +1,10 @@
1
1
  astropy
2
- casadata
3
2
  dask
4
3
  distributed
5
4
  graphviper
6
5
  matplotlib
7
6
  numba>=0.57.0
8
- numpy<2.0.0
7
+ numpy
9
8
  prettytable
10
9
  pytest
11
10
  pytest-cov
@@ -22,7 +21,7 @@ typeguard
22
21
  typing_extensions
23
22
 
24
23
  [:sys_platform != "darwin"]
25
- python_casacore>=3.5.2
24
+ python_casacore>=3.6.1
26
25
 
27
26
  [docs]
28
27
  jupyterlab
File without changes
File without changes
File without changes
File without changes
File without changes