From 03b071f9711efb88b86d6e05bd09f47b2f478107 Mon Sep 17 00:00:00 2001
From: David Rafferty <drafferty@hs.uni-hamburg.de>
Date: Wed, 8 Jun 2022 15:32:06 +0200
Subject: [PATCH] Add test for concatenation when order of spectral index
 differs

---
 tests/single_spectralindx.sky | 9 +++++++++
 tests/test_lsmtool.py         | 7 +++++++
 2 files changed, 16 insertions(+)
 create mode 100644 tests/single_spectralindx.sky

diff --git a/tests/single_spectralindx.sky b/tests/single_spectralindx.sky
new file mode 100644
index 0000000..9a5c632
--- /dev/null
+++ b/tests/single_spectralindx.sky
@@ -0,0 +1,9 @@
+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]
diff --git a/tests/test_lsmtool.py b/tests/test_lsmtool.py
index 7776719..7d7fa1f 100644
--- a/tests/test_lsmtool.py
+++ b/tests/test_lsmtool.py
@@ -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'):
-- 
GitLab