cdspyreadme


Namecdspyreadme JSON
Version 1.3.4 PyPI version JSON
download
home_pagehttps://github.com/cds-astro/cds.pyreadme
SummaryReadMe generator package (cdspyreadme)
upload_time2021-06-11 08:41:17
maintainer
docs_urlNone
authorGilles Landais (CDS)
requires_python>=3.6
license
keywords astronomy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# 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

## Requirements
The cdspyreadme library works with Python3 and requires :
- astropy
- numpy

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

Anafile download: http://cdsarc.unistra.fr/ftp/sw/anafile.tar.gz
Anafile documentation: http://cdsarc.unistra.fr/doc/anafile.htx

## Install
python3 setup.py install --user

## Examples
```python
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)
tablemaker.writeCDSTables()

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

# Print ReadMe
tablemaker.makeReadMe()

# Save ReadMe into a file
with open("ReadMe", "w") as fd:
    tablemaker.makeReadMe(out=fd)
```

#### add astropy table
```python
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.read("table.vot")
tablemaker.addTable(table2, name="table2")

tablemaker.writeCDSTables()
tablemaker.makeReadMe()
```

### use astropy Masked Column to remove values according criteria
```python
from astropy.table import Table, MaskedColumn
import cdspyreadme

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

tablemaker.writeCDSTables()
tablemaker.makeReadMe()
```

### 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.

```python
from astropy.table import Table
import cdspyreadme

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

tablemaker.writeCDSTables()
tablemaker.makeReadMe()
```

### add ASCII aligned table
```python
from astropy.table import Table
import cdspyreadme

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

tablemaker.writeCDSTables()
tablemaker.makeReadMe()
```

## MRT example
The following example builds MRT table from a CSV table 

```python
from astropy.table import Table
import cdspyreadme

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

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

### update column
...
```python
table = tablemaker.addTable(...)
column = table.get_column("ra")

# modify format
column.set_format("F10.6")

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

