[Python] How to save an Astropy QTable with a galactocentric skycoord to a FITS file?

Discussão em 'Python' iniciado por Stack, Agosto 14, 2025.

  1. Stack

    Stack Membro Participativo

    Creating a SkyCoord object:

    c_end = SkyCoord(
    x=xf,
    y=yf,
    z=zf,
    v_x=vxf,
    v_y=vyf,
    v_z=vzf,
    frame='galactocentric'
    )


    and attempting to put this into an Astropy QTable with other parameters:

    tab = QTable([c_end, ...], names = ['skycoord', ...])

    tab.write('name.fits', format = 'fits')


    Yet I'm getting this error:


    yaml.representer.RepresenterError: ('cannot represent an object', <ICRS Coordinate: (ra, dec) in deg
    (266.4051, -28.936175)>)


    which is suspicious as these are the exact coordinates of the galactic centre in the icrs frame. Any thoughts how to overcome this?

    I've previously done something similar but with a SkyCoord in the ICRS frame, which worked without issue.

    I tried converting to ICRS and saving that but it gives the same error.

    Continue reading...

Compartilhe esta Página