-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixes #118 headless mode * Bump version
- Loading branch information
Showing
5 changed files
with
103 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Test case for testing headless install (without Timba) | ||
|
||
FROM kernsuite/base:7 | ||
|
||
RUN docker-apt-install python3-all python3-virtualenv python3-pip git | ||
|
||
# other fixed Python-only dependencies | ||
WORKDIR /src | ||
RUN git clone -b v1.5.0 https://github.com/ska-sa/purr.git | ||
RUN git clone -b v1.6.0 https://github.com/ska-sa/owlcat.git | ||
RUN git clone -b v1.4.3 https://github.com/ska-sa/kittens.git | ||
RUN git clone -b v1.6.0 https://github.com/ska-sa/tigger-lsm.git | ||
RUN git clone -b v1.7.1 https://github.com/ska-sa/pyxis.git | ||
|
||
RUN pip3 install ./purr ./owlcat ./kittens ./tigger-lsm | ||
RUN pip3 install -e ./pyxis | ||
|
||
# headless mode install without Timba | ||
WORKDIR /code | ||
ADD . /code/meqtrees-cattery | ||
RUN pip3 install ./meqtrees-cattery | ||
|
||
# check that the headless imports actually work (used by DDF and the likes) | ||
RUN python3 -c "import Cattery" | ||
RUN python3 -c "import Cattery.Siamese.OMS.Utils as Utils" | ||
RUN python3 -c "import Cattery.Siamese as Siamese" | ||
RUN python3 -c "import Cattery.Siamese.OMS.InterpolatedBeams as InterpolatedBeams" | ||
|
||
# basic unit tests | ||
RUN mkdir /test && \ | ||
pip3 install git+https://github.com/ratt-ru/eidos.git@a47fa43 nose && \ | ||
# check eidos install && \ | ||
python3 -c "import eidos" && \ | ||
python3 -m nose -v -s /code/meqtrees-cattery/unittests/ && \ | ||
rm -rf /test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
from nose.tools import * | ||
import numpy as np | ||
import time | ||
from subprocess import Popen | ||
import os | ||
|
||
import Cattery.Siamese.OMS.Utils as Utils | ||
import Cattery.Siamese as Siamese | ||
import Cattery.Siamese.OMS.InterpolatedBeams as InterpolatedBeams | ||
|
||
PREFIX = "/test/test_beam" | ||
PATTERN = PREFIX + "_$(corr)_$(reim).fits" | ||
|
||
def __run(cmdargs, timeout=600): | ||
cmd = " ".join(cmdargs) | ||
print(f"Running {cmd} with timeout {timeout} seconds") | ||
p = Popen(cmdargs, | ||
env=os.environ.copy()) | ||
|
||
x = timeout | ||
delay = 1.0 | ||
timeout = int(x / delay) | ||
while p.poll() is None and timeout > 0: | ||
time.sleep(delay) | ||
timeout -= delay | ||
#timeout reached, kill process if it is still rolling | ||
ret = p.poll() | ||
if ret is None: | ||
p.kill() | ||
ret = 99 | ||
|
||
if ret == 99: | ||
raise RuntimeError("Test timeout reached. Killed process.") | ||
elif ret != 0: | ||
raise RuntimeError("{} exited with non-zero return code {}".format(cmdargs[0], ret)) | ||
|
||
REALIMAG = dict(re="real",im="imag") | ||
|
||
def __make_beam_filename (filename_pattern,corr,reim,stationtype): | ||
"""Makes beam filename for the given correlation and real/imaginary component (one of "re" or "im")""" | ||
return Utils.substitute_pattern(filename_pattern, | ||
corr=corr.lower(),xy=corr.lower(),CORR=corr.upper(),XY=corr.upper(), | ||
reim=reim.lower(),REIM=reim.upper(),ReIm=reim.title(), | ||
realimag=REALIMAG[reim].lower(),REALIMAG=REALIMAG[reim].upper(), | ||
RealImag=REALIMAG[reim].title(), | ||
stype=stationtype.lower(), STYPE=stationtype.upper()) | ||
|
||
def testinterpolatedbeam(): | ||
print("creating beams...") | ||
eidosargs = (f"eidos -d 0.5 -r 0.015625 -f 950 1050 20 -P {PREFIX} -o8").split(" ") | ||
__run(eidosargs, timeout=900) | ||
filenames = __make_beam_filename(PATTERN, "xy", "re", "default"), \ | ||
__make_beam_filename(PATTERN, "xy", "im", "default") | ||
print("loading beam patterns %s %s" % filenames) | ||
vb = InterpolatedBeams.LMVoltageBeam( | ||
verbose=10000, | ||
l_axis="px", | ||
m_axis="py" | ||
) | ||
vb.read(*filenames) | ||
print("successfully loaded beam patterns %s %s" % filenames) | ||
# approx small angle approximation | ||
vel = vb.interpolate(np.deg2rad(0.05),np.deg2rad(0.05),freq=1000e6,freqaxis=1) | ||
assert np.isclose(vel, np.array([-0.00091718+0.00020009j])), \ | ||
"Last known good value from Eidos beams interpolated value does not " \ | ||
"match current interpolated value" |