Skip to content

Commit 54dc7a7

Browse files
authoredNov 7, 2018
Merge pull request apertif#58 from apertif/casacall
Factor out calls to drivecasa
2 parents 0c872ec + e427237 commit 54dc7a7

File tree

4 files changed

+69
-173
lines changed

4 files changed

+69
-173
lines changed
 

‎apercal/libs/lib.py

+13
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import astropy.io.fits as pyfits
88
import matplotlib.pyplot as plt
99
import numpy as np
10+
import drivecasa
1011

1112
from apercal.subs import setinit as subs_setinit
1213
from apercal.modules import default_cfg
@@ -138,6 +139,18 @@ def exceptioner(O, E):
138139
raise FatalMiriadError(E)
139140

140141

142+
def run_casa(cmd, raise_on_severe=False, timeout=1800):
143+
"""Run a list of casa commands"""
144+
casa = drivecasa.Casapy()
145+
try:
146+
casa_output, casa_error = casa.run_script(cmd, raise_on_severe=True, timeout=timeout)
147+
logger.debug('\n'.join(casa_output))
148+
except RuntimeError:
149+
logger.error("Casa command failed")
150+
if raise_on_severe:
151+
raise
152+
153+
141154
def str2bool(s):
142155
if s.upper() == 'TRUE' or s.upper() == "T" or s.upper() == "Y":
143156
return True

0 commit comments

Comments
 (0)
Failed to load comments.