Simulated MS has an empty FEED table (and none for a second dataset in the same process): tclean fails on POLARIZATION_TYPE
Summary
A simulated MS has an empty FEED table (0 rows), and when a second simulated dataset is written in the same process the FEED subtable isn't written at all. CASA tclean needs one feed row per antenna: it fails reading POLARIZATION_TYPE.
Expected
One FEED row per antenna (SPECTRAL_WINDOW_ID = -1, FEED_ID = 0, BEAM_ID = -1), with receptors matching the simulation's feed_type: NUM_RECEPTORS = 2, POLARIZATION_TYPE ["X", "Y"] for linear feeds (ALMA) or ["R", "L"] for circular (VLA), RECEPTOR_ANGLE (e.g. [0, π/2] for linear), POL_RESPONSE (identity), BEAM_OFFSET and POSITION (zeros).
Observed
After writing with tables="ALL" and fixing MEAS_FREQ_REF:
RuntimeError: ... SynthesisImagerVi2::defineImage ... Error in adding Mapper : Error in createImStore : SSMIndex::getIndex - access to non-existing row 0 in column POLARIZATION_TYPE of table sim.ms/FEEDsim.ms/FEED has the columns and 0 rows. Simulating and writing a second dataset in the same Python process (another SimulationPipeline().run(...) then DaskMS(...).write(dataset, tables="ALL") to another path) leaves no FEED subtable: Table sim2.ms/FEED does not exist.
Found while building a tutorial that simulates an ALMA observation with Pyralysis and self-calibrates it with CASA tclean, in Wenuray (https://github.com/miguelcarcamov/wenuray). Versions: Pyralysis 3.3.0, python-casacore 3.7.1, casatools/casatasks 6.7.6-14, Python 3.12.
Reproduction (shared by the related simulation→CASA issues):
from importlib import resources
import astropy.units as u
from astropy.coordinates import SkyCoord
from pyralysis.models.sky.point_source import PointSource
from pyralysis.pipelines.simulation import SimulationContext, SimulationPipeline
centre = SkyCoord("15h15m48.4s", "-37d09m16s")
configs = resources.files("pyralysis.simulation") / "antenna_configs"
context = SimulationContext(config={
"antenna_config_path": str(configs / "alma.cycle10.6.cfg"),
"sources": [PointSource(reference_intensity=0.1, sky_position=centre)],
"observation_config": {"center_frequency": 345 * u.GHz, "channel_width": 2 * u.GHz,
"n_channels": 1, "pointing_position": centre, "hour_angle": "-1h",
"integration_time": 30 * u.s, "observation_time": "2h"},
"export_path": "sim.ms", "export_format": "ms",
})
SimulationPipeline().run(context)Workaround: add the rows with python-casacore after writing (one per antenna, linear X/Y as above). With it, tclean, gaincal and applycal run on the simulated MS.