Skip to content
Snippets Groups Projects
gsmcal.cwl 17.4 KiB
Newer Older
alex's avatar
alex committed
class: Workflow
Marcel Loose's avatar
Marcel Loose committed
cwlVersion: v1.2
id: gsmcal
label: gsmcal
alex's avatar
alex committed
inputs:
  - id: max_dp3_threads
    type: int?
alex's avatar
alex committed
  - id: msin
    type: Directory[]
alex's avatar
alex committed
  - id: filter_baselines
alex's avatar
alex committed
    type: string?
    default: '[CR]S*&'
  - id: target_skymodel
alex's avatar
alex committed
    type: 
      - File
      - Directory
  - id: do_smooth
alex's avatar
alex committed
    type: boolean?
    default: false
  - id: propagatesolutions
alex's avatar
alex committed
    type: boolean?
    default: true
  - id: avg_timeresolution_concat
alex's avatar
alex committed
    type: int?
    default: 8
  - id: avg_freqresolution_concat
alex's avatar
alex committed
    type: string?
    default: '97.64kHz'
alex's avatar
alex committed
  - id: min_unflagged_fraction
alex's avatar
alex committed
    type: float?
    default: 0.5
alex's avatar
alex committed
  - id: refant
alex's avatar
alex committed
    type: string?
    default: 'CS001HBA0'
alex's avatar
alex committed
  - id: rfistrategy
    type:
      - File?
      - string?
  - id: aoflag_reorder
    type: boolean?
    default: false
  - id: aoflag_chunksize
    type: int?
    default: 2000
alex's avatar
alex committed
  - id: aoflag_freqconcat
    type: boolean?
    default: true
alex's avatar
alex committed
  - id: gsmcal_step
    type: string?
    default: 'phase'
  - id: skymodel_source
    type: string?
    default: 'TGSS'
  - id: process_baselines_target
    type: string?
    default: '[CR]S*&'
  - id: insolutions
    type: File
alex's avatar
alex committed
  - id: selfcal
    type: boolean?
alex's avatar
alex committed
  - id: chunkduration
    type: float?
    default: 0.0
alex's avatar
alex committed
  - id: targetname
    type: string?
    default: 'pointing'
  - id: wsclean_tmpdir
    type: string?
    default: '/tmp'
  - id: total_bandwidth
    type: float?
    default: 50
  - id: midfreq
    type: float?
    default: 50e6
  - id: groupnames
    type: string[]
  - id: filenames
    type: File
  - id: selfcal_region
    type: File?
  - id: selfcal_strategy
    type: string
    default: 'HBA'
alex's avatar
alex committed
outputs:
  - id: msout
    outputSource:
alex's avatar
alex committed
      - calibrate_target/msout
alex's avatar
alex committed
      - selfcal_target/msout
    pickValue: all_non_null
    linkMerge: merge_flattened
    type: Directory[]
  - id: outh5parm
alex's avatar
alex committed
    outputSource:
      - h5parm_collector/outh5parm
    type: File
  - id: outsolutions
    outputSource:
      - selfcal_target/outsolutions
      - insolutions
    pickValue: first_non_null
    type: File
  - id: bad_antennas
alex's avatar
alex committed
    outputSource:
alex's avatar
alex committed
      - identifybadantennas_join/filter_out
alex's avatar
alex committed
    type: string
  - id: outh5parm_logfile
    outputSource:
alex's avatar
alex committed
      - concat_logfiles_losoto/output
    type: File
alex's avatar
alex committed
  - id: Ateam_flags_join_out
    outputSource:
      - Ateam_flags_join/flagged_fraction_antenna
    type: File
alex's avatar
alex committed
  - id: inspection
    outputSource:
      - losoto_plot_P/output_plots
      - losoto_plot_P2/output_plots
      - losoto_plot_Pd/output_plots
      - losoto_plot_Pd2/output_plots
      - losoto_plot_tec/output_plots
