Extract objects from a Gaia DR2 table.

def standardize_table(cls, table):
        '''
        Extract objects from a Gaia DR2 table.
        '''

        print(cls)
        identifiers = {n+'-id':table[n] for n in cls.identifier_keys}

        # create skycoord objects
        N = len(table)
        coordinates = dict(  ra=table['_RAJ2000'].data.data*u.deg,
                             dec=table['_DEJ2000'].data.data*u.deg,
                             pm_ra_cosdec=table['pmRA'].data.data*u.arcsec/u.year,
                             pm_dec=table['pmDE'].data.data*u.arcsec/u.year,
                             radial_velocity=np.nan*np.ones(N)*u.km/u.s,
                             distance=np.nan*np.ones(N)*u.pc,#distance=1000*u.pc/table['parallax'].data, # weirdly, messed with RA + Dec signs if parallax is zero
                             obstime=cls.epoch*np.ones(N)*u.year)#Time(, format='decimalyear'))
        for k in coordinates:
            print(k, coordinates[k])
        magnitudes = {f+'-mag':table[f+'mag'].data for f in cls.filters}

        standardized = hstack([Table(identifiers),
                               Table(coordinates),
                               Table(magnitudes)])
        standardized.meta['catalog'] = 'Gaia'

        return standardized