From b5aff275dfaf568db75e341391ea7b71b475cd8f Mon Sep 17 00:00:00 2001 From: mulan-94 Date: Fri, 17 Jun 2022 16:39:08 +0200 Subject: [PATCH 01/10] Add Landman's spectral index fitting suite 'spimple' Add cabs for the spectral index fitter, image convolver and primary beam -> power beam converter" --- stimela/cargo/base/spimple/Dockerfile | 6 + .../cargo/cab/spimple_binterp/parameters.json | 76 +++++++ stimela/cargo/cab/spimple_binterp/src/run.py | 11 + .../cargo/cab/spimple_imconv/parameters.json | 92 +++++++++ stimela/cargo/cab/spimple_imconv/src/run.py | 11 + .../cargo/cab/spimple_spifit/parameters.json | 188 ++++++++++++++++++ stimela/cargo/cab/spimple_spifit/src/run.py | 11 + 7 files changed, 395 insertions(+) create mode 100644 stimela/cargo/base/spimple/Dockerfile create mode 100644 stimela/cargo/cab/spimple_binterp/parameters.json create mode 100644 stimela/cargo/cab/spimple_binterp/src/run.py create mode 100644 stimela/cargo/cab/spimple_imconv/parameters.json create mode 100644 stimela/cargo/cab/spimple_imconv/src/run.py create mode 100644 stimela/cargo/cab/spimple_spifit/parameters.json create mode 100644 stimela/cargo/cab/spimple_spifit/src/run.py diff --git a/stimela/cargo/base/spimple/Dockerfile b/stimela/cargo/base/spimple/Dockerfile new file mode 100644 index 00000000..6c02f7c4 --- /dev/null +++ b/stimela/cargo/base/spimple/Dockerfile @@ -0,0 +1,6 @@ +FROM quay.io/stimela/base:1.7.1 +RUN pip3 install -U pip setuptools +RUN pip install scabha spimple +RUN spimple-spifit -h +RUN spimple-binterp -h +RUN spimple-imconv -h \ No newline at end of file diff --git a/stimela/cargo/cab/spimple_binterp/parameters.json b/stimela/cargo/cab/spimple_binterp/parameters.json new file mode 100644 index 00000000..973b911c --- /dev/null +++ b/stimela/cargo/cab/spimple_binterp/parameters.json @@ -0,0 +1,76 @@ +{ + "task": "spimple imconv", + "base": "stimela/spimple", + "tag": "1.7.1", + "description": "Beam intrepolation tool.", + "prefix": "--", + "binary": "spimple-binterp", + "junk":[], + "msdir": true, + "parameters": [ + { + "info": "Input image name", + "dtype": "str", + "required": true, + "name": "image", + "io": "input", + "deprecated": false + }, + { + "info": "Path to output directory", + "dtype": "str", + "required": true, + "name": "output-filename", + "io": "output", + "deprecated": false + }, + { + "info": "Number of threads to use", + "dtype": "int", + "required": false, + "name": "nthreads", + "default": null, + "deprecated": false + }, + { + "info": "Fits beam model to use. Only real and imageinary beam models currently supported", + "dtype": "str", + "required": false, + "name": "beam-model", + "default": null, + "deprecated": false + }, + { + "info": "Add in the convolved residuals before fitting components", + "dtype": "bool", + "required": false, + "name": "add-convolved-residuals", + "default": null, + "deprecated": false + }, + { + "info": "Field Id", + "dtype": "int", + "required": false, + "name": "field", + "default": null, + "deprecated": false + }, + { + "info": "Used to select a subset of time. Default is 10", + "dtype": "int", + "required": false, + "name": "sparsify-time", + "default": null, + "deprecated": false + }, + { + "info": "Correlation typ i.e. linear or circular.", + "dtype": "str", + "required": false, + "name": "corr-type", + "default": null, + "deprecated": false + } + ] +} diff --git a/stimela/cargo/cab/spimple_binterp/src/run.py b/stimela/cargo/cab/spimple_binterp/src/run.py new file mode 100644 index 00000000..8cb4e1fd --- /dev/null +++ b/stimela/cargo/cab/spimple_binterp/src/run.py @@ -0,0 +1,11 @@ +# -*- coding: future_fstrings -*- +import sys + +from scabha import config, parse_parameters, prun + +args = [config.binary] + parse_parameters(repeat=" ") + +# run the command +if prun(args) != 0: + sys.exit(1) + diff --git a/stimela/cargo/cab/spimple_imconv/parameters.json b/stimela/cargo/cab/spimple_imconv/parameters.json new file mode 100644 index 00000000..b62fb470 --- /dev/null +++ b/stimela/cargo/cab/spimple_imconv/parameters.json @@ -0,0 +1,92 @@ +{ + "task": "spimple imconv", + "base": "stimela/spimple", + "tag": "1.7.1", + "description": "Convolve images to a common resolution", + "prefix": "--", + "binary": "spimple-imconv", + "junk":["image_convolver.log"], + "msdir": true, + "parameters": [ + { + "info": "Input image name", + "dtype": "str", + "required": true, + "name": "image", + "io": "input", + "deprecated": false + }, + { + "info": "Path to output directory", + "dtype": "str", + "required": true, + "name": "output-filename", + "io": "output", + "deprecated": false + }, + { + "info": "Beam parameters matching FWHM of restoring beam specified as emaj emin pa.", + "dtype": "list:float", + "required": false, + "name": "psf-pars", + "default": null, + "deprecated": false + }, + { + "info": "Number of threads to use", + "dtype": "int", + "required": false, + "name": "nthreads", + "default": null, + "deprecated": false + }, + { + "info": "Convolve with a circularised beam, not an elliptical one", + "dtype": "bool", + "required": false, + "name": "circ-psf", + "default": null, + "deprecated": false + }, + { + "info": "Fits beam model to use", + "dtype": "str", + "required": false, + "name": "beam-model", + "default": null, + "deprecated": false + }, + { + "info": "Band to use with JimBeam. L or UHF. Default is 'l'", + "dtype": "str", + "required": false, + "name": "band", + "default": null, + "deprecated": false + }, + { + "info": "Set image to zero where pb falls below this value. Default is 0.05", + "dtype": "float", + "required": false, + "name": "pb-min", + "default": null, + "deprecated": false + }, + { + "info": "Padding fraction for FFTs (half on either side). Default is 0.5", + "dtype": "float", + "required": true, + "name": "padding-frac", + "default": null, + "deprecated": false + }, + { + "info": "Data type of output. Default is single precision", + "dtype": "str", + "required": true, + "name": "out-dtype", + "default": null, + "deprecated": false + } + ] +} diff --git a/stimela/cargo/cab/spimple_imconv/src/run.py b/stimela/cargo/cab/spimple_imconv/src/run.py new file mode 100644 index 00000000..8cb4e1fd --- /dev/null +++ b/stimela/cargo/cab/spimple_imconv/src/run.py @@ -0,0 +1,11 @@ +# -*- coding: future_fstrings -*- +import sys + +from scabha import config, parse_parameters, prun + +args = [config.binary] + parse_parameters(repeat=" ") + +# run the command +if prun(args) != 0: + sys.exit(1) + diff --git a/stimela/cargo/cab/spimple_spifit/parameters.json b/stimela/cargo/cab/spimple_spifit/parameters.json new file mode 100644 index 00000000..848cd2b0 --- /dev/null +++ b/stimela/cargo/cab/spimple_spifit/parameters.json @@ -0,0 +1,188 @@ +{ + "task": "spimple SPI fitter", + "base": "stimela/spimple", + "tag": "1.7.1", + "description": "Simple spectral index fitting tool.", + "prefix": "--", + "binary": "spimple-spifit", + "junk":["spifit.log"], + "msdir": true, + "parameters": [ + { + "info": "Input model name", + "dtype": "str", + "required": false, + "name": "model", + "io": "input", + "deprecated": false + }, + { + "info": "Path to output directory", + "dtype": "str", + "required": true, + "name": "output-filename", + "io": "output", + "deprecated": false + }, + { + "info": "Beam parameters matching FWHM of restoring beam specified as emaj emin pa.", + "dtype": "list:float", + "required": false, + "name": "psf-pars", + "default": null, + "deprecated": false + }, + { + "info": "Number of threads to use", + "dtype": "int", + "required": false, + "name": "nthreads", + "default": null, + "deprecated": false + }, + { + "info": "Convolve with a circularised beam, not an elliptical one", + "dtype": "bool", + "required": false, + "name": "circ-psf", + "default": null, + "deprecated": false + }, + { + "info": "Fits beam model to use. Only real and imageinary beam models currently supported", + "dtype": "str", + "required": false, + "name": "beam-model", + "default": null, + "deprecated": false + }, + { + "info": "Band to use with JimBeam. L or UHF. Default is 'l'", + "dtype": "str", + "required": false, + "name": "band", + "default": null, + "deprecated": false + }, + { + "info": "Set image to zero where pb falls below this value. Default is 0.05", + "dtype": "float", + "required": false, + "name": "pb-min", + "default": null, + "deprecated": false + }, + { + "info": "Padding fraction for FFTs (half on either side). Default is 0.5", + "dtype": "float", + "required": true, + "name": "padding-frac", + "default": null, + "deprecated": false + }, + { + "info": "Data type of output. Default is single precision", + "dtype": "str", + "required": true, + "name": "out_dtype", + "default": null, + "deprecated": false + }, + { + "info": "Multiple of the rms in the residual to threshold", + "dtype": "float", + "required": false, + "name": "threshold", + "default": null, + "deprecated": false + }, + { + "info": "Input residual", + "dtype": "str", + "required": false, + "name": "residual", + "default": null, + "deprecated": false + }, + { + "info": "Maximum dynamic range used to determine the threshold above which components need to be fit", + "dtype": "float", + "required": false, + "name": "maxDR", + "default": null, + "deprecated": false + }, + { + "info": "Outputs to write. a - alpha map, e - alpha error map, i - I0 map, k - I0 error map, I - reconstructed cube form alpha and I0, c - restoring beam used for convolution, m - convolved model, r - convolved residual, b - average power beam. Default is 'aeikIcmrb'", + "dtype": "str", + "required": false, + "name": "products", + "default": null, + "deprecated": false + }, + { + "info": "Passing this flag bypasses the convolution", + "dtype": "bool", + "required": false, + "name": "dont-convolve", + "default": null, + "deprecated": false + }, + { + "info": "Per-channel weights to use during fit to frequency axis", + "dtype": "list:float", + "required": false, + "name": "channel_weights", + "default": null, + "deprecated": false + }, + { + "info": "Reference frequency where the I0 map is sought", + "dtype": "float", + "required": false, + "name": "ref-freq", + "default": null, + "deprecated": false + }, + { + "info": "Add in the convolved residuals before fitting components", + "dtype": "bool", + "required": false, + "name": "add-convolved-residuals", + "default": null, + "deprecated": false + }, + { + "info": "Mesurement sets used to make the image. Used for parallactic angles in case of primary beam correction", + "dtype": "list:str", + "required": false, + "name": "ms", + "default": null, + "deprecated": false + }, + { + "info": "Field Id", + "dtype": "int", + "required": false, + "name": "field", + "default": null, + "deprecated": false + }, + { + "info": "Used to select a subset of time. Default is 10", + "dtype": "int", + "required": false, + "name": "sparsify-time", + "default": null, + "deprecated": false + }, + { + "info": "Correlation typ i.e. linear or circular.", + "dtype": "str", + "required": false, + "name": "corr-type", + "default": null, + "deprecated": false + } + ] +} diff --git a/stimela/cargo/cab/spimple_spifit/src/run.py b/stimela/cargo/cab/spimple_spifit/src/run.py new file mode 100644 index 00000000..8cb4e1fd --- /dev/null +++ b/stimela/cargo/cab/spimple_spifit/src/run.py @@ -0,0 +1,11 @@ +# -*- coding: future_fstrings -*- +import sys + +from scabha import config, parse_parameters, prun + +args = [config.binary] + parse_parameters(repeat=" ") + +# run the command +if prun(args) != 0: + sys.exit(1) + From fdb0c2053d37a7c281146a3e54cfc165cd5fd0f2 Mon Sep 17 00:00:00 2001 From: mulan-94 Date: Wed, 6 Jul 2022 18:00:10 +0200 Subject: [PATCH 02/10] Fix some params --- stimela/cargo/cab/spimple_imconv/parameters.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stimela/cargo/cab/spimple_imconv/parameters.json b/stimela/cargo/cab/spimple_imconv/parameters.json index b62fb470..c519be69 100644 --- a/stimela/cargo/cab/spimple_imconv/parameters.json +++ b/stimela/cargo/cab/spimple_imconv/parameters.json @@ -75,7 +75,7 @@ { "info": "Padding fraction for FFTs (half on either side). Default is 0.5", "dtype": "float", - "required": true, + "required": false, "name": "padding-frac", "default": null, "deprecated": false @@ -83,7 +83,7 @@ { "info": "Data type of output. Default is single precision", "dtype": "str", - "required": true, + "required": false, "name": "out-dtype", "default": null, "deprecated": false From 2982625c320df19f9a9a97f688c6117d3d360ff4 Mon Sep 17 00:00:00 2001 From: mulan-94 Date: Wed, 6 Jul 2022 23:45:17 +0200 Subject: [PATCH 03/10] Allow multiple params for single cmdl argument --- stimela/cargo/cab/spimple_imconv/src/run.py | 6 +++++- stimela/cargo/cab/spimple_spifit/parameters.json | 4 ++-- stimela/cargo/cab/spimple_spifit/src/run.py | 6 +++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/stimela/cargo/cab/spimple_imconv/src/run.py b/stimela/cargo/cab/spimple_imconv/src/run.py index 8cb4e1fd..35e4cd63 100644 --- a/stimela/cargo/cab/spimple_imconv/src/run.py +++ b/stimela/cargo/cab/spimple_imconv/src/run.py @@ -3,8 +3,12 @@ from scabha import config, parse_parameters, prun -args = [config.binary] + parse_parameters(repeat=" ") +pars = parse_parameters(repeat=" ") +if "psf-pars" in pars: + pars = " ".join(pars).split() +args = [config.binary] + pars + # run the command if prun(args) != 0: sys.exit(1) diff --git a/stimela/cargo/cab/spimple_spifit/parameters.json b/stimela/cargo/cab/spimple_spifit/parameters.json index 848cd2b0..fda13370 100644 --- a/stimela/cargo/cab/spimple_spifit/parameters.json +++ b/stimela/cargo/cab/spimple_spifit/parameters.json @@ -75,7 +75,7 @@ { "info": "Padding fraction for FFTs (half on either side). Default is 0.5", "dtype": "float", - "required": true, + "required": false, "name": "padding-frac", "default": null, "deprecated": false @@ -83,7 +83,7 @@ { "info": "Data type of output. Default is single precision", "dtype": "str", - "required": true, + "required": false, "name": "out_dtype", "default": null, "deprecated": false diff --git a/stimela/cargo/cab/spimple_spifit/src/run.py b/stimela/cargo/cab/spimple_spifit/src/run.py index 8cb4e1fd..35e4cd63 100644 --- a/stimela/cargo/cab/spimple_spifit/src/run.py +++ b/stimela/cargo/cab/spimple_spifit/src/run.py @@ -3,8 +3,12 @@ from scabha import config, parse_parameters, prun -args = [config.binary] + parse_parameters(repeat=" ") +pars = parse_parameters(repeat=" ") +if "psf-pars" in pars: + pars = " ".join(pars).split() +args = [config.binary] + pars + # run the command if prun(args) != 0: sys.exit(1) From f165eac1b794a6edbb086b5057eea624a8816cae Mon Sep 17 00:00:00 2001 From: mulan-94 Date: Thu, 7 Jul 2022 12:17:47 +0200 Subject: [PATCH 04/10] Small fix --- stimela/cargo/cab/spimple_imconv/src/run.py | 2 +- stimela/cargo/cab/spimple_spifit/src/run.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stimela/cargo/cab/spimple_imconv/src/run.py b/stimela/cargo/cab/spimple_imconv/src/run.py index 35e4cd63..5e8b8d03 100644 --- a/stimela/cargo/cab/spimple_imconv/src/run.py +++ b/stimela/cargo/cab/spimple_imconv/src/run.py @@ -4,7 +4,7 @@ from scabha import config, parse_parameters, prun pars = parse_parameters(repeat=" ") -if "psf-pars" in pars: +if "--psf-pars" in pars: pars = " ".join(pars).split() args = [config.binary] + pars diff --git a/stimela/cargo/cab/spimple_spifit/src/run.py b/stimela/cargo/cab/spimple_spifit/src/run.py index 35e4cd63..5e8b8d03 100644 --- a/stimela/cargo/cab/spimple_spifit/src/run.py +++ b/stimela/cargo/cab/spimple_spifit/src/run.py @@ -4,7 +4,7 @@ from scabha import config, parse_parameters, prun pars = parse_parameters(repeat=" ") -if "psf-pars" in pars: +if "--psf-pars" in pars: pars = " ".join(pars).split() args = [config.binary] + pars From 4ec0c97538e1b69750b246179b95ca48979be769 Mon Sep 17 00:00:00 2001 From: Sphesihle Makhathini Date: Mon, 28 Nov 2022 13:56:27 +0200 Subject: [PATCH 05/10] Update run.py --- stimela/cargo/cab/simulator/src/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stimela/cargo/cab/simulator/src/run.py b/stimela/cargo/cab/simulator/src/run.py index 3812fe1c..b2cfc401 100644 --- a/stimela/cargo/cab/simulator/src/run.py +++ b/stimela/cargo/cab/simulator/src/run.py @@ -137,7 +137,7 @@ def compute_vis_noise(msname, sefd, spw_id=0): NANT)*rms_perr, numpy.random.randn(NANT)*rms_perr ll, mm = " ".join(map(str, perr[0])), " ".join(map(str, perr[-1])) options['oms_pointing_errors.pe_l.values_str'] = "'%s'" % ll - options['oms_pointing_errors.pe_l.values_str'] = "'%s'" % mm + options['oms_pointing_errors.pe_m.values_str'] = "'%s'" % mm field_center = params.pop("field-center", None) if field_center and skymodel: From 591a8a7bb6d6744a9d80f57d8a87ad016f0d9811 Mon Sep 17 00:00:00 2001 From: Lexy Andati Date: Fri, 16 Dec 2022 10:53:46 +0200 Subject: [PATCH 06/10] Fix typo in task name for binterp cab --- stimela/cargo/cab/spimple_binterp/parameters.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stimela/cargo/cab/spimple_binterp/parameters.json b/stimela/cargo/cab/spimple_binterp/parameters.json index 973b911c..c3739048 100644 --- a/stimela/cargo/cab/spimple_binterp/parameters.json +++ b/stimela/cargo/cab/spimple_binterp/parameters.json @@ -1,5 +1,5 @@ { - "task": "spimple imconv", + "task": "spimple binterp", "base": "stimela/spimple", "tag": "1.7.1", "description": "Beam intrepolation tool.", From 622290cc33d770548403c8740488771b8698935d Mon Sep 17 00:00:00 2001 From: Lexy Andati Date: Fri, 16 Dec 2022 11:50:34 +0200 Subject: [PATCH 07/10] Bump to spimple 1.7.2b --- stimela/cargo/cab/spimple_binterp/parameters.json | 2 +- stimela/cargo/cab/spimple_imconv/parameters.json | 2 +- stimela/cargo/cab/spimple_spifit/parameters.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/stimela/cargo/cab/spimple_binterp/parameters.json b/stimela/cargo/cab/spimple_binterp/parameters.json index c3739048..40cb0edd 100644 --- a/stimela/cargo/cab/spimple_binterp/parameters.json +++ b/stimela/cargo/cab/spimple_binterp/parameters.json @@ -1,7 +1,7 @@ { "task": "spimple binterp", "base": "stimela/spimple", - "tag": "1.7.1", + "tag": "1.7.12b", "description": "Beam intrepolation tool.", "prefix": "--", "binary": "spimple-binterp", diff --git a/stimela/cargo/cab/spimple_imconv/parameters.json b/stimela/cargo/cab/spimple_imconv/parameters.json index c519be69..784b74e1 100644 --- a/stimela/cargo/cab/spimple_imconv/parameters.json +++ b/stimela/cargo/cab/spimple_imconv/parameters.json @@ -1,7 +1,7 @@ { "task": "spimple imconv", "base": "stimela/spimple", - "tag": "1.7.1", + "tag": "1.7.2b", "description": "Convolve images to a common resolution", "prefix": "--", "binary": "spimple-imconv", diff --git a/stimela/cargo/cab/spimple_spifit/parameters.json b/stimela/cargo/cab/spimple_spifit/parameters.json index fda13370..2c026259 100644 --- a/stimela/cargo/cab/spimple_spifit/parameters.json +++ b/stimela/cargo/cab/spimple_spifit/parameters.json @@ -1,7 +1,7 @@ { "task": "spimple SPI fitter", "base": "stimela/spimple", - "tag": "1.7.1", + "tag": "1.7.2b", "description": "Simple spectral index fitting tool.", "prefix": "--", "binary": "spimple-spifit", From 2ec09199dbcc4f69cf3c185835991ae27c9b4150 Mon Sep 17 00:00:00 2001 From: mulan-94 Date: Wed, 21 Dec 2022 18:41:32 +0200 Subject: [PATCH 08/10] Add gap-channel-div Attempting fix of #771 --- stimela/cargo/cab/wsclean/parameters.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stimela/cargo/cab/wsclean/parameters.json b/stimela/cargo/cab/wsclean/parameters.json index 0a72fc75..1aa56b06 100644 --- a/stimela/cargo/cab/wsclean/parameters.json +++ b/stimela/cargo/cab/wsclean/parameters.json @@ -632,6 +632,12 @@ "dtype": "int", "default": null, "name": "pb-grid-size" + }, + { + "info": "In case of irregular frequency spacing, this option can be used to not try and split channels to make the output channel bandwidth similar, but instead to split largest gaps first.", + "dtype": "bool", + "default": null, + "name": "gap-channel-division" } ] } From dce71db5670112b8a3836273704f7d377e64be72 Mon Sep 17 00:00:00 2001 From: Athanaseus Javas Ramaila Date: Tue, 17 Sep 2024 15:53:24 +0200 Subject: [PATCH 09/10] Update parameters.json --- stimela/cargo/cab/wsclean/parameters.json | 1 + 1 file changed, 1 insertion(+) diff --git a/stimela/cargo/cab/wsclean/parameters.json b/stimela/cargo/cab/wsclean/parameters.json index fa46ec8e..d3553808 100644 --- a/stimela/cargo/cab/wsclean/parameters.json +++ b/stimela/cargo/cab/wsclean/parameters.json @@ -652,6 +652,7 @@ "default": null, "name": "gap-channel-division" }, + { "info": "Restore the model image onto the residual image and save it in output image. By default, the beam parameters are read from the residual image. If this parameter is given, wsclean will do the restoring and then exit: no cleaning is performed.", "dtype": "list:file", "name": "restore", From 83f9b0588776805304922ad1520901677b2421f8 Mon Sep 17 00:00:00 2001 From: Athanaseus Javas Ramaila Date: Tue, 17 Sep 2024 16:11:50 +0200 Subject: [PATCH 10/10] Update parameters.json --- stimela/cargo/cab/spimple_binterp/parameters.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stimela/cargo/cab/spimple_binterp/parameters.json b/stimela/cargo/cab/spimple_binterp/parameters.json index 40cb0edd..d89712f2 100644 --- a/stimela/cargo/cab/spimple_binterp/parameters.json +++ b/stimela/cargo/cab/spimple_binterp/parameters.json @@ -1,7 +1,7 @@ { "task": "spimple binterp", "base": "stimela/spimple", - "tag": "1.7.12b", + "tag": "1.7.2b", "description": "Beam intrepolation tool.", "prefix": "--", "binary": "spimple-binterp",