alex's avatar
alex committed
      - plot_unflagged/output_imag
      - selfcal_target/inspection
    type: File[]
alex's avatar
alex committed
    linkMerge: merge_flattened
    pickValue: all_non_null
alex's avatar
alex committed
  - id: out_refant
    outputSource:
      - findRefAnt_join/refant
    type: string
alex's avatar
alex committed
  - id: logfiles
    outputSource:
alex's avatar
alex committed
      - concat_logfiles_identify/output
alex's avatar
alex committed
      - concat_logfiles_RefAnt/output
alex's avatar
alex committed
      - concat_logfiles_calib/output
      - concat_logfiles_dp3concat/output
alex's avatar
alex committed
      - concat_logfiles_blsmooth/output
alex's avatar
alex committed
      - concat_logfiles_unflagged/output
      - aoflag/logfile
      - selfcal_target/logfiles
    type: File[]
    linkMerge: merge_flattened
    pickValue: all_non_null
alex's avatar
alex committed
  - id: removed_bands
    outputSource:
      - check_unflagged_fraction/filenames
    type: string[]
alex's avatar
alex committed
steps:
  - id: identifybadantennas
alex's avatar
alex committed
    in:
      - id: msin
alex's avatar
alex committed
        source: msin
alex's avatar
alex committed
    out:
alex's avatar
alex committed
      - id: flaggedants
alex's avatar
alex committed
      - id: logfile
    run: ../../steps/identify_bad_antennas.cwl
    label: identifybadantennas
alex's avatar
alex committed
    scatter:
      - msin
  - id: identifybadantennas_join
    in:
      - id: flaggedants
        source:
          - identifybadantennas/flaggedants
alex's avatar
alex committed
      - id: filter
        source: filter_baselines
    out:
      - id: filter_out
      - id: logfile
    run: ../../steps/identify_bad_antennas_join.cwl
    label: identifybadantennas_join
alex's avatar
alex committed
  - id: findRefAnt_join
    in:
      - id: flagged_fraction_dict
        source:
          - concat/flagged_fraction_dict
      - id: filter_station
        source: refant
    out:
      - id: refant
      - id: logfile
    run: ../../steps/findRefAnt_join.cwl
    label: findRefAnt_join
  - id: Ateam_flags_join
    in:
      - id: flagged_fraction_dict
        source:
          - concat/flagged_fraction_dict
      - id: filter_station
        default: ''
      - id: state
        default: 'concat'
    out:
      - id: flagged_fraction_antenna
    run: ../../steps/findRefAnt_join.cwl
    label: Ateam_flags_join
  - id: concat_logfiles_dp3concat
alex's avatar
alex committed
    in:
      - id: file_list
        source:
          - concat/dp3concat.log
alex's avatar
alex committed
      - id: file_prefix
        default: dp3concat
alex's avatar
alex committed
    out:
      - id: output
    run: ../../steps/concatenate_files.cwl
    label: concat_logfiles_dp3concat
alex's avatar
alex committed
  - id: concat_logfiles_blsmooth
    in:
      - id: file_list
        source:
alex's avatar
alex committed
          - calibrate_target/BLsmooth.log
alex's avatar
alex committed
        pickValue: all_non_null
alex's avatar
alex committed
      - id: file_prefix
        default: blsmooth_target
      - id: execute
        source: selfcal
alex's avatar
alex committed
    out:
      - id: output
    run: ../../steps/concatenate_files.cwl
    label: concat_logfiles_blsmooth
    when: $(!inputs.execute)
  - id: concat_logfiles_calib
alex's avatar
alex committed
    in:
      - id: file_list
        source:
alex's avatar
alex committed
          - calibrate_target/gaincal.log
alex's avatar
alex committed
        pickValue: all_non_null
alex's avatar
alex committed
      - id: file_prefix
        default: gaincal
      - id: execute
        source: selfcal
