Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions steps/dp3_avg_step.cwl

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this step is best combined with steps/dp3_prep_phasediff.cwl. That only does averaging as well.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we can do this in a separate MR. Will add a ticket to the LOFAR-VLBI ticket board

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would carry finishing this PR over to the busy week then. It feels a bit moot to add a step and then immediately have another PR removing it already planned for the next weeks.

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
class: CommandLineTool
cwlVersion: v1.2
id: dp3_avg_step
label: DP3 averaging for prediction
doc: Average MeasurementSet in time and frequency for faster prediction.

baseCommand: DP3

inputs:
- id: msin
type: Directory
doc: Input MeasurementSet
inputBinding:
position: 0
prefix: msin=
separate: false

- id: averaging_factor
type: int?
doc: Averaging factor

outputs:
- id: ms_avg
doc: MeasurementSet at lower time/freq resolution
type: Directory
outputBinding:
glob: "$( inputs.msin.basename + '.avg.ms')"

- id: logfile
type: File[]
outputBinding:
glob: predict_avg*.log
doc: |
The files containing the stdout
and stderr from the step.

arguments:
- steps=[avg]
- avg.type=averager
- valueFrom: $("avg.timestep=" + inputs.averaging_factor)
- valueFrom: $("avg.freqstep=" + inputs.averaging_factor)
- msout.storagemanager='dysco'
- msout.storagemanager.databitrate=6
- msout=$( inputs.msin.basename + '.avg.ms')

requirements:
- class: InlineJavascriptRequirement

hints:
- class: DockerRequirement
dockerPull: vlbi-cwl
- class: ResourceRequirement
coresMin: 8

stdout: dp3_avg_step.log
stderr: dp3_avg_step_err.log

27 changes: 19 additions & 8 deletions steps/wsclean.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ inputs:
prefix: '-temp-dir'
- id: ncpu
type: int?
default: 24
inputBinding:
position: 1
shellQuote: false
prefix: '-j'
valueFrom: |
${ return self !== null ? self : runtime.cores; }
- id: size
type: int[]?
default: [22500, 22500]
Expand All @@ -51,13 +52,13 @@ inputs:
position: 1
shellQuote: false
prefix: '-minuv-l'
- id: weight
type: string?
default: briggs -1.4
- id: briggs
type: float?
default: -1.4
inputBinding:
position: 1
shellQuote: false
prefix: '-weight'
prefix: '-weight briggs'
- id: weighting-rank-filter
type: int?
default: 3
Expand Down Expand Up @@ -137,7 +138,7 @@ inputs:
prefix: '-niter'
- id: multiscale-scale-bias
type: float?
default: 0.7
default: 0.6
inputBinding:
position: 1
shellQuote: false
Expand Down Expand Up @@ -347,11 +348,21 @@ hints:

requirements:
- class: ShellCommandRequirement
- class: InlineJavascriptRequirement
expressionLib:
- |
function wsclean_cores(size) {
var imsize = Math.max(size[0], size[1]);
var raw = imsize / 512.0;
var cores = Math.round(raw / 4.0) * 4; // nearest multiple of 4
return Math.max(8, Math.min(64, cores));
}
- class: ResourceRequirement
coresMin: |
${ return inputs.ncpu !== null ? inputs.ncpu : wsclean_cores(inputs.size); }
- class: InitialWorkDirRequirement
listing:
- entry: $(inputs.msin)
- class: ResourceRequirement
coresMin: $(inputs.ncpu)

stdout: wsclean.log
stderr: wsclean_err.log
58 changes: 54 additions & 4 deletions workflows/facet_imaging.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ requirements:
- class: ScatterFeatureRequirement
- class: SubworkflowFeatureRequirement
- class: InlineJavascriptRequirement
- class: MultipleInputFeatureRequirement

inputs:
- id: msin
Expand All @@ -24,6 +25,11 @@ inputs:
type: string
doc: Angular resolution that will be passed to WSClean's taper argument. Its syntax follows that of WSClean.

- id: averaging_factor
type: int?
default: 1
doc: Additional factor to average the data with in both time and frequency before imaging.

- id: facet_polygons
type: File[]
doc: |
Expand All @@ -35,6 +41,11 @@ inputs:
doc: |
Restoring beam to use for every facet following the WSClean order of major axis, minor axis, position angle.

- id: briggs
type: float?
default: -1.4
doc: Briggs weighting for WSClean.

- id: swarp_config
type: File?
doc: |
Expand All @@ -46,18 +57,51 @@ inputs:
type: string?
doc: Temporary directory to run I/O heavy jobs.

