Skip to content

Commit

Permalink
PR: major refactoring, docs and tests
Browse files Browse the repository at this point in the history
refactor: major refactoring, docs and tests
  • Loading branch information
lgrcia authored May 15, 2023
2 parents d58d2c5 + 1a90aea commit e645cba
Show file tree
Hide file tree
Showing 35 changed files with 4,349 additions and 1,460 deletions.
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: 🐛 Bug report
about: If something isn't working 🔧
title: ''
labels: bug
assignees:
---

## Bug Report

<!-- A clear and concise description of what the bug is. -->

## How To Reproduce

Steps to reproduce the behavior:

### Code sample

<!-- If applicable, attach a minimal code sample to reproduce the decried issue. -->

### Environment

* OS: [e.g. Linux / Windows / macOS]
* Python version, get it with:

```bash
python --version
```

### Screenshots

<!-- If applicable, add screenshots to help explain your problem. -->

## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->

## Additional context

<!-- Add any other context about the problem here. -->
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Configuration: https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository

blank_issues_enabled: false
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: 🚀 Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees:
---

## Feature Request

<!-- A clear and concise description of the feature proposal. -->

## Motivation

<!-- Please describe the motivation for this proposal. -->

## Alternatives

<!-- A clear and concise description of any alternative solutions or features you've considered. -->

## Additional context

<!-- Add any other context or screenshots about the feature request here. -->
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: ❓ Question
about: Ask a question about this project 🎓
title: ''
labels: question
assignees:
---

## Checklist

<!-- Mark with an `x` all the checkboxes that apply (like `[x]`) -->

- [ ] I've searched the project's [`issues`](https://github.com/lgrcia/twirl/issues?q=is%3Aissue).

## Question

<!-- What is your question -->

## Additional context

<!-- Add any other context or screenshots about the feature request here. -->
28 changes: 28 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## Description

<!-- Add a more detailed description of the changes if needed. -->

## Related Issue

<!-- If your PR refers to a related issue, link it here. -->

## Type of Change

<!-- Mark with an `x` all the checkboxes that apply (like `[x]`) -->

- [ ] Examples / docs / tutorials / dependencies update
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] Improvement (non-breaking change which improves an existing feature)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Security fix

## Checklist

<!-- Mark with an `x` all the checkboxes that apply (like `[x]`) -->

- [ ] I've read the [`CODE_OF_CONDUCT.md`](https://github.com/lgrcia/twirl/blob/master/CODE_OF_CONDUCT.md) document.
- [ ] I've read the [`CONTRIBUTING.md`](https://github.com/lgrcia/twirl/blob/master/CONTRIBUTING.md) guide.
- [ ] I've updated the code style using [black](https://black.readthedocs.io/en/stable/).
- [ ] I've written tests for all new methods and classes that I created.
- [ ] I've written the docstring in [numpy style](https://numpydoc.readthedocs.io/en/latest/format.html#documenting-classes) for all the methods and classes that I used.
50 changes: 50 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: twirl/publish

on:
release:
types: [published]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
ci:
name: Build & Publish w/Poetry

strategy:
matrix:
python-version: ["3.10"]
os: [ ubuntu-latest ]

runs-on: ${{ matrix.os }}

env:
PROJECT_NAME: "Twirl"
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

steps:
- name: Checkout 🛎
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Setup Poetry Configuration 🛠️
run: poetry config pypi-token.pypi $PYPI_API_TOKEN

- name: Install Dependencies
run: poetry install --no-root --no-dev

- name: Build Package 🐍
run: poetry build

- name: Dry-run Publish to PyPI 😬
run: poetry publish --dry-run

- name: Publish to PyPI 🚀
run: poetry publish --skip-existing
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Python package

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install -U pip poetry
python -m poetry install --with test
- name: Test with pytest
run: |
python -m poetry run python -m pytest
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
dist
build

# poetry
.venv
.env
.ruff*

.pytest_cache
# local dev and docs
**__pycache__
docs/_build
.DS_Store
.ruff*
15 changes: 15 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "3.8"
jobs:
post_create_environment:
- pip install poetry
- poetry config virtualenvs.create false
post_install:
- poetry install --with docs

sphinx:
configuration: docs/conf.py
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@
},
"editor.formatOnPaste": false,
"editor.defaultFormatter": "ms-python.black-formatter"
}
},
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# twirl

<p align="center">
<img src=" docs/_static/twirl.png" height="270">
</p>

<p align="center">
Python package for astrometric plate solving
<br>
<p align="center">
<a href="https://github.com/lgrcia/twirl">
<img src="https://img.shields.io/badge/github-lgrcia/twirl-blue.svg?style=flat" alt="github"/>
</a>
<a href="">
<img src="https://img.shields.io/badge/license-MIT-lightgray.svg?style=flat" alt="license"/>
</a>
<a href="https://ui.adsabs.harvard.edu/abs/2022MNRAS.509.4817G">
<img src="https://img.shields.io/badge/paper-gray.svg?style=flat" alt="paper"/>
</a>
<a href="https://twirl.readthedocs.io">
<img src="https://img.shields.io/badge/documentation-black.svg?style=flat" alt="documentation"/>
</a>
</p>
</p>

twirl is an astrometric plate solving package for Python. It is suited for cases where the Right Ascension and Declination (RA, dec) coordinates of the image center and the field of view is known, computing a World Coordinate System (WCS) based on GAIA reference stars.

twirl is based on the algorithm of Lang et al. 2009 (astrometry.net), which performs the following solving steps to compute a WCS:
Expand Down Expand Up @@ -124,4 +147,10 @@ $ poetry install

## Acknowledgements

This package has made use of Lang, D., Hogg, D.W., Mierle, K., Blanton, M. and Roweis, S. (2010). _Astrometry.net: Blind Astrometric Calibration of Arbitrary Astronomical Images_. The Astronomical Journal, 139(5), pp.1782–1800. [doi:10.1088/0004-6256/139/5/1782](https://iopscience.iop.org/article/10.1088/0004-6256/139/5/1782).
This package has made use of the algorithm from

Lang, D. et al. (2010). _Astrometry.net: Blind Astrometric Calibration of Arbitrary Astronomical Images_. The Astronomical Journal, 139(5), pp.1782–1800. [doi:10.1088/0004-6256/139/5/1782](https://iopscience.iop.org/article/10.1088/0004-6256/139/5/1782).

implemented in

Garcia, L. J. et al. (2022). prose: a Python framework for modular astronomical images processing. MNRAS, vol. 509, no. 4, pp. 4817–4828, 2022. [doi:10.1093/mnras/stab3113](https://academic.oup.com/mnras/article-abstract/509/4/4817/6414007).
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Loading

0 comments on commit e645cba

Please sign in to comment.