Command-Line Interface
DISCO provides a single console-script entry point, disco-start,
declared in pyproject.toml as:
[project.scripts]
disco-start = "disco.main:run"
The entry point disco.main:run inspects sys.argv[1] and dispatches
either to the GUI server or to the CLI pipeline (see Architecture).
Synopsis
usage: disco-start [-h] [--group {file,dir,name}] [--ref REF]
[--rout ROUT] [--rmin RMIN] [--incl INCL] [--pa PA]
[--beam BEAM] [--homobeam {on,off}] [--csv {on,off}]
[--debug {on,off}] [-y] [identifier ...]
Positional Arguments
Argument |
Description |
|---|---|
|
Zero or more object identifiers or file paths.
Each identifier is matched against discovered FITS group names and file
paths. May be an object name prefix (e.g., |
Optional Arguments
Argument |
Default |
Description |
|---|---|---|
|
|
How to group FITS files. |
|
auto |
Geometry reference inside each group (CNN + hybrid, Rout, centre).
Accepts a filename, a unique substring, or a path; must match
exactly one file in the group. Default without |
|
|
Force the outer disk radius in arcseconds. When specified, the automatic outer radius estimation is bypassed and this value is used for all groups. |
|
|
Force the inner disk radius (cavity) in arcseconds. When set to 0.0 (default), the inner radius is detected automatically from the FITS header beam size. |
|
|
Force the disk inclination in degrees.
When both |
|
|
Force the disk position angle in degrees.
Must be specified jointly with |
|
|
Force the target beam resolution in arcseconds for beam
homogenisation. When omitted and |
|
|
Enable or disable beam homogenisation. When |
|
|
Enable CSV export. When |
|
|
Save a diagnostic deprojected PNG image showing the optimised centre and outer radius overlay. |
|
off |
Escape hatch to skip the confirmation prompt. Prefer answering
|
Confirmation Prompt
Before discovering FITS files, the CLI prints a warning with the current working directory and the grouping mode, then asks:
WARNING: DISCO will now scan for and process FITS files.
Current directory: /path/to/your/fits
Grouping mode (--group): file
------------------------------------------------------------
Are you sure you want to continue? [y/N]:
Answer y or yes to proceed, or anything else to cancel. The prompt
is intentional so users confirm before FITS scanning begins. Prefer running
the CLI from the directory that contains your science FITS (or pass explicit
paths); a bare disco-start walks the current directory tree.
Grouping (--group)
A group shares one geometry solution and, if --homobeam on, one
homogenisation beam. DISCO does not infer your folder layout: you
choose the mode.
|
Meaning |
When to use |
|---|---|---|
|
Each |
Safest. A flat folder of unrelated sources, or you do not want mixed maps homogenised together. |
|
All FITS directly in the same folder are one group. Nested
directories stay separate ( |
One object per folder, with several images or bands. |
|
Legacy: inside each folder, split stems on |
Old |
v1.2.5 always used the name heuristic. From v1.2.6 the default is
file so unrelated cubes in one directory are not treated as one
source. Name filters still apply on top: disco-start AS209 --group dir
keeps groups whose paths or filenames contain AS209.
# Each FITS separately (default)
disco-start /data/batch/ --group file
# One object folder with several images or bands
disco-start /data/AS209/ --group dir --ref continuum.fits
# Parent directory: one subdirectory per source
disco-start /data/sample/ --group dir
# Legacy Object_Band6.fits naming (v1.2.5 behaviour)
disco-start /data/fits/ --group name
Geometry reference (--ref)
In a multi-file group, DiscoNet + hybrid (and Rout / centre) run on
one image. Without --ref, that image is the highest
\(\mathrm{SNR}/\Omega_{\mathrm{beam}}^{3/2}\). Use --ref to
choose a specific file instead of that automatic score.
--ref pins the geometry image inside each group:
basename —
--ref continuum.fitsunique substring —
--ref Band6(error if 0 or 2+ files match)path —
--ref /data/AS209/continuum.fits
Other files in the group still get homogenisation (if enabled) and
profiles using that geometry. If both --incl and --pa are
set, those angles override the fit; --ref still selects the map for
centre / Rout. The CLI logs [INFO] Geometry reference: <filename>.
Usage Examples
# Prefer: cd into the folder with your FITS first
cd /path/to/your/fits/
# Each FITS separately (default since v1.2.6)
disco-start --group file
# Process a single object by name prefix
disco-start AS209 --group file
# One folder = one source; choose the geometry image with --ref
disco-start path/to/AS209/ --group dir --ref continuum.fits
# Process a FITS file directly
disco-start path/to/disk.fits
# Force inclination and PA, export CSV, enable debug output
disco-start AS209 --incl 35.0 --pa 120.0 --csv on --debug on --group dir
# Set outer radius and disable beam homogenisation
disco-start AS209 --rout 1.2 --homobeam off
# Specify a custom homogenisation beam size
disco-start AS209 Elias29 --homobeam on --beam 0.15
CNN Model Loading
At startup, the CLI attempts to load the pre-trained DiscoNet weights from
disco/models/disco_model_stable.pth. The model is instantiated as
DiscoNet(n_out=5) and its state dictionary is loaded with
weights_only=True. If the model file is absent or fails to load, a
warning is printed and the pipeline falls back to analytical geometry
optimisation without CNN priors.
# Effective loading logic in disco/cli.py
model_path = os.path.join(BASE_DIR, "models", "disco_model_stable.pth")
if os.path.exists(model_path):
ckpt = torch.load(model_path, map_location='cpu', weights_only=True)
cnn_model = DiscoNet(n_out=5)
state = ckpt["model_state"] if isinstance(ckpt, dict) else ckpt
cnn_model.load_state_dict(state)
cnn_model.eval()