Skip to content
Snippets Groups Projects
finalize.cwl 11.7 KiB
Newer Older
class: Workflow
Marcel Loose's avatar
Marcel Loose committed
cwlVersion: v1.2
id: finalize
label: finalize
inputs:
alex's avatar
alex committed
  - id: refant
    type: string?
    default: 'CS001HBA0'
  - id: min_unflagged_fraction
    type: float?
    default: 0.5
  - id: removed_bands
    type: string[]?
alex's avatar
alex committed
    default: []
alex's avatar
alex committed
  - id: demix_sources
    type: string[]?
alex's avatar
alex committed
    default: []
alex's avatar
alex committed
  - id: demix
alex's avatar
alex committed
    type: boolean?
    default: false
alex's avatar
alex committed
  - id: clip_sources
    type: string[]?
alex's avatar
alex committed
    default: []
  - id: msin
    type:
      - Directory[]
      - Directory
  - id: input_h5parm
    type: File
  - id: inh5parm_logfile
alex's avatar
alex committed
    type: File
  - id: gsmcal_step
alex's avatar
alex committed
    type: string?
    default: 'phase'
  - id: process_baselines_target
alex's avatar
alex committed
    type: string?
    default: '[CR]S*&'
  - id: bad_antennas
alex's avatar
alex committed
    type: string?
    default: '[CR]S*&'
  - id: insolutions
    type: File
  - id: compression_bitrate
alex's avatar
alex committed
    type: int?
    default: 16
alex's avatar
alex committed
  - id: skymodel_source
alex's avatar
alex committed
    type: string?
    default: 'TGSS'
alex's avatar
alex committed
  - id: total_bandwidth
alex's avatar
alex committed
    type: float?
alex's avatar
alex committed
    default: 50
alex's avatar
alex committed
  - id: check_Ateam_separation.json
    type: File
  - id: filter_baselines
alex's avatar
alex committed
    type: string?
    default: '[CR]S*&'
alex's avatar
alex committed
  - id: compare_stations_filter
alex's avatar
alex committed
    type: string?
    default: '[CR]S*&'
alex's avatar
alex committed
  - id: flags
    type: File[]
alex's avatar
alex committed
  - id: targetname
    type: string?
    default: 'pointing'
  - id: wsclean_tmpdir
    type: string?
    default: '/tmp'
  - id: make_structure_plot
    type: boolean?
    default: true
outputs:
  - id: msout
    outputSource:
      - apply_gsmcal/msout
    type: Directory[]
  - id: solutions
    outputSource:
alex's avatar
alex committed
      - h5parm_pointingname/outh5parm
    type: File
  - id: logfiles
    outputSource:
      - concat_logfiles_applygsm/output
      - concat_logfiles_solutions/output
alex's avatar
alex committed
      - concat_logfiles_structure/output
alex's avatar
alex committed
      - concat_logfiles_wsclean/output
alex's avatar
alex committed
      - concat_logfiles_summary/output
      - concat_logfiles_uvplot/output
    type: File[]
    linkMerge: merge_flattened
alex's avatar
alex committed
    pickValue: all_non_null
alex's avatar
alex committed
  - id: inspection
    outputSource:
      - structure_function/output_plot
alex's avatar
alex committed
      - wsclean/image
alex's avatar
alex committed
      - uvplot/output_image
    type: File[]
alex's avatar
alex committed
    linkMerge: merge_flattened
alex's avatar
alex committed
    pickValue: all_non_null
alex's avatar
alex committed
  - id: summary_file
    outputSource:
      - summary/summary_file
    type: File
steps:
  - id: add_missing_stations
    in:
      - id: h5parm
        source: input_h5parm
      - id: refh5parm
        source: insolutions
alex's avatar
alex committed
      - id: solset
        default: sol000
      - id: refsolset
        default: target
      - id: soltab_in
        source: gsmcal_step
        valueFrom: $(self == "phase" || self == "scalarphase" ? 'phase000':self+'000')
      - id: soltab_out
alex's avatar
alex committed
        source:
          - skymodel_source
          - gsmcal_step
        valueFrom: $(self.join(''))
      - id: filter
        source: process_baselines_target
      - id: bad_antennas
        source: bad_antennas
    out:
      - id: outh5parm
      - id: log
    run: ../../steps/add_missing_stations.cwl
    label: add_missing_stations
  - id: apply_gsmcal
    in:
      - id: msin
        source: [ msin ]
        linkMerge: merge_flattened
alex's avatar
alex committed
      - id: msout_name
        linkMerge: merge_flattened
alex's avatar
alex committed
        source:
          - msin
        valueFrom: $(self.nameroot+'_pre-cal.ms')
      - id: msin_datacolumn
        default: DATA
      - id: parmdb
        source: write_solutions/outh5parm
      - id: msout_datacolumn
        default: DATA
      - id: correction
alex's avatar
alex committed
        source:
          - skymodel_source
          - gsmcal_step
        valueFrom: $(self.join(''))
      - id: solset
alex's avatar
alex committed
        default: target
      - id: storagemanager
        default: Dysco
      - id: databitrate
        source: compression_bitrate
    out:
      - id: msout