alex's avatar
alex committed
    out:
      - id: output
    run: ../../steps/concatenate_files.cwl
    label: concat_logfiles_calib
    when: $(!inputs.execute)
alex's avatar
alex committed
  - id: concat_logfiles_losoto
    in:
      - id: file_list
        linkMerge: merge_flattened
        source:
          - h5parm_collector/log
          - losoto_plot_tec/logfile
alex's avatar
alex committed
          - losoto_plot_P/logfile
          - losoto_plot_P2/logfile
          - losoto_plot_Pd/logfile
          - losoto_plot_Pd2/logfile
        pickValue: all_non_null
alex's avatar
alex committed
      - id: file_prefix
        default: losoto_gsmcal
    out:
      - id: output
    run: ../../steps/concatenate_files.cwl
    label: concat_logfiles_losoto
alex's avatar
alex committed
  - id: concat_logfiles_unflagged
    in:
      - id: file_list
        linkMerge: merge_flattened
        source:
          - merge_array_files/output
alex's avatar
alex committed
          - plot_unflagged/logfile
      - id: file_prefix
        default: check_unflagged_fraction
    out:
      - id: output
    run: ../../steps/concatenate_files.cwl
    label: concat_logfiles_unflagged
alex's avatar
alex committed
  - id: concat_logfiles_identify
    in:
      - id: file_list
        linkMerge: merge_flattened
        source:
          - identifybadantennas/logfile
          - identifybadantennas_join/logfile
      - id: file_prefix
        default: identifyBadAntennas
    out:
      - id: output
    run: ../../steps/concatenate_files.cwl
    label: concat_logfiles_identify
alex's avatar
alex committed
  - id: concat_logfiles_RefAnt
    in:
      - id: file_list
        linkMerge: merge_flattened
        source:
          - findRefAnt_join/logfile
      - id: file_prefix
        default: findRefAnt
    out:
      - id: output
    run: ../../steps/concatenate_files.cwl
    label: concat_logfiles_RefAnt
alex's avatar
alex committed
  - id: concat
alex's avatar
alex committed
    in:
      - id: msin
alex's avatar
alex committed
        source: 
          - msin
      - id: group_id
alex's avatar
alex committed
        source: groupnames
      - id: groups_specification
alex's avatar
alex committed
        source: filenames
      - id: filter_baselines
alex's avatar
alex committed
        source: identifybadantennas_join/filter_out
alex's avatar
alex committed
      - id: avg_timeresolution_concat
        source: avg_timeresolution_concat
      - id: avg_freqresolution_concat
        source: avg_freqresolution_concat
alex's avatar
alex committed
      - id: chunkduration
        source: chunkduration
alex's avatar
alex committed
    out:
alex's avatar
alex committed
      - id: flagged_fraction_dict
      - id: dp3concat.log
alex's avatar
alex committed
    run: ./concat.cwl
alex's avatar
alex committed
    label: concat
    scatter:
      - group_id
Frits Sweijen's avatar
Frits Sweijen committed

alex's avatar
alex committed
  - id: merge_array_concat
    in:
      - id: input
        source: concat/msout
    out:
      - id: output
    run: ../../steps/merge_array.cwl
    label: merge_array_concat

  - id: sort_times_into_freqGroups_full
    in:
      - id: msin
        source:
