Name | gladeparser JSON |
Version |
0.2.0
JSON |
| download |
home_page | None |
Summary | Parser for the GLADE+ catalog. |
upload_time | 2024-08-09 20:29:36 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT License Copyright (c) 2024 Bernardo Porto Veronese Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
gravitational waves
galaxy catalog
cosmology
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# gladeparser
![tests](https://github.com/binado/gladeparser/actions/workflows/test.yml/badge.svg)
Parser for the [GLADE+ galaxy catalog](https://glade.elte.hu/).
## Usage
To read the catalog into a `pandas.DataFrame`:
```python
from gladeparser import to_pandas_df
filename = "path/to/catalog"
df = to_pandas_df(filename)
```
The preferred way of reading the catalog is using a `polars` backend, especially if you want to filter out the data:
```python
from gladeparser import to_polars_df
import polars as pl
# Grab objects from 2MASS catalog with redshifts corrected for peculiar velocity
filters = (
pl.col("2MASS name").is_not_null(),
pl.col("z_cmb").is_not_null(),
pl.col("z_cmb") > 0,
pl.col("z flag") == 1,
pl.col("dist flag").is_in([1, 3])
)
# Selected columns
cols = ["ra", "dec", "z_cmb"]
filename = "path/to/catalog"
df = to_polars_df(filename, cols=cols, **filters)
```
### Parsing a subset of columns
```python
from gladeparser import to_pandas_df, get_columns
# Select the columns you want and return their names
# See more options in get_columns docstring
cols = get_columns('Localization', 'Distance', names=True)
filename = "path/to/catalog"
df = to_pandas_df(filename, cols=cols)
```
## Installation
Clone the repo and run
```bash
pip install .
```
## Testing
Make sure that you have `pytest` installed, or run
```bash
pip install .[dev]
```
Then run
```bash
pytest
```
## References
See the GLADE+ paper on [arXiv](https://arxiv.org/abs/2110.06184).
Raw data
{
"_id": null,
"home_page": null,
"name": "gladeparser",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "gravitational waves, galaxy catalog, cosmology",
"author": null,
"author_email": "Bernardo Veronese <bernardo.veronese@edu.ufes.br>",
"download_url": "https://files.pythonhosted.org/packages/63/62/7ac0fc3f1727f275f754849750acdae8270d7a637d586a342a79a9b124b7/gladeparser-0.2.0.tar.gz",
"platform": null,
"description": "# gladeparser\n\n![tests](https://github.com/binado/gladeparser/actions/workflows/test.yml/badge.svg)\n\nParser for the [GLADE+ galaxy catalog](https://glade.elte.hu/).\n\n## Usage\n\nTo read the catalog into a `pandas.DataFrame`:\n\n```python\nfrom gladeparser import to_pandas_df\n\nfilename = \"path/to/catalog\"\ndf = to_pandas_df(filename)\n```\n\nThe preferred way of reading the catalog is using a `polars` backend, especially if you want to filter out the data:\n\n```python\nfrom gladeparser import to_polars_df\nimport polars as pl\n\n# Grab objects from 2MASS catalog with redshifts corrected for peculiar velocity\nfilters = (\n pl.col(\"2MASS name\").is_not_null(),\n pl.col(\"z_cmb\").is_not_null(),\n pl.col(\"z_cmb\") > 0,\n pl.col(\"z flag\") == 1,\n pl.col(\"dist flag\").is_in([1, 3])\n)\n\n# Selected columns\ncols = [\"ra\", \"dec\", \"z_cmb\"]\n\nfilename = \"path/to/catalog\"\ndf = to_polars_df(filename, cols=cols, **filters)\n```\n\n### Parsing a subset of columns\n\n```python\nfrom gladeparser import to_pandas_df, get_columns\n\n# Select the columns you want and return their names\n# See more options in get_columns docstring\ncols = get_columns('Localization', 'Distance', names=True)\n\nfilename = \"path/to/catalog\"\ndf = to_pandas_df(filename, cols=cols)\n```\n\n## Installation\n\nClone the repo and run\n\n```bash\npip install .\n```\n\n## Testing\n\nMake sure that you have `pytest` installed, or run\n\n```bash\npip install .[dev]\n```\n\nThen run\n\n```bash\npytest\n```\n\n## References\n\nSee the GLADE+ paper on [arXiv](https://arxiv.org/abs/2110.06184).\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Bernardo Porto Veronese Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Parser for the GLADE+ catalog.",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://github.com/binado/gladeparser"
},
"split_keywords": [
"gravitational waves",
" galaxy catalog",
" cosmology"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b44d5da68a13b66dc10e3084737b84069723215cf19b7a3b783d8116afbefefa",
"md5": "a6030a9828e0c86d7f56584fc1bc4a4e",
"sha256": "fe099b1128c45bbcdd0fc7ae7bf6b646c7fdec443e9cd09ce24799bfc8a549b3"
},
"downloads": -1,
"filename": "gladeparser-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a6030a9828e0c86d7f56584fc1bc4a4e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 10885,
"upload_time": "2024-08-09T20:29:35",
"upload_time_iso_8601": "2024-08-09T20:29:35.095491Z",
"url": "https://files.pythonhosted.org/packages/b4/4d/5da68a13b66dc10e3084737b84069723215cf19b7a3b783d8116afbefefa/gladeparser-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "63627ac0fc3f1727f275f754849750acdae8270d7a637d586a342a79a9b124b7",
"md5": "aa4018520b84be0dcd44e793a03df45f",
"sha256": "8b11941962130621080056ab857b4397d45363bf3e22c6b7384ae4115588ff7e"
},
"downloads": -1,
"filename": "gladeparser-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "aa4018520b84be0dcd44e793a03df45f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 19754,
"upload_time": "2024-08-09T20:29:36",
"upload_time_iso_8601": "2024-08-09T20:29:36.637745Z",
"url": "https://files.pythonhosted.org/packages/63/62/7ac0fc3f1727f275f754849750acdae8270d7a637d586a342a79a9b124b7/gladeparser-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-09 20:29:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "binado",
"github_project": "gladeparser",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "gladeparser"
}