Skip to content

Commit 36da8af

Browse files
authored
Merge pull request #765 from ratt-ru/sofia_update
Updating to the latest sofia
2 parents f738c4a + afbace2 commit 36da8af

3 files changed

Lines changed: 37 additions & 22 deletions

File tree

stimela/cargo/base/sofia2/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN pip install -U setuptools \
88
astro-tigger-lsm
99
RUN git clone https://github.com/SoFiA-Admin/SoFiA-2.git
1010
RUN cd /SoFiA-2 && git fetch && git fetch --tags
11-
RUN cd /SoFiA-2 && git checkout v2.4.0
11+
RUN cd /SoFiA-2 && git checkout v2.5.0
1212
RUN cd /SoFiA-2 && ./compile.sh -fopenmp
1313
RUN cd /SoFiA-2 && ln sofia /usr/bin/sofia
1414

stimela/cargo/cab/sofia2/parameters.json

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"task": "sofia2",
33
"base": "stimela/sofia2",
4-
"tag": "1.7.4",
5-
"version" : "2.4.0",
4+
"tag": "1.7.6",
5+
"version" : "2.5.0",
66
"description": "This is version 2 of the HI Source Finding Application (SoFiA), a source finding pipeline originally designed to detect and characterise galaxies in 3D extragalctic HI data cubes. SoFiA 2 is a reimplementation of the original SoFiA pipeline in the C programming language and provides most of the functionality of SoFiA 1.x",
77
"prefix": "--",
88
"binary": "sofia",
@@ -449,7 +449,13 @@
449449
"dtype": "int",
450450
"default": 1,
451451
"name": "linker.radiusZ",
452-
},
452+
},
453+
{
454+
"info": "If set to true, SoFiA will try to automatically determine the optimal reliability kernel scale factor by iteratively increasing the kernel size until the absolute value of the median of the Skellam distribution decreases below reliability.tolerance. If the algorithm fails to converge after reliability.iterations steps, then the default value of reliability.scaleKernel will be used instead.",
455+
"dtype": "bool",
456+
"default": false,
457+
"name": "reliability.autoKernel",
458+
},
453459
{
454460
"info": "Path to a file containing positions on the sky to be excluded from the reliability analysis. The file must contain two columns separated by a space, tabulator or comma that specify the longitude and latitude of the position to be excluded in the native WCS coordinates and units of the input FITS file. Negative detections that contain any of those positions within their bounding box will be excluded from the reliability analysis, although they will still show up in the reliability plot.",
455461
"dtype": "file",
@@ -469,6 +475,12 @@
469475
"default": false,
470476
"name": "reliability.enable",
471477
},
478+
{
479+
"info": "Maximum number of iterations for the reliability kernel auto-scaling algorithm to converge. If convergence is not achieved, then reliability.scaleKernel will instead be applied.",
480+
"dtype": "int",
481+
"default": 30,
482+
"name": "reliability.iterations",
483+
},
472484
{
473485
"info": "Minimum total number of spatial and spectral pixels within the source mask for detections to be considered reliable. The reliability of any detection with fewer pixels will be set to zero by default.",
474486
"dtype": "int",
@@ -519,7 +531,13 @@
519531
"dtype": "float",
520532
"default": 0.9,
521533
"name": "reliability.threshold",
522-
},
534+
},
535+
{
536+
"info": "Convergence tolerance for the reliability kernel auto-scaling algorithm. Convergence is achieved when the absolute value of the median of the Skellam distribution drops below this tolerance.",
537+
"dtype": "float",
538+
"default": 0.05,
539+
"name": "reliability.tolerance",
540+
},
523541
{
524542
"info": "Set to true to enable source mask dilation whereby the mask of each source will be grown outwards until the resulting increase in integrated flux drops below a given threshold or the maximum number of iterations is reached.",
525543
"dtype": "bool",
@@ -673,3 +691,4 @@
673691
]
674692
}
675693

694+

stimela/cargo/cab/sofia2/src/run.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from astLib.astWCS import WCS
1414
from astropy.io.votable import parse_single_table
1515
from Tigger.Models import SkyModel, ModelClasses
16-
from stimela import utils
1716

1817

1918
CONFIG = os.environ["CONFIG"]
@@ -129,21 +128,6 @@ def tigger_src(src, idx):
129128
table = parse_single_table('{0}_cat.xml'.format(prefix))
130129
data = table.array
131130

132-
#with open('{0}_cat.txt'.format(prefix)) as stdr:
133-
# # Header
134-
# stdr.readline()
135-
# # Column names
136-
# names = stdr.readline().split("#")[9].strip().split()
137-
# print(names)
138-
# # Units
139-
# stdr.readline()
140-
# # Column numbers
141-
# stdr.readline()
142-
# sys.stdout.write(" ".join(names))
143-
# data = numpy.genfromtxt(stdr,
144-
# names=names + ["col"])
145-
# print(data)
146-
147131
for i, src in enumerate(data):
148132
model.sources.append(tigger_src(src, i))
149133

@@ -153,4 +137,16 @@ def tigger_src(src, idx):
153137

154138
model.save(tname_lsm)
155139
# Rename using CORPAT
156-
utils.xrun("tigger-convert", [tname_lsm, "--rename -f"])
140+
_runc = "tigger-convert %s --rename -f" % tname_lsm
141+
try:
142+
subprocess.check_call(shlex.split(_runc))
143+
finally:
144+
for item in junk:
145+
for dest in [OUTPUT, MSDIR]: # these are the only writable volumes in the container
146+
items = glob.glob("{dest}/{item}".format(**locals()))
147+
for f in items:
148+
if os.path.isfile(f):
149+
os.remove(f)
150+
elif os.path.isdir(f):
151+
shutil.rmtree(f)
152+

0 commit comments

Comments
 (0)