Frits Sweijen's avatar
Frits Sweijen committed
          - merge_array_concat/output
      - id: numbands
        valueFrom: $(-1)
      - id: DP3fill
        default: true
      - id: stepname
        default: .dp3concat
      - id: truncateLastSBs
        default: false
    out:
      - id: filenames
      - id: groupnames
      - id: total_bandwidth
      - id: midfreq
      - id: minfreq
      - id: logfile
    run: ../../steps/sort_times_into_freqGroups.cwl
    label: sorttimesintofreqGroups_full
  
  - id: concat2
    in:
      - id: msin
        source: 
          - merge_array_concat/output
      - id: group_id
        source: sort_times_into_freqGroups_full/groupnames
      - id: groups_specification
        source: sort_times_into_freqGroups_full/filenames
      - id: filter_baselines
        source: identifybadantennas_join/filter_out
      - id: avg_timeresolution_concat
        source: avg_timeresolution_concat
      - id: avg_freqresolution_concat
        source: avg_freqresolution_concat
      - id: chunkduration
        source: chunkduration
      - id: execute
        source: selfcal
      - id: selfcal_strategy
        source: selfcal_strategy
    out:
      - id: msout
      - id: flagged_fraction_dict
      - id: dp3concat.log
    run: ./concat.cwl
    label: concat2
    scatter: group_id
    when: $(inputs.execute && inputs.selfcal_strategy == 'HBA') 
  
Frits Sweijen's avatar
Frits Sweijen committed
  - id: merge_array_concat_full
    in:
      - id: input
        source: concat2/msout
    out:
      - id: output
    run: ../../steps/merge_array.cwl
    label: merge_array_full
Frits Sweijen's avatar
Frits Sweijen committed

  - id: aoflag
Frits Sweijen's avatar
Frits Sweijen committed
      - id: msin
        source: merge_array_concat_full/output
Frits Sweijen's avatar
Frits Sweijen committed
      - id: verbose
        default: true
      - id: concatenate-frequency
        source: aoflag_freqconcat
      - id: strategy
        source: rfistrategy
      - id: reorder
        source: aoflag_reorder
      - id: chunk-size
        source: aoflag_chunksize
Frits Sweijen's avatar
Frits Sweijen committed
      - id: output_ms
      - id: logfile
    run: ../../steps/aoflag.cwl
    label: aoflag
Frits Sweijen's avatar
Frits Sweijen committed
  - id: check_unflagged_fraction
    in:
      - id: msin
        source: aoflag/output_ms
      - id: min_fraction
        source: min_unflagged_fraction
    out:
      - id: msout
      - id: frequency
      - id: unflagged_fraction
      - id: filenames
      - id: logfile
    run: ../../steps/check_unflagged_fraction.cwl
    label: check_unflagged_fraction
    scatter:
      - msin
  - id: merge_array
    in:
      - id: input
        source: check_unflagged_fraction/msout
    out:
      - id: output
    run: ../../steps/merge_array.cwl
    label: merge_array

Frits Sweijen's avatar
Frits Sweijen committed
  - id: merge_array_files
    in:
      - id: input
        source: check_unflagged_fraction/logfile
    out:
      - id: output
    run: ../../steps/merge_array_files.cwl
    label: merge_array_files
Frits Sweijen's avatar
Frits Sweijen committed
  - id: check_filtered_MS_array
    in:
      - id: input
        source: merge_array/output
    out:
      - id: output
    run: ../../steps/check_filtered_MS_array.cwl
    label: check_filtered_MS_array
alex's avatar
alex committed
  - id: calibrate_target
    in:
      - id: max_dp3_threads
        source: max_dp3_threads
alex's avatar
alex committed
      - id: msin
Frits Sweijen's avatar
Frits Sweijen committed
        source: check_filtered_MS_array/output
      - id: skymodel
alex's avatar
alex committed
        source: target_skymodel
      - id: do_smooth
        source: do_smooth
      - id: propagatesolutions
        source: propagatesolutions
alex's avatar
alex committed
      - id: gsmcal_step
        source: gsmcal_step
      - id: execute
        source: selfcal
alex's avatar
alex committed
    out:
      - id: msout
      - id: BLsmooth.log
      - id: gaincal.log
      - id: outh5parm
alex's avatar
alex committed
    run: ./calib_targ.cwl
alex's avatar
alex committed
    label: calibrate_target
    scatter:
alex's avatar
alex committed
      - msin
    when: $(!inputs.execute || inputs.selfcal_strategy == 'HBA')

