ratt-ru / Stimela-classic

Containerized radio interferometry scripting framework -- NB: Classic version is no longer in active development, use stimela 2! See README for details.
GNU General Public License v2.0
28 stars 16 forks source link

Cubical: Exiting with exception: ValueError(model component /stimela_mount/output/MODEL_DATA #773

Closed rramij closed 1 year ago

rramij commented 1 year ago

I am trying to perform selfcal on a GMRT data. After the wsclean step, the model data is saved in the MODEL_DATA column. But the Cubical is looking in the output dir.

import stimela

INPUT="input"
MSDIR="msdir"
OUTPUT="output"
######################################

msfile = "avg-A1835split.ms"
field_id = 0

###########################################
recipe = stimela.Recipe("Test stimela run",
                         ms_dir=MSDIR,
                         JOB_TYPE="singularity")

# CASA: listobs
recipe.add("cab/casa_listobs", "get_obsinfo", {
     "vis": msfile
 }, input=INPUT, output=OUTPUT, label="view obs info")

# WSClean: Make initial image before selfcal 
recipe.add("cab/wsclean", "initial_image", {
    "msname": msfile,
    "prefix": "initial_image",
    "npix": [10000, 10000],
    "cellsize": 1,
    "channelsout": 3,
    "column": "DATA",
    "niter": 100000,
    "auto-threshold": 1,
    "auto-mask": 3,
    "mgain": 0.8,
    "join-channels": True,
    "fit-spectral-pol": 2,
    "save-source-list": True,
    "parallel-deconvolution": 0
    }, input=INPUT, output=OUTPUT, label="initial image")

# Cubical: First self-calibration
recipe.add("cab/cubical", "cal_round_1", {
    "data-ms": msfile,
    "data-column": "DATA",
    "data-time-chunk": 300,
    "data-freq-chunk": 0,
    "sel-field": field_id,
    "sel-diag": True,
    "model-list": "MODEL_DATA",
    #"model-ddes": 'never',
    "weight-column": "WEIGHT",
    "flags-apply": "-cubical",
    "flags-auto-init": "legacy",
    "flags-save": "cubical",
    #"flags-post-sol": True,
    #"flags-tf-chisq-median": "1.2",
    #"flags-tf-np-median": "0.5",
    #"flags-time-density": "0.5",
    #"flags-chan-density": "0.5",
    #"flags-ddid-density": "0.5",
    "madmax-enable": True,
    "madmax-estimate": "corr",
    "madmax-plot": True,
    "madmax-plot-frac-above": 0.01,
    "madmax-diag": True,
    "madmax-offdiag": True,
    "madmax-global-threshold": 12.0,
    "madmax-threshold": 10.0,
    "sol-jones": "G",   
    "sol-precision": "32",
    "sol-delta-g": "1e-6",
    "sol-delta-chi": "1e-6",
    "sol-chi-int": "5",
    "sol-last-rites": True,
    "sol-stall-quorum": 0.99,
    "sol-term-iters": [50],
    "bbc-save-to": "bbc-gains-1-"+msfile+".parmdb",
    "bbc-per-chan": True,
    "bbc-plot": True,
    "dist-ncpu": 0,
    "dist-max-chunks": 0,
    "dist-nthread": 0,
    "dist-nworker": 0,
    "out-name": msfile+"_cubical",
    "out-overwrite": True,
    "out-mode": "sc",
    "out-column": "CORRECTED_DATA",
    "out-casa-gaintables": True,
    "out-plots": True,
    "out-correct-dir": -1,
    "log-memory": True,
    "log-boring": True,
    #"misc-parset-version": "0.1",
    "g-time-int": 30,
    "g-clip-low": 0.5,
    "g-clip-high": 2.0,
    "g-clip-after": 5,
    "g-conv-quorum": 0.99,
    "g-solvable": True,
    "g-type": "phase-diag",
    "g-save-to": "g-phase-gains-1-"+msfile+".parmdb",
    "g-update-type": "phase-diag",
    "g-max-prior-error": 0.3,
    "g-max-post-error": 0.3,
    "g-max-iter": 20,
    "g-prop-flags": "default"

    }, input=INPUT, output=OUTPUT, label="selfcal 1")

STEPS = [
#     "view obs info",
#     "initial image",
     "selfcal 1"
  ]
recipe.run(STEPS)
INFO      11:52:31 - data_handler       [0.2 10.9 0.0Gb] Input model feed rotation disabled, PA rotation disabled
INFO      11:52:31 - data_handler       [0.2 10.9 0.0Gb] Output visibilities derotation disabled
INFO      11:52:31 - main               [0.2 10.9 0.0Gb] Exiting with exception: ValueError(model component /stimela_mount/output/MODEL_DATA is neither a valid LSM nor an MS column)
 Traceback (most recent call last):
  File "/opt/venv/lib/python3.8/site-packages/cubical/main.py", line 448, in main
    ms.init_models(str(GD["model"]["list"]).split(","),
  File "/opt/venv/lib/python3.8/site-packages/cubical/data_handler/ms_data_handler.py", line 713, in init_models
    raise ValueError("model component {} is neither a valid LSM nor an MS column".format(component))
ValueError: model component /stimela_mount/output/MODEL_DATA is neither a valid LSM nor an MS column

How should I direct it to the MODEL_DATA of the MS in the input dir?

rramij commented 1 year ago
from stimela.pathformatter import pathformatter as spf

"model-list": spf("MODEL_DATA"),

Fixed the error.