Skip to content

Commit

Permalink
Merge cea504d into cdc59cc
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiaverga committed Sep 22, 2023
2 parents cdc59cc + cea504d commit 7fcfcb8
Show file tree
Hide file tree
Showing 37 changed files with 344 additions and 245 deletions.
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

4 changes: 4 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
#
# SPDX-License-Identifier: MIT

name: "CodeQL"

on:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
#
# SPDX-License-Identifier: MIT

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

Expand Down Expand Up @@ -29,9 +33,9 @@ jobs:
python -m pip install --upgrade pip
python -m pip install -e .[data]
python -m pip install -e .[development]
- name: Lint with flake8
- name: Lint with ruff
run: |
flake8 .
ruff .
- name: Doctests
run: |
pytest -v --doctest-plus src/pyongc/
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
#
# SPDX-License-Identifier: MIT

.directory
*.egg-info
*.pyc
Expand Down
4 changes: 4 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
#
# SPDX-License-Identifier: MIT

# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
Expand Down
10 changes: 10 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: PyOngc
Upstream-Contact: Mattia Verga <mattia.verga@tiscali.it>
Source: https://github.com/mattiaverga/PyOngc

# Sample paragraph, commented out:
#
# Files: src/*
# Copyright: $YEAR $NAME <$CONTACT>
# License: ...
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

170 changes: 170 additions & 0 deletions LICENSES/CC-BY-SA-4.0.txt

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions LICENSES/MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2017 Mattia Verga

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.
6 changes: 5 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
#
# SPDX-License-Identifier: MIT

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
Expand All @@ -17,4 +21,4 @@ numpy = "*"
pandas = "*"

[requires]
python_version = "3.10"
python_version = "3.11"
34 changes: 30 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.. SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
..
.. SPDX-License-Identifier: CC-BY-SA-4.0
PyOngc
======
Expand Down Expand Up @@ -50,21 +53,44 @@ Object data is easily available from command line also:

$ ongc view NGC7000 --details
+-----------------------------------------------------------------------------+
| Id: 13055 Name: NGC7000 Type: HII Ionized region |
| Id: 13067 Name: NGC7000 Type: HII Ionized region |
| R.A.: 20:59:17.14 Dec.: +44:31:43.6 Constellation: Cyg |
| Common names: |
| North America Nebula |
+-----------------------------------------------------------------------------+
| Major axis: 120.0' Minor axis: 30.0' Position angle: N/A |
| B-mag: 4.0 V-mag: N/A J-mag: N/A H-mag: N/A K-mag: N/A |
| |
| Parallax: N/A Radial velocity: N/A Redshift: N/A |
| |
| Proper apparent motion in RA: N/A |
| Proper apparent motion in Dec: N/A |
| |
+-----------------------------------------------------------------------------+
| Other identifiers: |
| C 020, LBN 373 |
+-----------------------------------------------------------------------------+
| OpenNGC notes: |
| B-Mag taken from LEDA |
+-----------------------------------------------------------------------------+

Additionally, the available data can be manipulated through Pandas:

::

>>> from pyongc import data
>>> data.clusters(globular=True, open=False)
name type ra dec const ... parallax pmra pmdec radvel redshift
0 IC1257 GCl 4.569009 -0.123798 Oph ... NaN NaN NaN NaN NaN
1 IC1276 GCl 4.759242 -0.125796 Se2 ... 0.1100 -2.47 -4.41 155.0 0.000517
2 IC2134 GCl 1.409778 -1.316796 Men ... NaN NaN NaN NaN NaN
3 IC2140 GCl 1.454580 -1.315548 Men ... NaN NaN NaN NaN NaN
4 IC2146 GCl 1.473853 -1.305213 Men ... NaN NaN NaN 226.0 0.000755
.. ... ... ... ... ... ... ... ... ... ... ...
199 NGC7006 GCl 5.504278 0.282526 Del ... NaN -0.08 -0.61 -383.0 -0.001278
200 NGC7078 GCl 5.628569 0.212351 Peg ... 0.0522 -0.63 -3.80 -107.0 -0.000356
201 NGC7089 GCl 5.643741 -0.014369 Aqr ... 0.0612 3.51 -2.16 -4.0 -0.000012
202 NGC7099 GCl 5.673921 -0.404551 Cap ... 0.0676 -0.73 -7.24 -185.0 -0.000618
203 NGC7492 GCl 6.058233 -0.272472 Aqr ... 0.0528 0.76 -2.30 -177.0 -0.000589

[204 rows x 22 columns]

The full documentation is available at https://pyongc.readthedocs.io/en/latest/.

Expand Down
3 changes: 3 additions & 0 deletions database/NGC.csv.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>

SPDX-License-Identifier: CC-BY-SA-4.0
3 changes: 3 additions & 0 deletions database/addendum.csv.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>

SPDX-License-Identifier: CC-BY-SA-4.0
26 changes: 3 additions & 23 deletions database/createdb.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,9 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
#
#
# MIT License
#