alex's avatar
alex committed
  - id: selfcal_target
    in:
      - id: max_dp3_threads
        source: max_dp3_threads
      - id: msin
        source: check_filtered_MS_array/output
      - id: skymodel
        source: target_skymodel
      - id: propagatesolutions
        source: propagatesolutions
      - id: do_smooth
        source: do_smooth
      - id: refant
        source: findRefAnt_join/refant
      - id: skymodel_source
        source: skymodel_source
alex's avatar
alex committed
      - id: gsmcal_step
        source: gsmcal_step
      - id: process_baselines_target
        source: process_baselines_target
      - id: bad_antennas
        source: identifybadantennas_join/filter_out
      - id: insolutions
        source: insolutions
alex's avatar
alex committed
      - id: targetname
        source: targetname
      - id: wsclean_tmpdir
        source: wsclean_tmpdir
      - id: total_bandwidth
        source: total_bandwidth
      - id: midfreq
        source: midfreq
      - id: selfcal_region
        source: selfcal_region
      - id: rfistrategy
        source: rfistrategy
      - id: aoflag_reorder
        source: aoflag_reorder
      - id: aoflag_chunksize
        source: aoflag_chunksize
      - id: aoflag_freqconcat
        source: aoflag_freqconcat
alex's avatar
alex committed
      - id: execute
        source: selfcal
    out:
      - id: msout
      - id: logfiles
      - id: inspection
alex's avatar
alex committed
      - id: outh5parm
      - id: outsolutions
alex's avatar
alex committed
    run: ./selfcal_targ.cwl
    label: selfcal_target
    when: $(inputs.execute)
alex's avatar
alex committed
  - id: h5parm_collector
    in:
      - id: h5parmFiles
        source:
alex's avatar
alex committed
          - calibrate_target/outh5parm
alex's avatar
alex committed
          - selfcal_target/outh5parm
        pickValue: all_non_null
        linkMerge: merge_flattened
alex's avatar
alex committed
      - id: squeeze
        default: true
      - id: verbose
        default: true
      - id: clobber
        default: true
      - id: execute
        source: selfcal
alex's avatar
alex committed
    out:
      - id: outh5parm
      - id: log
alex's avatar
alex committed
    run: ../../steps/H5ParmCollector.cwl
alex's avatar
alex committed
    label: H5parm_collector
alex's avatar
alex committed
  - id: plot_unflagged
    in:
      - id: frequencies
        source: check_unflagged_fraction/frequency
alex's avatar
alex committed
      - id: unflagged_fraction
        source: check_unflagged_fraction/unflagged_fraction
alex's avatar
alex committed
    out:
      - id: output_imag
alex's avatar
alex committed
      - id: logfile
alex's avatar
alex committed
    run: ../../steps/plot_unflagged.cwl
    label: plot_unflagged
  - id: losoto_plot_tec
    in:
      - id: input_h5parm
        source: h5parm_collector/outh5parm
      - id: soltab
        default: sol000/tec000
      - id: axesInPlot
        default:
          - time
      - id: axisInTable
        default: ant
      - id: plotFlag
        default: true
      - id: refAnt
        source: refant
      - id: minmax
        default:
          - -0.5
          - 0.5
      - id: prefix
        default: tec_
      - id: execute
        source: selfcal
    out:
      - id: output_plots
      - id: logfile
      - id: parset
    run: ../../steps/LoSoTo.Plot.cwl
    when: $(inputs.execute)
    label: losoto_plot_tec
alex's avatar
alex committed
  - id: losoto_plot_P
    in:
      - id: input_h5parm
        source: h5parm_collector/outh5parm
      - id: soltab
        default: sol000/phase000
      - id: axesInPlot
        default:
          - time
          - freq
      - id: axisInTable
        default: ant
      - id: minmax
        default:
          - -3.14
          - 3.14
      - id: plotFlag
        default: true
      - id: refAnt