alex's avatar
alex committed
      - id: flagged_fraction_dict
      - id: logfile
alex's avatar
alex committed
    run: ../../steps/applytarget.cwl
    label: apply_gsmcal
    scatter:
      - msin
alex's avatar
alex committed
      - msout_name
    scatterMethod: dotproduct
alex's avatar
alex committed
  - id: final_flags_join
    in:
      - id: flagged_fraction_dict
        source:
alex's avatar
alex committed
          - apply_gsmcal/flagged_fraction_dict
alex's avatar
alex committed
      - id: filter_station
        default: ''
      - id: state
        default: 'final'
    out:
      - id: flagged_fraction_antenna
    run: ./../../steps/findRefAnt_join.cwl
    label: final_flags_join
alex's avatar
alex committed
  - id: average
    in:
      - id: msin
        source: apply_gsmcal/msout
      - id: msout_name
        linkMerge: merge_flattened
        source:
          - apply_gsmcal/msout
        valueFrom: $(self.nameroot+'_wsclean.ms')
      - id: msin_datacolumn
        default: DATA
      - id: overwrite
        default: false
      - id: storagemanager
        default: Dysco
      - id: avg_timestep
        default: 2
      - id: avg_freqstep
        default: 2
    out:
      - id: msout
      - id: logfile
alex's avatar
alex committed
    run: ../../steps/average.cwl
alex's avatar
alex committed
    label: average
    scatter:
      - msin
      - msout_name
    scatterMethod: dotproduct
alex's avatar
alex committed
  - id: summary
    in:
      - id: flagFiles
        source: 
          - flags
          - final_flags_join/flagged_fraction_antenna
        linkMerge: merge_flattened
      - id: pipeline
alex's avatar
alex committed
        default: 'LINC'
alex's avatar
alex committed
      - id: run_type
        default: 'target'
      - id: filter
        source: filter_baselines
      - id: bad_antennas
        source:
          - bad_antennas
          - compare_stations_filter
        valueFrom: $(self.join(''))
      - id: Ateam_separation_file
        source: check_Ateam_separation.json
      - id: solutions
        source: h5parm_pointingname/outh5parm
      - id: clip_sources
        source: clip_sources
        valueFrom: "$(self.join(','))"
      - id: demix
        source: demix
alex's avatar
alex committed
        valueFrom: '$(self ? "True" : "False")'
alex's avatar
alex committed
      - id: demix_sources
        source: demix_sources
        valueFrom: "$(self.join(','))"
alex's avatar
alex committed
      - id: removed_bands
        source: removed_bands
        valueFrom: "$(self.join(','))"
      - id: min_unflagged_fraction
        source: min_unflagged_fraction
      - id: refant
        source: refant
alex's avatar
alex committed
    out:
      - id: summary_file
      - id: logfile
    run: ../../steps/summary.cwl
    label: summary
  - id: uvplot
    in:
      - id: MSfiles
        source: apply_gsmcal/msout
      - id: output_name
alex's avatar
alex committed
        source: targetname
alex's avatar
alex committed
        valueFrom: $(self)_uv-coverage.png
      - id: title
alex's avatar
alex committed
        source: targetname
alex's avatar
alex committed
        valueFrom: '"uv coverage of the target pointing: $(self)"'
alex's avatar
alex committed
      - id: timeslots
        default: "0,20,0"
alex's avatar
alex committed
      - id: wideband
        default: true
    out:
      - id: output_image
      - id: logfile
    run: ../../steps/uvplot.cwl
    label: uvplot
alex's avatar
alex committed
  - id: wsclean
    in:
      - id: msin
        source:
          - average/msout
      - id: image_scale
        default: 15asec
alex's avatar
alex committed
      - id: auto_threshold
        default: 5
alex's avatar
alex committed
        default: [2500,2500]
alex's avatar
alex committed
      - id: niter
alex's avatar
alex committed
        default: 10000
alex's avatar
alex committed
      - id: nmiter
        default: 5
      - id: multiscale
        default: true
      - id: use-wgridder
        default: true
alex's avatar
alex committed
      - id: mgain
        default: 0.8
      - id: parallel-deconvolution
        default: 1500
      - id: parallel-reordering
        default: 4
      - id: channels-out
        source: total_bandwidth
alex's avatar
alex committed
        valueFrom: '$(Math.round(self/1e7) < 1 ? 1 : Math.round(self/1e7))'
alex's avatar
alex committed
      - id: join-channels
alex's avatar
alex committed
        source: total_bandwidth
        valueFrom: $(Math.round(self/1e7) > 1)
      - id: deconvolution-channels
        source: total_bandwidth
        valueFrom: '$(Math.round(self/1e7) > 1 ? (Math.round(self/1e7) > 3 ? 3 : Math.round(self/1e7)) : false )'
      - id: fit-spectral-pol
        source: total_bandwidth
        valueFrom: '$(Math.round(self/1e7) > 1 ? (Math.round(self/1e7) > 3 ? 3 : Math.round(self/1e7)) : false )'
alex's avatar
alex committed
      - id: taper-gaussian
        default: 40asec
      - id: weighting
        default: briggs -0.5
      - id: maxuvw-m
        default: 20000
      - id: tempdir
alex's avatar
alex committed
      - id: image_name
alex's avatar
alex committed
        source: targetname
alex's avatar
alex committed
      - id: no_model_update
        default: true
alex's avatar
alex committed
    out:
      - id: dirty_image
      - id: image
      - id: logfile
alex's avatar
alex committed
    run: ../../steps/wsclean.cwl
alex's avatar
alex committed
    label: wsclean
alex's avatar
alex committed
  - id: merge_array_files
    in:
      - id: input
        source:
          - apply_gsmcal/logfile
    out:
      - id: output
    run: ../../steps/merge_array_files.cwl
    label: merge_array_files
  - id: write_solutions
    in:
      - id: h5parmFile
        source: add_missing_stations/outh5parm
      - id: outsolset
        default: target
      - id: insoltab
alex's avatar
alex committed
        source:
          - skymodel_source
          - gsmcal_step
        valueFrom: $(self.join(''))
      - id: input_file
        source: insolutions
      - id: squeeze
        default: true
      - id: verbose
        default: true
      - id: history
        default: true
    out:
      - id: outh5parm
      - id: log
    run: ../../steps/h5parmcat.cwl
    label: write_solutions
alex's avatar
alex committed
  - id: h5parm_pointingname
    in:
      - id: h5parmFile
        source: write_solutions/outh5parm
      - id: solsetName
alex's avatar
alex committed
        default: target
alex's avatar
alex committed
      - id: pointing
alex's avatar
alex committed
        source: targetname
alex's avatar
alex committed
    out:
      - id: outh5parm
      - id: log
    run: ../../steps/h5parm_pointingname.cwl
    label: h5parm_pointingname
alex's avatar
alex committed
  - id: structure_function
    in:
      - id: input_h5parm
alex's avatar
alex committed
        source: write_solutions/outh5parm
      - id: soltab
        source:
          - skymodel_source
          - gsmcal_step
        valueFrom: $('target/'+self.join(''))
      - id: plotName
alex's avatar
alex committed
        source: targetname
        valueFrom: $(self+'_structure.png')
      - id: execute
        source: make_structure_plot
alex's avatar
alex committed
    out:
      - id: output_plot
      - id: logfile
    run: ../../steps/LoSoTo.Structure.cwl
alex's avatar
alex committed
    label: structure_function
    when: $(inputs.soltab.includes("phase") && inputs.execute)
  - id: concat_logfiles_applygsm
    in:
      - id: file_list
        source:
alex's avatar
alex committed
          - merge_array_files/output
      - id: file_prefix
        default: apply_gsmcal
    out:
      - id: output
    run: ../../steps/concatenate_files.cwl
    label: concat_logfiles_applygsm
  - id: concat_logfiles_solutions
    in:
      - id: file_list
        linkMerge: merge_flattened
        source:
          - inh5parm_logfile
          - add_missing_stations/log
          - write_solutions/log
alex's avatar
alex committed
          - h5parm_pointingname/log
      - id: file_prefix
        default: losoto_gsmcal
    out:
      - id: output
    run: ../../steps/concatenate_files.cwl
    label: concat_logfiles_solutions
alex's avatar
alex committed
  - id: concat_logfiles_structure
    in:
      - id: file_list
        linkMerge: merge_flattened
        source:
          - structure_function/logfile
alex's avatar
alex committed
        pickValue: all_non_null
alex's avatar
alex committed
      - id: file_prefix
        source:
          - targetname
          - gsmcal_step
        valueFrom: $(self.join('_')+'_structure')
alex's avatar
alex committed
      - id: execute
        source: make_structure_plot
alex's avatar
alex committed
    out:
      - id: output
    run: ../../steps/concatenate_files.cwl
    label: concat_logfiles_structure
    when: $(inputs.file_prefix.includes("phase") && inputs.execute)
alex's avatar
alex committed
  - id: concat_logfiles_wsclean
    in:
      - id: file_list
        linkMerge: merge_flattened
        source:
          - wsclean/logfile
      - id: file_prefix
        default: wsclean
    out:
      - id: output
    run: ../../steps/concatenate_files.cwl
    label: concat_logfiles_wsclean
alex's avatar
alex committed
  - id: concat_logfiles_summary
    in:
      - id: file_list
        linkMerge: merge_flattened
        source:
          - summary/logfile
      - id: file_prefix
alex's avatar
alex committed
        source: targetname
alex's avatar
alex committed
        valueFrom: $(self+'_summary')
    out:
      - id: output
    run: ../../steps/concatenate_files.cwl
    label: concat_logfiles_summary
  - id: concat_logfiles_uvplot
    in:
      - id: file_list
        linkMerge: merge_flattened
        source:
          - uvplot/logfile
      - id: file_prefix
        default: uvplot
    out:
      - id: output
    run: ../../steps/concatenate_files.cwl
    label: concat_logfiles_uvplot
requirements:
  - class: StepInputExpressionRequirement
alex's avatar
alex committed
  - class: InlineJavascriptRequirement
  - class: ScatterFeatureRequirement
  - class: MultipleInputFeatureRequirement