Skip to content

docs: draft end-to-end CASA → PyAutoLens data-prep script #67

@Jammy2211

Description

@Jammy2211

Overview

The existing scripts/interferometer/casa_reduction.py is an incomplete stub with most
code commented out. Interferometer users on Slack repeatedly need guidance on turning
CASA-reduced ALMA .ms data into PyAutoLens-compatible visibilities, uv-wavelengths
and sigma arrays. This task produces a first-draft end-to-end walkthrough script that
can be iterated on with real users in Slack.

Plan

  • Research CASA reduction workflows and ALMA .ms structure
  • Read existing interferometer workspace scripts for convention
  • Rewrite casa_reduction.py as a coherent narrative covering split → channel avg →
    (optional uvcontsub) → statwt → export → build al.Interferometer
  • Borrow working helpers from z_staging/interferometer_data_prep/
  • Aim for "good enough to share on Slack", not final
Detailed implementation plan

Affected Repositories

  • autolens_workspace (primary)

Work Classification

Workspace

Branch Survey

Repository Current Branch Dirty?
autolens_workspace main dirty (unrelated dataset/config changes from prior session)

Suggested branch: feature/interferometer-data-prep
Worktree root: ~/Code/PyAutoLabs-wt/interferometer-data-prep/

Implementation Steps

  1. Read scripts/interferometer/start_here.py, data_preparation.py, simulator.py
    to match tone, imports (import autolens as al), and docstring style.
  2. Rewrite scripts/interferometer/casa_reduction.py:
    • Intro: .ms layout (2, n_spw, n_c, n_v, 2) vs al.Interferometer shapes
    • Section: CASA split per field/spw
    • Section: channel averaging via split(width=...)
    • Section: continuum subtraction (uvcontsub) — optional
    • Section: statwt for realistic sigmas
    • Section: Python helpers for DATA/UVW/CHAN_FREQ/SIGMA export to FITS
      (pulled from z_staging/interferometer_data_prep/main_uvcontsub_SPT0538_CO9-8.py)
    • Section: Concatenate spws, average polarisations, build al.Interferometer
    • Section: Slack pointer for edge cases
  3. Regenerate notebook via /generate_and_merge after user review.

Key Files

  • scripts/interferometer/casa_reduction.py — full rewrite
  • notebooks/interferometer/casa_reduction.ipynb — regenerated later

Original Prompt

Click to expand starting prompt

In the file @autolens_workspace/scripts/casa_reduction.py, I attempt to give a run
through of how one can prepare data via CASA.

In the file @z_staging/interferometer_data_prep/main_uvcontsub_SPT0538_CO9-8.py, I
have example reduction scripts from a an autolens user.

Can you do a bit of deep research on CASA and interferometer data reduction in
general, read a few interferometer workspace scripts for context and attempt to
produce some sort of useable and help data reduciton script for interferometer
users? It doesnt need to be perfect, I will back and forth it with interferometer
people on the autolens SLACK.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions