Skip to content
Snippets Groups Projects
Select Git revision
  • ea6b51b1f3f57ac0446e764f6c8338905f1d3d0f
  • master default protected
  • fix-chrony-exporter
  • L2SS-2407-swap-iers-caltable-monitoring-port
  • L2SS-2357-fix-ruff
  • sync-up-with-meta-pypcc
  • stabilise-landing-page
  • all-stations-lofar2
  • v0.39.7-backports
  • Move-sdptr-to-v1.5.0
  • fix-build-ubuntu
  • tokens-in-env-files
  • fix-build
  • L2SS-2214-deploy-cdb
  • fix-missing-init
  • add-power-hardware-apply
  • L2SS-2129-Add-Subrack-Routine
  • Also-listen-internal-to-rpc
  • fix-build-dind
  • L2SS-2153--Improve-Error-Handling
  • L2SS-2153-Add-Grpc-Gateway-support
  • v0.55.5 protected
  • v0.55.4 protected
  • 0.55.2.dev0
  • 0.55.1.dev0
  • 0.55.0.dev0
  • v0.54.0 protected
  • 0.53.2.dev0
  • 0.53.1.dev0
  • v0.52.3-r2 protected
  • remove-snmp-client
  • v0.52.3 protected
  • v0.52.3dev0 protected
  • 0.53.1dev0
  • v0.52.2-rc3 protected
  • v0.52.2-rc2 protected
  • v0.52.2-rc1 protected
  • v0.52.1.1 protected
  • v0.52.1 protected
  • v0.52.1-rc1 protected
  • v0.51.9-6 protected
41 results

README.md

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    find_skymodel_cal.cwl 2.83 KiB
    class: CommandLineTool
    cwlVersion: v1.1
    $namespaces:
      sbg: 'https://www.sevenbridges.com/'
    id: find_skymodel_cal_py
    baseCommand:
      - python3
    inputs:
        - id: msin
          type: 
           - Directory
           - Directory[]
          doc: MS containing the calibrator
          inputBinding:
            position: 0
        - id: skymodels
          type:
            - Directory?
            - File?
          doc: Directory or file containing the sky models
        - id: skymodels_extension
          type: string?
          doc: path extension of the sky models
        - id: max_separation_arcmin
          type: float?
          doc: max separation in arc minutes
    
    label: find_skymodel_cal.py
    arguments:
      - find_sky.py
    outputs:
      - id: output_models
        type: File
        outputBinding:
            loadContents: true
            glob: 'out.json'
            outputEval: $(JSON.parse(self[0].contents).file)
    
      - id: model_name
        type: string
        outputBinding:
            loadContents: true
            glob: 'out.json'
            outputEval: $(JSON.parse(self[0].contents).skymodel_name)
      - id: logfile
        type: File
        outputBinding:
          glob: find_skymodel_cal.log    
            
    requirements:
      - class: InlineJavascriptRequirement
      - class: InitialWorkDirRequirement
        listing:
          - entryname: 'find_sky.py'
            entry: |
                import sys
                import os
                import shutil
                null = None
                
                from unittest.mock import MagicMock
                sys.modules['lofarpipe.support.data_map'] = MagicMock()
                
                
                from find_skymodel_cal import main as find_skymodel
                import json
                mss = sys.argv[1:]
                
                skymodels = $(inputs.skymodels)
                max_separation_arcmin = $(inputs.max_separation_arcmin)
                max_separation_arcmin = 1.0 if max_separation_arcmin is None else max_separation_arcmin
                extension = "$(inputs.skymodels_extension)"
                if skymodels is None:
                    skymodels = os.path.expandvars("$PREFACTOR_DATA_ROOT/skymodels")
                else:
                    skymodels = skymodels["path"]
                output = {}
                if extension != 'null':
                    output = find_skymodel(mss, skymodels, extension, max_separation_arcmin=max_separation_arcmin)
                else:
                    output = find_skymodel(mss, skymodels, max_separation_arcmin=max_separation_arcmin)
                
                skymodel_path = output['SkymodelCal']
                skymodel_name = output['SkymodelName']
                skymodel_path = shutil.copy(skymodel_path, os.getcwd())
                cwl_output = {"file":{'class': 'File', 'path': skymodel_path},
                              "skymodel_name": skymodel_name}
                
                with open('./out.json', 'w') as fp:
                    json.dump(cwl_output, fp)
    
    
    hints:
      DockerRequirement:
        dockerPull: lofareosc/prefactor3-cwl
    stdout: find_skymodel_cal.log