megalut / sewpy

Source Extractor Wrapper for Python
GNU General Public License v3.0
22 stars 11 forks source link

ASSOC helper fails to read SExtractor output #16

Closed kuntzer closed 8 years ago

kuntzer commented 8 years ago

When using Sewpy in the following way:

import astropy.table as T
import sewpy

sew = sewpy.SEW(
    params=["X_IMAGE", "Y_IMAGE", "VECTOR_ASSOC(3)"],
    config={"DETECT_MINAREA":10, "ASSOC_RADIUS":10},
    sexpath="sex"
)

assoc = T.Table.read("sky.list", format='ascii.commented_header')
out = sew("img.fits", assoc_cat=assoc)

I get the following error:

astropy.io.ascii.core.InconsistentTableError: Number of header columns (3) inconsistent with data columns (5) at data line 0
Header values: ['X_IMAGE', 'Y_IMAGE', 'VECTOR_ASSOC']
Data values: ['1653.9392', '587.5404', '1653', '587.2', '1165']

Upon further investigation, it's astropy that is to blame at line 914 of the swpy.py file:

# We read in the SExtractor output:                 
sextable = astropy.table.Table.read(self._get_cat_filepath(imgname), format="ascii.sextractor")

I seem to remember that this wasn't an issue before, but I'm not sure. I'm using astropy version 1.1.2.

I'm investigating.

kuntzer commented 8 years ago

Very strange, the following configuration works:

params=["X_IMAGE", "Y_IMAGE", "FLUX_APER(3)", "VECTOR_ASSOC(3)", "FLAGS"]

It seems that it is purely an Astropy issue. I raised an issue on their GitHub page.

mtewes commented 8 years ago

OK! Indeed we had this before, and at that time just wrote in the doc that VECTOR_ASSOC(3) should not be last. http://sewpy.readthedocs.io/en/latest/manual.html#the-assoc-helper

kuntzer commented 8 years ago

The issue was solved on newer versions of astropy (v1.1.3 and above are fine). I added a note in the docs and closing this issue.