atpy/atpy — Issue #39: Bug in appending a single row table
Author: mrkite92
Created: 2012-02-01 20:19:52+00:00
State: open

Dear ATpy gurus,

I have the following code :

if First:
Objects = ObjectsOfTarget
First = False
else:
print ObjectsOfTarget[:]
Objects.append(ObjectsOfTarget)
print Objects[:]

yielding the following trace :

[ ('1.3808.302', 0.56, 'lm0100k6761', 76.01204, -69.09616, 17.425, 0.07, 982.58, 1383.36, 17.941, 0.059, 926.33, 1424.94, 1)
('1.3808.302', 2.97, 'lm0100k28860', 76.01374, -69.09571, 21.175, 1.438, 977.4, 1387.22, 21.24, 0.855, 921.15, 1428.8, 0)
('1.3808.302', 3.21, 'lm0100k6733', 76.0092, -69.09595, 16.574, 0.028, 991.27, 1385.18, 17.2, 0.028, 935.01, 1426.77, 0)]
Above : the print of Objects[:] after the if-else block when First is True
[ ('1.3927.799', 1.85, 'lm0100l6050', 76.24729, -69.24345, 17.272, 0.084, 264.28, 1442.97, 17.657, 0.059, 210.75, 1485.4, 1)
('1.3927.799', 4.36, 'lm0100l165', 76.24679, -69.24264, 18.18, 0.156, 265.78, 1449.86, 19.033, 0.16, 212.23, 1492.28, 0)]
Above : the print of ObjectsOfTarget[:] inside the else when First becomes False
[ ('1.3808.302', 0.56, 'lm0100k6761', 76.01204, -69.09616, 17.425, 0.07, 982.58, 1383.36, 17.941, 0.059, 926.33, 1424.94, 1)
('1.3808.302', 2.97, 'lm0100k28860', 76.01374, -69.09571, 21.175, 1.438, 977.4, 1387.22, 21.24, 0.855, 921.15, 1428.8, 0)
('1.3808.302', 3.21, 'lm0100k6733', 76.0092, -69.09595, 16.574, 0.028, 991.27, 1385.18, 17.2, 0.028, 935.01, 1426.77, 0)
('1.3927.799', 1.85, 'lm0100l6050', 76.24729, -69.24345, 17.272, 0.084, 264.28, 1442.97, 17.657, 0.059, 210.75, 1485.4, 1)
('1.3927.799', 4.36, 'lm0100l165', 76.24679, -69.24264, 18.18, 0.156, 265.78, 1449.86, 19.033, 0.16, 212.23, 1492.28, 0)]
Above : the print of Objects[:] after the if-else block where the current ObjectsOfTarget[:] is appended
[ ('1.3929.11', 0.44, 'lm0100k7580', 76.22948, -69.10131, 13.192, 0.097, 318.48, 1336.87, 14.832, 0.197, 262.66, 1377.85, 1)]
Above : the print of the next and single row ObjectsOfTarget[:] inside the else

Traceback (most recent call last):

File "/Users/marquett/workspace/EROSUtils/src/FindInEROS.py", line 60, in
Objects.append(ObjectsOfTarget)
File "/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/atpy/basetable.py", line 309, in append
raise Exception("Columns do not match")
Exception: Columns do not match

Everything is thus fine until the third iteration, when the table to append has a single row, see explanations above. I don't see any mismatch in the columns as claimed.

Thanks for your help,
Cheers
Jean-Baptiste