Skip to content
Snippets Groups Projects
Commit 976f1160 authored by Klaas Kliffen's avatar Klaas Kliffen :satellite:
Browse files

Remove old files

parent 26d53148
No related branches found
No related tags found
1 merge request!1Add fixing issues scripts
......@@ -14,13 +14,10 @@ This is a CWL workflow used to compress Lofar imaging data.
## Docker images
- astronsdc/lofar-legacy
- imaging-compress-pipeline-identify-issues `# build by this repo`
## Running the workflow
```bash
# Build the docker images
./build_images.sh
# Run the workflow
cwltool compress_pipeline.cwl [--flag_autocorrelation] --msin MEASUREMENT_SET
```
#!/usr/bin/bash
docker build -t imaging-compress-pipeline-identify-issues -f docker/Dockerfile.identify_issues scripts/
\ No newline at end of file
class: Workflow
cwlVersion: v1.2
inputs:
msin: Directory
outputs: []
steps:
identify_issues:
run: steps/identify_issues.cwl
in:
msin: msin
out:
- issue_list
fix_a:
run: steps/dummy_fix_a.cwl
when: $( inputs.list.includes("FIX_ANTENNA_TABLE") )
in:
list: identify_issues/issue_list
out: []
fix_b:
run: steps/dummy_fix_b.cwl
when: $( inputs.list.includes("FIX_WEIGHT_SPECTRUM") )
in:
list: identify_issues/issue_list
out: []
fix_c:
run: steps/dummy_fix_a.cwl
when: $( inputs.list.includes("FIX_BROKEN_TILES") )
in:
list: identify_issues/issue_list
out: []
fix_d:
run: steps/dummy_fix_b.cwl
when: $( inputs.list.includes("FIX_STATION_ADDER") )
in:
list: identify_issues/issue_list
out: []
requirements:
InlineJavascriptRequirement: {}
import json
from argparse import ArgumentParser
from datetime import datetime
from datetime import timezone as tz
from astropy.time import Time
from casacore.tables import table as MSTable
_DAY_IN_SECONDS = 24 * 60 * 60
_TIME_RANGES= {
'FIX_ANTENNA_TABLE': (
datetime(year=2013, month=2, day=13),
datetime(year=2014, month=2, day=10)),
'FIX_WEIGHT_SPECTRUM': (
datetime(year=2014, month=3, day=19),
datetime(year=2014, month=10, day=31)),
'FIX_BROKEN_TILES': (
datetime(year=2015, month=1, day=26),
datetime(year=2015, month=2, day=25)),
'FIX_STATION_ADDER': (
datetime(year=1999, month=1, day=26),
datetime(year=2015, month=7, day=28)),
}
def parse_args():
parser = ArgumentParser(description='Fix common LOFAR observing issues')
parser.add_argument('msin', help='Measurement Set input')
return parser.parse_args()
def date_to_fix_string(obs_date):
fixes = []
for fix_string, (start_date, end_date) in _TIME_RANGES.items():
if obs_date > start_date and obs_date < end_date:
fixes.append(fix_string)
return json.dumps(fixes) # dump proper json for CWL
def check_observing_date(msin):
observation_table = MSTable(f'{msin}/OBSERVATION', ack=False)
start_mjd, end_mjd = observation_table.getcell('TIME_RANGE', 0)
start_datetime, end_datetime = map(mjd_to_local, (start_mjd, end_mjd))
return start_datetime, end_datetime
def mjd_to_local(mjd):
return Time(mjd / _DAY_IN_SECONDS, format='mjd').to_datetime()
def main():
args = parse_args()
start_datetime_obs, _ = check_observing_date(args.msin)
print(date_to_fix_string(start_datetime_obs))
if __name__ == '__main__':
main()
astropy
python-casacore
\ No newline at end of file
id: dummy_fix_a
label: Dummy Fix A
cwlVersion: v1.0
class: CommandLineTool
baseCommand: echo
arguments:
- "A"
inputs: []
outputs: []
id: dummy_fix_b
label: Dummy Fix B
cwlVersion: v1.0
class: CommandLineTool
baseCommand: echo
arguments:
- "B"
inputs: []
outputs: []
class: ExpressionTool
id: noop
cwlVersion: v1.2
inputs:
- id: msin
type: Directory
outputs:
- id: msout
type: Directory
expression: |
$({msout: inputs.msin})
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment