astropy tables as semantic tablesยค
astropy tables carry a lot of information. the default representation violates html standards. we reuse our accessible table repr on the pandas version of the table. with this installed, astropy tables are accessible.
%matplotlib inline
import astropy
from astropy.coordinates import SkyCoord
from astroquery.mast import Observations
from nbconvert_a11y.tables import *
from nbconvert_a11y.outputs import BeautifulSoup
%reload_ext nbconvert_a11y.outputs
Below are the helper functions we will call for plotting purposes later in the notebook.
# We will pass in the coordinates as a Sky Coord object
coordinates = SkyCoord(289.0979, -29.3370, unit="deg")
obs = Observations.query_criteria(coordinates=coordinates,
target_name='TICA FFI',
dataproduct_type='image',
sequence_number=27)
obs
import astropy.table
from nbconvert_a11y.outputs import BeautifulSoup
from nbconvert_a11y.tables import repr_semantic, get_table, SHOW_INDEX, repr_semantic_update
@repr_semantic.register(astropy.table.Table)
def repr_astropy_table(table, *args, **kwargs):
return get_table(obs.to_pandas(), BeautifulSoup(obs._base_repr_(True)).i.text, type_=type(table), ROW_INDEX=SHOW_INDEX.hide)
repr_semantic_update()
obs