Simulated MS: STATE_ID and PROCESSOR_ID point to empty STATE and PROCESSOR tables

Summary

In a simulated MS, MAIN's STATE_ID and PROCESSOR_ID are 0 for every row, while the STATE and PROCESSOR tables are empty: dangling references.

Expected

-1 (no state/processor information, allowed by the MS v2 definition), or one written row each that the 0 points to.

Notes

CASA tclean, gaincal and applycal tolerated these on the tutorial's data, but MS validators, and tasks that join on these tables, don't. Also worth knowing: without a thermal noise injector, SIGMA = WEIGHT = WEIGHT_SPECTRUM = 1, which says nothing about the data. With ThermalNoiseInjector they're right (e.g. σ = 0.0151 Jy for a 150 K system, 30 s and 2 GHz), so this is only a pitfall for noise-free simulations; a sentence in the simulation docs would cover it.

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)