Skip to content

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.

image.png

%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
Table masked=True length=1
intentTypeobs_collectionprovenance_nameinstrument_nameprojectfilterswavelength_regiontarget_nametarget_classificationobs_ids_ras_decdataproduct_typeproposal_picalib_levelt_mint_maxt_exptimeem_minem_maxobs_titlet_obs_releaseproposal_idproposal_typesequence_numbers_regionjpegURLdataURLdataRightsmtFlagsrcDenobsidobjIDobjID1distance
str7str4str4str10str4str4str7str8str1str25float64float64str5str17int64float64float64float64float64float64str1float64str3str1int64str117str1str1str6boolfloat64str8str9str9float64
scienceHLSPTICAPhotometerTESSTESSOpticalTICA FFI--hlsp_tica_s0027-cam1-ccd4292.5180823224232-33.62274382166828imageMichael Fausnaugh359035.7780763651259060.13917620387475.2600.01000.0--59246.0N/A--27POLYGON 298.489297 -26.919235 301.396094 -38.579035 285.694884 -40.219585 285.275975 -28.732615 298.489297 -26.919235----PUBLICFalsenan968147661856362581856362580.0
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
Table masked=True length=1
rows
1
columns
35
indexes
rows
0
columns
1
intentTypeobs_collectionprovenance_nameinstrument_nameprojectfilterswavelength_regiontarget_nametarget_classificationobs_idhiddens_regionjpegURLdataURLdataRightsmtFlagsrcDenobsidobjIDobjID1distance
scienceHLSPTICAPhotometerTESSTESSOpticalTICA FFInanhlsp_tica_s0027-cam1-ccd4hiddenPOLYGON 298.489297 -26.919235 301.396094 -38.579035 285.694884 -40.219585 285.275975 -28.732615 298.489297 -26.919235nannanPUBLICFalsenan968147661856362581856362580.0