tablemaker.writeCDSTables()
tablemaker.makeReadMe()
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cds-astro/cds.pyreadme",
    "name": "cdspyreadme",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "astronomy",
    "author": "Gilles Landais (CDS)",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/9a/4f/1be8315c5bfdcd6f97ea0d20ddafc5f5d8a466336dedde2c6936f8dea315/cdspyreadme-1.3.4.tar.gz",
    "platform": "",
    "description": "\n# ReadMe Generator Python library  \n\nThe cdspyreadme library is a Python package dedicated for authors who want to submit data in VizieR or AAS.\n\nThe package builts ReadMe, standardized tables (in ASCII aligned format) or MRT tables from tables which\ncan be in different formats (CSV, votable, FITS, astropy table, MRT)\n\nby G.Landais (CDS) 24 june 2016\n\n## Requirements\nThe cdspyreadme library works with Python3 and requires :\n- astropy\n- numpy\n\n**Notes**: for large tables, we recommend to use the C- anafile package \n\nAnafile download: http://cdsarc.unistra.fr/ftp/sw/anafile.tar.gz\nAnafile documentation: http://cdsarc.unistra.fr/doc/anafile.htx\n\n## Install\npython3 setup.py install --user\n\n## Examples\n```python\nimport cdspyreadme\n\ntablemaker = cdspyreadme.CDSTablesMaker()\n\n# add a table\ntable = tablemaker.addTable(\"table.csv\", description=\"my CSV table\")\n# write table in CDS-ASCII aligned format (required)\ntablemaker.writeCDSTables()\n\n# Customize ReadMe output\ntablemaker.title = \"catalogue title\"\ntablemaker.author = 'G.Landais'\ntablemaker.date = 2020\ntablemaker.abstract = \"This is my abstract...\"\ntablemaker.putRef(\"II/246\", \"2mass catalogue\")\ntablemaker.putRef(\"http://...\", \"external link\")\n\n# Print ReadMe\ntablemaker.makeReadMe()\n\n# Save ReadMe into a file\nwith open(\"ReadMe\", \"w\") as fd:\n    tablemaker.makeReadMe(out=fd)\n```\n\n#### add astropy table\n```python\nfrom astropy.table import Table\nimport cdspyreadme\n\nastropy_table = Table([(1.4845, 1.4835, -1.234),\n               (24.5,  18.2401, 23.426),\n               ('HD100', 'HD101', None)],\n              names=['ra', 'dec','name'])\ntablemaker = cdspyreadme.CDSTablesMaker()\ntablemaker.addTable(astropy_table, name=\"table1\")\n\n# add an other local table (in VOTable) \ntable2 = Table.read(\"table.vot\")\ntablemaker.addTable(table2, name=\"table2\")\n\ntablemaker.writeCDSTables()\ntablemaker.makeReadMe()\n```\n\n### use astropy Masked Column to remove values according criteria\n```python\nfrom astropy.table import Table, MaskedColumn\nimport cdspyreadme\n\ntablemaker = cdspyreadme.CDSTablesMaker()\ncsv = Table.read(\"table.csv\")\ncsv.columns[0] = MaskedColumn(csv.columns[0], mask=[(val>10) for val in csv.columns[0]])\ntablemaker.addTable(csv, name=\"data.cds\")\n\ntablemaker.writeCDSTables()\ntablemaker.makeReadMe()\n```\n\n### Sexagesimal columns\nFlag sexagesimal columns in ReadMe.\n\nThe method transforms string columns (ie: ra_sexa, de_sexa) in columns RAh, Ram, RAs, DEsign, DEd, DEm, DEs.\n\n```python\nfrom astropy.table import Table\nimport cdspyreadme\n\ntablemaker = cdspyreadme.CDSTablesMaker()\ncsv = Table.read(\"table.csv\")\ntable = tablemaker.addTable(csv, name=\"data.cds\")\nra = table.get_column(\"ra_sexa\")\nra.setSexaRa()\nde = table.get_column(\"dec_sexa\")\nde.setSexaDe()\n\ntablemaker.writeCDSTables()\ntablemaker.makeReadMe()\n```\n\n### add ASCII aligned table\n```python\nfrom astropy.table import Table\nimport cdspyreadme\n\ntablemaker = cdspyreadme.CDSTablesMaker()\nascii = cdspyreadme.CDSAsciiTable(\"table.ascii\", \"table1\", description=\"ascii table\")\ntable = tablemaker.addTable(ascii)\n\ntablemaker.writeCDSTables()\ntablemaker.makeReadMe()\n```\n\n## MRT example\nThe following example builds MRT table from a CSV table \n\n```python\nfrom astropy.table import Table\nimport cdspyreadme\n\ntablemaker = cdspyreadme.CDSTablesMaker()\ntablemaker.title = \"catalogue title\"\ntablemaker.author = 'G.Landais'\n\ncsv = Table.read(\"table.csv\")\n# rename columns\ncolra = csv[\"ra\"]\ncolra.name = \"RAdeg\"\ncolra.description=\"Right ascension\"\ncolra.unit='deg'\n...\ntable = tablemaker.addTable(ascii, name='table.mrt', description='csv file')\ntablemaker.toMRT()\n```\n\n### update column\n...\n```python\ntable = tablemaker.addTable(...)\ncolumn = table.get_column(\"ra\")\n\n#\u00a0modify format\ncolumn.set_format(\"F10.6\")\n\n# modify name and description\ncolumn.name=\"raj2000\"\ncolumn.description=\"right ascension in ICRS\"\n\ntablemaker.writeCDSTables()\ntablemaker.makeReadMe()\n```\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "ReadMe generator package (cdspyreadme)",
    "version": "1.3.4",
    "split_keywords": [
        "astronomy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "0e89f4c37b7f2b992169bce1f4aa7722",
                "sha256": "055e1cb6284e7896fff8ee8b6a3e34de2a974a3ff8e4433895f94ba40c5a0129"
            },
            "downloads": -1,
            "filename": "cdspyreadme-1.3.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0e89f4c37b7f2b992169bce1f4aa7722",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 17585,
            "upload_time": "2021-06-11T08:41:15",
            "upload_time_iso_8601": "2021-06-11T08:41:15.474551Z",
            "url": "https://files.pythonhosted.org/packages/b0/7d/64b758799aedc6177874178926865f9e1b813472451ecead3818a9aaad49/cdspyreadme-1.3.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "59a76cab15a875c20d8d5a0f7fd72c9d",
                "sha256": "6ed86577cf869775664b4c1c7c175d3867ee408b93b35171ab3828f3aab3e341"
            },
            "downloads": -1,
            "filename": "cdspyreadme-1.3.4.tar.gz",
            "has_sig": false,
            "md5_digest": "59a76cab15a875c20d8d5a0f7fd72c9d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 16886,
            "upload_time": "2021-06-11T08:41:17",
            "upload_time_iso_8601": "2021-06-11T08:41:17.110348Z",
            "url": "https://files.pythonhosted.org/packages/9a/4f/1be8315c5bfdcd6f97ea0d20ddafc5f5d8a466336dedde2c6936f8dea315/cdspyreadme-1.3.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-06-11 08:41:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "cds-astro",
    "error": "Could not fetch GitHub repository",
    "lcname": "cdspyreadme"
}
        
Elapsed time: 0.38251s