# Copyright (c) 2017 Mattia Verga <mattia.verga@tiscali.it>
# SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
#
# 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.
#
# SPDX-License-Identifier: MIT

"""Creates sqlite3 database from csv OpenNGC file.
The first line of the csv file, which contains the headers, must be removed.
Expand Down
4 changes: 4 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
#
# SPDX-License-Identifier: MIT

# Minimal makefile for Sphinx documentation
#

Expand Down
4 changes: 4 additions & 0 deletions docs/cli/ongc.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.. SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
..
.. SPDX-License-Identifier: CC-BY-SA-4.0
=================
The CLI interface
=================
Expand Down
4 changes: 4 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
#
# SPDX-License-Identifier: MIT

# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
Expand Down
4 changes: 4 additions & 0 deletions docs/examples/examples.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.. SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
..
.. SPDX-License-Identifier: CC-BY-SA-4.0
##############
Usage examples
##############
Expand Down
4 changes: 4 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.. SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
..
.. SPDX-License-Identifier: CC-BY-SA-4.0
.. PyONGC documentation master file, created by
sphinx-quickstart on Sun Jun 9 18:16:33 2019.
You can adapt this file completely to your liking, but it should at least
Expand Down
4 changes: 4 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
REM SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
REM
REM SPDX-License-Identifier: MIT

@ECHO OFF

pushd %~dp0
Expand Down
4 changes: 4 additions & 0 deletions docs/modules/data.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.. SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
..
.. SPDX-License-Identifier: CC-BY-SA-4.0
Using data with Pandas
======================

Expand Down
4 changes: 4 additions & 0 deletions docs/modules/exceptions.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.. SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
..
.. SPDX-License-Identifier: CC-BY-SA-4.0
Custom exceptions for PyOngc
============================

Expand Down
4 changes: 4 additions & 0 deletions docs/modules/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.. SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
..
.. SPDX-License-Identifier: CC-BY-SA-4.0
Python modules
==============

Expand Down
4 changes: 4 additions & 0 deletions docs/modules/ongc.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.. SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
..
.. SPDX-License-Identifier: CC-BY-SA-4.0
Main interface
==============

Expand Down
4 changes: 4 additions & 0 deletions docs/readme.rst
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
.. SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
..
.. SPDX-License-Identifier: CC-BY-SA-4.0
.. include:: ../README.rst
27 changes: 14 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
#
# SPDX-License-Identifier: MIT

[build-system]
requires = [
"setuptools>=42",
Expand All @@ -8,6 +12,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "PyOngc"
version = "1.0.2"
description = "Python interface to OpenNGC database data"
readme = "README.rst"
authors = [
Expand All @@ -16,7 +21,7 @@ authors = [
]
requires-python = ">=3.8"
keywords = ["astronomy", "database"]
license = {text = "MIT"}
license = {text = "MIT AND CC-BY-SA-4.0"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
Expand All @@ -36,28 +41,24 @@ dependencies = [
"Click",
"numpy",
]
dynamic = ["version"]

[project.optional-dependencies]
data = ["pandas"]
development = ["pytest", "flake8", "pytest-cov", "pytest-doctestplus"]
docs = ["pandas", "sphinx", "sphinx_rtd_theme"]
development = ["pytest", "pytest-cov", "pytest-doctestplus", "ruff"]
docs = [
"pandas",
"sphinx>=4.0",
"sphinx_rtd_theme>=1.0"
]

[project.scripts]
ongc = "pyongc.scripts.ongc:cli"

[project.urls]
homepage = "https://github.com/mattiaverga/PyOngc"

[tool.setuptools]
include-package-data = true

[tool.setuptools.dynamic]
version = {attr = "pyongc.__version__"}

[tool.setuptools.packages]
find = {where = ["src"]}

[tool.setuptools.package-data]
pyongc = ["ongc.db"]

[tool.ruff]
line-length = 100
10 changes: 6 additions & 4 deletions src/pyongc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
"""Python interface to OpenNGC database data.
# SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
#
# SPDX-License-Identifier: MIT

:license: MIT, see LICENSE for more details.
"""
"""Python interface to OpenNGC database data."""

from importlib.metadata import version
from pkg_resources import resource_filename


__version__ = '1.0.1'
__version__ = version('PyOngc')
DBDATE = 20221023 # Version of database data

DBPATH = resource_filename(__name__, 'ongc.db')
25 changes: 2 additions & 23 deletions src/pyongc/data.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
# -*- coding:utf-8 -*-
#
# MIT License
#
# Copyright (c) 2021 Mattia Verga <mattia.verga@tiscali.it>
#
# 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.
# SPDX-FileCopyrightText: 2017 Mattia Verga <mattia.verga@tiscali.it>
#
# SPDX-License-Identifier: MIT

"""Provides access to OpenNGC data through Pandas' DataFrames.
Expand Down

0 comments on commit 7fcfcb8

Please sign in to comment.