alex's avatar
alex committed
        source: findRefAnt_join/refant
alex's avatar
alex committed
      - id: prefix
        default: ph_
      - id: execute
        source: selfcal
        valueFrom: '$(self ? false : true)'
alex's avatar
alex committed
    out:
      - id: output_plots
      - id: logfile
alex's avatar
alex committed
      - id: parset
alex's avatar
alex committed
    run: ../../steps/LoSoTo.Plot.cwl
alex's avatar
alex committed
    label: losoto_plot_P
    when: $(inputs.execute)
alex's avatar
alex committed
  - id: losoto_plot_P2
    in:
      - id: input_h5parm
        source: h5parm_collector/outh5parm
      - id: soltab
        default: sol000/phase000
      - id: axesInPlot
        default:
          - time
      - id: axisInTable
        default: ant
      - id: axisInCol
        default: pol
      - id: minmax
        default:
          - -3.14
          - 3.14
      - id: plotFlag
        default: true
      - id: refAnt
alex's avatar
alex committed
        source: findRefAnt_join/refant
alex's avatar
alex committed
      - id: prefix
        default: ph_
      - id: execute
        source: selfcal
        valueFrom: '$(self ? false : true)'
alex's avatar
alex committed
    out:
      - id: output_plots
      - id: logfile
alex's avatar
alex committed
      - id: parset
alex's avatar
alex committed
    run: ../../steps/LoSoTo.Plot.cwl
alex's avatar
alex committed
    label: losoto_plot_P2
    when: $(inputs.execute)
alex's avatar
alex committed
  - id: losoto_plot_Pd
    in:
      - id: input_h5parm
        source: h5parm_collector/outh5parm
      - id: soltab
        default: sol000/phase000
      - id: axesInPlot
        default:
          - time
          - freq
      - id: axisInTable
        default: ant
      - id: axisDiff
        default: pol
      - id: minmax
        default:
          - -3.14
          - 3.14
      - id: plotFlag
        default: true
      - id: refAnt
alex's avatar
alex committed
        source: findRefAnt_join/refant
alex's avatar
alex committed
      - id: prefix
alex's avatar
alex committed
        default: ph_poldif
      - id: execute
        source: selfcal
        valueFrom: '$(self ? false : true)'
alex's avatar
alex committed
    out:
      - id: output_plots
      - id: logfile
alex's avatar
alex committed
      - id: parset
alex's avatar
alex committed
    run: ../../steps/LoSoTo.Plot.cwl
alex's avatar
alex committed
    label: losoto_plot_Pd
    when: $(inputs.execute)
alex's avatar
alex committed
  - id: losoto_plot_Pd2
    in:
      - id: input_h5parm
        source: h5parm_collector/outh5parm
      - id: soltab
        default: sol000/phase000
      - id: axesInPlot
        default:
          - time
      - id: axisInTable
        default: ant
      - id: axisDiff
        default: pol
      - id: minmax
        default:
          - -3.14
          - 3.14
      - id: plotFlag
        default: true
      - id: refAnt
alex's avatar
alex committed
        source: findRefAnt_join/refant
alex's avatar
alex committed
      - id: prefix
        default: ph_poldif_
      - id: execute
        source: selfcal
        valueFrom: '$(self ? false : true)'
alex's avatar
alex committed
    out:
      - id: output_plots
      - id: logfile
alex's avatar
alex committed
      - id: parset
alex's avatar
alex committed
    run: ../../steps/LoSoTo.Plot.cwl
alex's avatar
alex committed
    label: losoto_plot_Pd2
    when: $(inputs.execute)
alex's avatar
alex committed
requirements:
  - class: SubworkflowFeatureRequirement
  - class: ScatterFeatureRequirement
alex's avatar
alex committed
  - class: MultipleInputFeatureRequirement
alex's avatar
alex committed
  - class: StepInputExpressionRequirement
  - class: InlineJavascriptRequirement