[AstroPy] PyFITS: Appending tables with variable length array...?

Taro Sato taro at ap.smu.ca
Fri May 6 19:05:19 EDT 2011

On Fri, May 6, 2011 at 5:56 PM, Erik Bray <embray at stsci.edu> wrote:
> Here's a workaround that worked for me:
> for idx in range(len(t1[1].columns)):
>     col = t1[1].columns[idx]
>     if col.format[0] == 'P':
>         hdu.columns[idx].array = np.resize(col.array, nr)
>         hdu.data._convert[idx] = hdu.columns[idx].array
>     hdu.data.field(idx)[nr1:] = t2[1].data.field(idx)
> It's a hack, but it should work--this replaces the existing VLA column
> with one that's extended out the right size.  I'll add a bug report for
> this issue.
> Thanks,
> Erik

Thanks very much for your response, Erik.  Unfortunately it doesn't
work for me quite yet...

I see what you are doing, but for some reason the column doesn't
remain a _VLF object after setting _convert.  (Before setting _convert
I confirm it's still a _VLF.)  For me, right after _convert setting it
becomes a flat np.array of int32 and it complains about me trying to
set an array element with a sequence.

Any idea how to work around this?

More information about the AstroPy mailing list