- id: ncpu
type: int?
doc: |
The number of cores that WSClean will use.
Default is to calculate it internally based on image size

steps:
- id: average_ms
label: Apply extra averaging of MS
in:
- id: msin
source: msin
- id: averaging_factor
source: averaging_factor
out:
- ms_avg
run: ../steps/dp3_avg_step.cwl
scatter: msin
when: $(inputs.averaging_factor > 1)

- id: sort_mses
label: Trim facets
label: Sort MS based on name
in:
- id: input_entry
source: msin
source:
- average_ms/ms_avg
- msin
linkMerge: merge_nested
pickValue: all_non_null
valueFrom: |
${
var avg = self[0];
if (avg === null || avg === undefined) { return self[1]; }
var kept = [];
for (var i = 0; i < avg.length; i++) {
if (avg[i] !== null && avg[i] !== undefined) { kept.push(avg[i]); }
}
return kept.length === 0 ? self[1] : kept;
}
out:
- id: sorted_entries
run: ../steps/sort_by_name.cwl

- id: sort_facet_regions
label: Trim facets
label: Sort facets based on name
in:
- id: input_entry
source: facet_polygons
Expand All @@ -76,8 +120,12 @@ steps:
source: pixel_scale
- id: resolution
source: resolution
- id: briggs
source: briggs
- id: tmpdir
source: tmpdir
- id: ncpu
source: ncpu
out:
- id: MFS_image_pb
- id: MFS_image
Expand Down Expand Up @@ -128,7 +176,9 @@ outputs:
outputSource: image_and_trim/MFS_model

- id: MFS_psfs
type: File[]
type:
- File?
- File[]?
outputSource: image_and_trim/MFS_psf

- id: MFS_mosaic
Expand Down
32 changes: 21 additions & 11 deletions workflows/subworkflows/image_and_trim.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ inputs:
type: Directory
doc: MeasurementSet that will be imaged.

- id: number_cores
- id: ncpu
type: int?
default: 24
doc: The number of cores that WSClean will use.
doc: |
The number of cores that WSClean will use.
Default is to calculate it internally based on image size

- id: pixel_scale
type: float
Expand All @@ -27,6 +28,11 @@ inputs:
default: 0.3asec
doc: Angular resolution that will be passed to WSClean's taper argument. Its syntax follows that of WSClean.

- id: briggs
type: float?
default: -1.4
doc: Briggs weighting for WSClean.

- id: facet_polygon
type: File
doc: DS9 region file that will be used to trim the facet.
Expand Down Expand Up @@ -60,7 +66,7 @@ steps:
label: make_facet_image
in:
- id: ncpu
source: number_cores
source: ncpu
- id: msin
source: msin
- id: name
Expand All @@ -76,6 +82,8 @@ steps:
valueFrom: $(self.toString() + "asec")
- id: beam-shape
source: restoring_beam
- id: briggs
source: briggs
- id: tmpdir
source: tmpdir
- id: apply-facet-beam
Expand All @@ -94,7 +102,7 @@ steps:
run: ../../steps/wsclean.cwl

- id: trim_image_pb
label: Trim facets
label: Trim facet image-pb
in:
- id: image
source:
Expand All @@ -108,7 +116,7 @@ steps:
run: ../../steps/trim_facet.cwl

- id: trim_image
label: Trim facets
label: Trim facet image
in:
- id: image
source:
Expand All @@ -122,7 +130,7 @@ steps:
run: ../../steps/trim_facet.cwl

- id: trim_model_pb
label: Trim facets
label: Trim model image-pb
in:
- id: image
source:
Expand All @@ -136,7 +144,7 @@ steps:
run: ../../steps/trim_facet.cwl

- id: trim_model
label: Trim facets
label: Trim model image
in:
- id: image
source:
Expand All @@ -150,7 +158,7 @@ steps:
run: ../../steps/trim_facet.cwl

- id: trim_residual_pb
label: Trim facets
label: Trim residual image-pb
in:
- id: image
source:
Expand All @@ -164,7 +172,7 @@ steps:
run: ../../steps/trim_facet.cwl

- id: trim_residual
label: Trim facets
label: Trim residual image
in:
- id: image
source:
Expand Down Expand Up @@ -201,5 +209,7 @@ outputs:
outputSource: trim_residual/trimmed_image

- id: MFS_psf
type: File
type:
- File?
- File[]?
Comment thread
tikk3r marked this conversation as resolved.
outputSource: make_facet_image/MFS_psf
Loading