diff --git a/lofar-cwl/steps/applybeam.cwl b/lofar-cwl/steps/applybeam.cwl index 099f62ce2d7a56075fa745c6ed23a296f7289b34..a69a628f3326af0bd5d3adc4f21e471ae7623e9b 100644 --- a/lofar-cwl/steps/applybeam.cwl +++ b/lofar-cwl/steps/applybeam.cwl @@ -2,7 +2,7 @@ class: CommandLineTool cwlVersion: v1.0 $namespaces: sbg: 'https://www.sevenbridges.com/' -id: applycal +id: applybeam baseCommand: - DPPP inputs: diff --git a/lofar-cwl/steps/check_ateam_separation.cwl b/lofar-cwl/steps/check_ateam_separation.cwl deleted file mode 100755 index c8d801c94a6e32aac1ea6ba83a8d2687448baf22..0000000000000000000000000000000000000000 --- a/lofar-cwl/steps/check_ateam_separation.cwl +++ /dev/null @@ -1,42 +0,0 @@ -class: CommandLineTool -cwlVersion: v1.0 -id: check_ateam_separation -baseCommand: - - python3 - - /usr/local/bin/check_Ateam_separation.py -inputs: - - id: ms - type: - - Directory - - type: array - items: Directory - inputBinding: - position: 0 - doc: Input measurement set - - default: Ateam_separation.png - id: output_image_name - type: string? - inputBinding: - position: 2 - prefix: '--outputimage' - - id: min_separation - type: int - inputBinding: - position: 1 - prefix: '--min_separation' -outputs: - - id: output_imag - doc: Output image - type: File? - outputBinding: - glob: $(inputs.output_image_name) - - id: logfile - type: File? - outputBinding: - glob: Ateam_separation.log -label: check_Ateam_separation -hints: - - class: DockerRequirement - dockerPull: lofareosc/prefactor:HBAcalibrator - - class: InlineJavascriptRequirement -stdout: Ateam_separation.log diff --git a/lofar-cwl/steps/dpppconcat.cwl b/lofar-cwl/steps/dpppconcat.cwl index 34b788402d38c67dab167d7fdbbc246835d2af28..0fca5fbf8d277303827072dc9f920174deb98f48 100644 --- a/lofar-cwl/steps/dpppconcat.cwl +++ b/lofar-cwl/steps/dpppconcat.cwl @@ -8,13 +8,16 @@ baseCommand: inputs: - id: msin type: 'Directory[]' + doc: Input Measurement Set + - id: msin_fname + doc: Input Measurement Set string (including dummy.ms) + type: 'string[]' inputBinding: position: 0 prefix: msin= separate: false itemSeparator: ',' - valueFrom: $(concatenate_path(self)) - doc: Input Measurement Set + valueFrom: "[$(self.join(','))]" - id: msout_name type: string inputBinding: @@ -87,7 +90,7 @@ inputs: - id: missingdata type: boolean inputBinding: - prefix: msout.missingdata=True + prefix: msin.missingdata=True separate: false shellQuote: false position: 0 @@ -127,7 +130,7 @@ outputs: glob: concat*.log arguments: - 'steps=[filter,avg,count]' - - msout.orderms=False + - msin.orderms=False - avg.type=average requirements: - class: ShellCommandRequirement @@ -137,5 +140,9 @@ requirements: hints: - class: DockerRequirement dockerPull: 'lofareosc/prefactor:HBAcalibrator' + - class: InitialWorkDirRequirement + listing: + - entry: $(inputs.msin) + writable: false stdout: concat.log stderr: concat_err.log diff --git a/steps/check_ateam_separation.cwl b/steps/check_ateam_separation.cwl index 516beb6100f9e73b06cef498a05fc64ae74bd101..00275869f8f58ab58a71965c849027d092137642 100644 --- a/steps/check_ateam_separation.cwl +++ b/steps/check_ateam_separation.cwl @@ -1,11 +1,10 @@ class: CommandLineTool cwlVersion: v1.0 -$namespaces: - sbg: 'https://www.sevenbridges.com/' id: check_ateam_separation baseCommand: - python3 - - /usr/local/bin/check_Ateam_separation.py + - -m + - check_Ateam_separation inputs: - id: ms type: diff --git a/steps/filter_ms_group.cwl b/steps/filter_ms_group.cwl index d51dcf695a9e51a0b748b14c56842b4e76d64284..e09eec16771c5130b0c896db0ce86b4b48818903 100644 --- a/steps/filter_ms_group.cwl +++ b/steps/filter_ms_group.cwl @@ -22,8 +22,14 @@ outputs: type: Directory[] outputBinding: loadContents: true - glob: selected_ms.json + glob: 'selected_ms.json' outputEval: '$(JSON.parse(self[0].contents))' + - id: selected_ms + type: string[] + outputBinding: + loadContents: true + glob: 'out.json' + outputEval: $(JSON.parse(self[0].contents).selected_ms) label: filter_ms_group requirements: @@ -39,20 +45,34 @@ requirements: group_id = "$(inputs.group_id)" json_file = sys.argv[1] ms_list = sys.argv[2:] - + ms_by_name = { ms.split(os.path.sep)[-1]: {'class':'Directory', 'path': ms} for ms in ms_list} - + output_file = 'selected_ms.json' with open(json_file, 'r') as f_stream: selected_ms = json.load(f_stream)[group_id] - print(selected_ms, ms_by_name) - selected_ms = [ms_by_name[os.path.basename(ms_name)] for ms_name in selected_ms] + + selected_ms = [os.path.basename(ms_name) for ms_name in selected_ms] + cwl_output = {'selected_ms': selected_ms} + + with open('./out.json', 'w') as fp: + json.dump(cwl_output, fp) + + selected_ms = [ms_by_name[ms_name] for ms_name in selected_ms if ms_name != 'dummy.ms'] with open(output_file, 'w') as f_stream: json.dump(selected_ms, f_stream) - + + +hints: + - class: InitialWorkDirRequirement + listing: + - entry: $(inputs.measurement_sets) + writable: true +stdout: filter_ms_by_group.log +stderr: filter_ms_by_group_err.log \ No newline at end of file diff --git a/subworkflow/concat.cwl b/subworkflow/concat.cwl index c1c008035867aba21c24f2df2462c980b2a99114..d2224d3459a8bf5297e408f2bce09a9dd4e3085b 100644 --- a/subworkflow/concat.cwl +++ b/subworkflow/concat.cwl @@ -58,6 +58,7 @@ steps: - msin out: - id: output + - id: selected_ms run: ../steps/filter_ms_group.cwl label: filter_ms_group 'sbg:x': -500 @@ -66,7 +67,9 @@ steps: in: - id: msin source: - - filter_ms_group/output + - msin + - id: msin_fname + source: filter_ms_group/selected_ms - id: msout_name source: group_id - id: msin_datacolumn diff --git a/workflows/prefactor_calibrator/prep.cwl b/workflows/prefactor_calibrator/prep.cwl index 57ff28b866c221a11d595aaac7e22dc89f6b81a1..4d40b75b588383b38e56da2ced250b3884503794 100644 --- a/workflows/prefactor_calibrator/prep.cwl +++ b/workflows/prefactor_calibrator/prep.cwl @@ -311,7 +311,7 @@ steps: out: - id: output_imag - id: logfile - run: ../../lofar-cwl/steps/check_ateam_separation.cwl + run: ../../steps/check_ateam_separation.cwl label: check_Ateam_separation 'sbg:x': 254.234375 'sbg:y': 1440 diff --git a/workflows/prefactor_target/prep.cwl b/workflows/prefactor_target/prep.cwl index a068460a96d10bab301ada376ffe05276dd059bd..73a796aa0df5f9d5f3891378f40e5eccbec8ae45 100644 --- a/workflows/prefactor_target/prep.cwl +++ b/workflows/prefactor_target/prep.cwl @@ -225,7 +225,7 @@ steps: out: - id: output_imag - id: logfile - run: ../../lofar-cwl/steps/check_ateam_separation.cwl + run: ../../steps/check_ateam_separation.cwl label: check_Ateam_separation 'sbg:x': -500 'sbg:y': -300