Simulated MS records REST frequencies (MEAS_FREQ_REF = 0): tclean can't convert them; observatories record TOPO

Summary

A simulated MS records its spectral windows as REST frequencies (SPECTRAL_WINDOW::MEAS_FREQ_REF = 0), so CASA tclean fails: it can't convert REST frequencies to the frame it images in (LSRK) without a source velocity.

Expected

Simulated observatory data record TOPO (5) frequencies, as telescopes do (ALMA, VLA); CASA converts TOPO to LSRK from the antenna positions and times, which the MS holds. Optionally, configurable for simulations that want another frame.

Observed

After writing with tables="ALL":

tclean(vis="sim.ms", imagename="dirty", imsize=256, cell="0.02arcsec", niter=0, datacolumn="data")
RuntimeError: Error in selectData() : No MeasFrame specified for conversion of Frequency

Setting MEAS_FREQ_REF to 5 makes tclean go on (to the FEED issue).

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)

Then DaskMS(output_name="sim.ms").write(context.dataset, tables="ALL") and read sim.ms/SPECTRAL_WINDOW MEAS_FREQ_REF → [0].