Skip to content
Snippets Groups Projects
Commit b6ad0a42 authored by David Rafferty's avatar David Rafferty
Browse files

Merge branch 'fix_concat' into 'master'

Fix bug in concat when order of spectral index differs

See merge request !35
parents 2dd4210b 03b071f9
No related branches found
No related tags found
1 merge request!35Fix bug in concat when order of spectral index differs
Pipeline #31542 failed
......@@ -29,6 +29,7 @@ import numpy.ma as ma
import re
import logging
import os
from copy import deepcopy
# Python 3 compatibility
try:
......@@ -401,7 +402,9 @@ def processFormatString(formatString):
colDefaults[i] = defaultVal
metaDict[colNames[i]] = defaultVal
elif allowedColumnDefaults[colName] is not None:
colDefaults[i] = allowedColumnDefaults[colName]
# Note: we used deepcopy() here to ensure that the original
# is not altered by later changes to colDefaults
colDefaults[i] = deepcopy(allowedColumnDefaults)[colName]
# Check for required columns
for reqCol in requiredColumnNames:
......@@ -1124,7 +1127,9 @@ def convertExternalTable(table, columnMapping, fluxUnits='mJy'):
table.columns[colName].unit = allowedColumnUnits[colName.lower()]
if hasattr(table.columns[colName], 'filled') and allowedColumnDefaults[colName.lower()] is not None:
fillVal = allowedColumnDefaults[colName.lower()]
# Note: we used deepcopy() here to ensure that the original
# is not altered by later changes to fillVal
fillVal = deepcopy(allowedColumnDefaults)[colName.lower()]
if colName == 'SpectralIndex':
while len(fillVal) < 1:
fillVal.append(0.0)
......@@ -1280,4 +1285,3 @@ registry.register_writer('ds9', Table, ds9RegionWriter)
registry.register_writer('kvis', Table, kvisAnnWriter)
registry.register_writer('casa', Table, casaRegionWriter)
registry.register_writer('factor', Table, factorDirectionsWriter)
FORMAT = Name, Type, Ra, Dec, I, Q, U, V, ReferenceFrequency='60e6', SpectralIndex='[0.0]', MajorAxis, MinorAxis, Orientation
# the next lines define the sources
1553.9+5220, POINT, 15:53:56.76000000, +52.20.49.41600000, 2.5599, , , , , [-0.2648]
1555.2+5517, POINT, 15:55:12.73920000, +55.17.12.30000000, 0.7088, , , , , [-0.3858]
1556.2+5348, POINT, 15:56:15.38880000, +53.48.11.30400000, 0.7697, , , , , [-0.4379]
1556.4+5539, POINT, 15:56:26.76960000, +55.39.01.80000000, 0.9, , , , , [-0.7]
1556.7+5705, POINT, 15:56:42.78000000, +57.05.39.01200000, 1.1941, , , , , [-0.3247]
1556.7+5558, POINT, 15:56:45.23040000, +55.58.31.11600000, 0.9446, , , , , [-0.0414]
......@@ -38,6 +38,13 @@ def test_concatenate():
assert len(s) == 2165
def test_concatenate_differing_spectral_index():
print('Concatenate with single_spectralindx.sky')
s4 = lsmtool.load('tests/no_patches.sky')
s4.concatenate('tests/single_spectralindx.sky', matchBy = 'position', radius = '30 arcsec', keep = 'from2')
assert len(s) == 2165
def test_compare():
print('Compare to concat.sky')
if os.path.exists('tests/flux_ratio_vs_distance.sky'):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment