Skip to main content

ReadMe generator package (cdspyreadme)

Project description

ReadMe Generator Python library

The cdspyreadme library is a Python package dedicated for authors who want to submit data in VizieR or AAS.

The package builts ReadMe, standardized tables (in ASCII aligned format) or MRT tables from tables which can be in different formats (CSV, votable, FITS, astropy table, MRT)

by G.Landais (CDS) 24 june 2016


The cdspyreadme library works with Python3 and requires :

  • astropy
  • numpy

Notes: for large tables, we recommend to use the C- anafile package

Anafile download: Anafile documentation:


python3 install --user


import cdspyreadme

tablemaker = cdspyreadme.CDSTablesMaker()

# add a table
table = tablemaker.addTable("table.csv", description="my CSV table")
# write table in CDS-ASCII aligned format (required)

# Customize ReadMe output
tablemaker.title = "catalogue title" = 'G.Landais' = 2020
tablemaker.abstract = "This is my abstract..."
tablemaker.putRef("II/246", "2mass catalogue")
tablemaker.putRef("http://...", "external link")

# Print ReadMe

# Save ReadMe into a file
with open("ReadMe", "w") as fd:

add astropy table

from astropy.table import Table
import cdspyreadme

astropy_table = Table([(1.4845, 1.4835, -1.234),
               (24.5,  18.2401, 23.426),
               ('HD100', 'HD101', None)],
              names=['ra', 'dec','name'])
tablemaker = cdspyreadme.CDSTablesMaker()
tablemaker.addTable(astropy_table, name="table1")

# add an other local table (in VOTable) 
table2 ="table.vot")
tablemaker.addTable(table2, name="table2")


use astropy Masked Column to remove values according criteria

from astropy.table import Table, MaskedColumn
import cdspyreadme

tablemaker = cdspyreadme.CDSTablesMaker()
csv ="table.csv")
csv.columns[0] = MaskedColumn(csv.columns[0], mask=[(val>10) for val in csv.columns[0]])
tablemaker.addTable(csv, name="data.cds")


Sexagesimal columns

Flag sexagesimal columns in ReadMe.

The method transforms string columns (ie: ra_sexa, de_sexa) in columns RAh, Ram, RAs, DEsign, DEd, DEm, DEs.

from astropy.table import Table
import cdspyreadme

tablemaker = cdspyreadme.CDSTablesMaker()
csv ="table.csv")
table = tablemaker.addTable(csv, name="data.cds")
ra = table.get_column("ra_sexa")
de = table.get_column("dec_sexa")


add ASCII aligned table

from astropy.table import Table
import cdspyreadme

tablemaker = cdspyreadme.CDSTablesMaker()
ascii = cdspyreadme.CDSAsciiTable("table.ascii", "table1", description="ascii table")
table = tablemaker.addTable(ascii)


MRT example

The following example builds MRT table from a CSV table

from astropy.table import Table
import cdspyreadme

tablemaker = cdspyreadme.CDSTablesMaker()
tablemaker.title = "catalogue title" = 'G.Landais'

csv ="table.csv")
# rename columns
colra = csv["ra"] = "RAdeg"
colra.description="Right ascension"
table = tablemaker.addTable(ascii, name='table.mrt', description='csv file')

update column


table = tablemaker.addTable(...)
column = table.get_column("ra")

# modify format

# modify name and description"raj2000"
column.description="right ascension in ICRS"


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for cdspyreadme, version 1.3.4
Filename, size File type Python version Upload date Hashes
Filename, size cdspyreadme-1.3.4-py3-none-any.whl (17.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size cdspyreadme-1.3.4.tar.gz (16.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page