thuban 0.0.2__tar.gz → 0.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- thuban-0.0.4/.github/workflows/ci.yaml +45 -0
- thuban-0.0.4/.github/workflows/ci_fixed.yaml +46 -0
- thuban-0.0.4/.github/workflows/docs.yaml +36 -0
- thuban-0.0.4/.github/workflows/publish.yaml +37 -0
- thuban-0.0.4/.gitignore +160 -0
- thuban-0.0.4/.pre-commit-config.yaml +31 -0
- thuban-0.0.4/.readthedocs.yaml +33 -0
- thuban-0.0.4/CITATION.cff +11 -0
- {thuban-0.0.2 → thuban-0.0.4}/PKG-INFO +1 -1
- thuban-0.0.4/codecov.yaml +8 -0
- thuban-0.0.4/docs/Makefile +20 -0
- thuban-0.0.4/docs/_static/favicon.ico +0 -0
- thuban-0.0.4/docs/_static/logo.png +0 -0
- thuban-0.0.4/docs/conf.py +62 -0
- thuban-0.0.4/docs/index.rst +20 -0
- thuban-0.0.4/docs/make.bat +35 -0
- {thuban-0.0.2 → thuban-0.0.4}/pyproject.toml +5 -3
- thuban-0.0.4/scripts/prepare_reduced_hip.py +6 -0
- thuban-0.0.4/tests/test_visualize.py +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/thuban/catalog.py +6 -1
- {thuban-0.0.2 → thuban-0.0.4}/thuban/pointing.py +28 -17
- {thuban-0.0.2 → thuban-0.0.4}/thuban.egg-info/PKG-INFO +1 -1
- {thuban-0.0.2 → thuban-0.0.4}/thuban.egg-info/SOURCES.txt +17 -0
- {thuban-0.0.2 → thuban-0.0.4}/LICENSE +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/MANIFEST.in +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/README.md +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/setup.cfg +0 -0
- /thuban-0.0.2/tests/test_cli.py → /thuban-0.0.4/tests/__init__.py +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/tests/test_catalog.py +0 -0
- /thuban-0.0.2/tests/test_visualize.py → /thuban-0.0.4/tests/test_cli.py +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/tests/test_distortion.py +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/tests/test_pointing.py +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/tests/test_util.py +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/thuban/__init__.py +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/thuban/cli.py +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/thuban/data/reduced_hip.csv +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/thuban/distortion.py +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/thuban/error.py +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/thuban/simulate.py +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/thuban/util.py +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/thuban/visualize.py +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/thuban.egg-info/dependency_links.txt +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/thuban.egg-info/entry_points.txt +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/thuban.egg-info/requires.txt +0 -0
- {thuban-0.0.2 → thuban-0.0.4}/thuban.egg-info/top_level.txt +0 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
3
|
+
|
4
|
+
name: CI
|
5
|
+
|
6
|
+
on:
|
7
|
+
push:
|
8
|
+
branches:
|
9
|
+
- main
|
10
|
+
pull_request:
|
11
|
+
branches:
|
12
|
+
- main
|
13
|
+
schedule:
|
14
|
+
- cron: '0 0 * * MON'
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
build:
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
strategy:
|
20
|
+
fail-fast: false
|
21
|
+
matrix:
|
22
|
+
python-version: ["3.9", "3.10", "3.11", "3.12"]
|
23
|
+
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v3
|
26
|
+
- name: Set up Python ${{ matrix.python-version }}
|
27
|
+
uses: actions/setup-python@v3
|
28
|
+
with:
|
29
|
+
python-version: ${{ matrix.python-version }}
|
30
|
+
- name: Install dependencies
|
31
|
+
run: |
|
32
|
+
python -m pip install --upgrade pip
|
33
|
+
pip install ".[test]"
|
34
|
+
- name: Lint with ruff
|
35
|
+
run: |
|
36
|
+
ruff check .
|
37
|
+
- name: Test with pytest
|
38
|
+
run: |
|
39
|
+
pip install .
|
40
|
+
coverage run --branch --source=thuban/ -m pytest tests -m "not slow"
|
41
|
+
- name: Upload coverage reports to Codecov
|
42
|
+
uses: codecov/codecov-action@v4.0.1
|
43
|
+
with:
|
44
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
45
|
+
slug: punch-mission/thuban
|
@@ -0,0 +1,46 @@
|
|
1
|
+
name: CI pinned server environment
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- main
|
10
|
+
schedule:
|
11
|
+
- cron: '0 0 * * MON'
|
12
|
+
workflow_dispatch:
|
13
|
+
|
14
|
+
jobs:
|
15
|
+
build:
|
16
|
+
|
17
|
+
runs-on: ubuntu-latest
|
18
|
+
strategy:
|
19
|
+
fail-fast: false
|
20
|
+
matrix:
|
21
|
+
python-version: ["3.11"]
|
22
|
+
|
23
|
+
steps:
|
24
|
+
- uses: actions/checkout@v3
|
25
|
+
- name: Set up Python ${{ matrix.python-version }}
|
26
|
+
uses: actions/setup-python@v3
|
27
|
+
with:
|
28
|
+
python-version: ${{ matrix.python-version }}
|
29
|
+
- name: Grab requirements.txt
|
30
|
+
run: |
|
31
|
+
wget https://raw.githubusercontent.com/punch-mission/punch-mission/refs/heads/main/requirements.txt
|
32
|
+
- name: Install dependencies
|
33
|
+
run: |
|
34
|
+
python -m pip install --upgrade pip
|
35
|
+
pip install -r requirements.txt
|
36
|
+
pip install ".[test]"
|
37
|
+
- name: Test with pytest
|
38
|
+
run: |
|
39
|
+
coverage run -m pytest
|
40
|
+
- name: Upload coverage to Codecov
|
41
|
+
uses: codecov/codecov-action@v4
|
42
|
+
env:
|
43
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
44
|
+
with:
|
45
|
+
fail_ci_if_error: true
|
46
|
+
verbose: true
|
@@ -0,0 +1,36 @@
|
|
1
|
+
name: deploy-docs
|
2
|
+
|
3
|
+
# Only run this when the master branch changes
|
4
|
+
on:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- main
|
8
|
+
|
9
|
+
# This job installs dependencies, builds the book, and pushes it to `gh-pages`
|
10
|
+
jobs:
|
11
|
+
deploy-docs:
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
|
16
|
+
# Install dependencies
|
17
|
+
- name: Set up Python 3.10
|
18
|
+
uses: actions/setup-python@v2
|
19
|
+
with:
|
20
|
+
python-version: "3.10"
|
21
|
+
|
22
|
+
- name: Install dependencies
|
23
|
+
run: |
|
24
|
+
pip install ".[docs]"
|
25
|
+
|
26
|
+
# Build the book
|
27
|
+
- name: Sphinx build
|
28
|
+
run: |
|
29
|
+
cd ./docs; make html; cd ..
|
30
|
+
|
31
|
+
# Push the book's HTML to github-pages
|
32
|
+
- name: GitHub Pages action
|
33
|
+
uses: peaceiris/actions-gh-pages@v3.6.1
|
34
|
+
with:
|
35
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
36
|
+
publish_dir: ./docs/_build/html
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# This workflow will upload a Python Package using Twine when a release is created
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
3
|
+
|
4
|
+
# This workflow uses actions that are not certified by GitHub.
|
5
|
+
# They are provided by a third-party and are governed by
|
6
|
+
# separate terms of service, privacy policy, and support
|
7
|
+
# documentation.
|
8
|
+
|
9
|
+
name: Upload Python Package
|
10
|
+
|
11
|
+
on:
|
12
|
+
release:
|
13
|
+
types: [published]
|
14
|
+
|
15
|
+
permissions:
|
16
|
+
contents: read
|
17
|
+
|
18
|
+
jobs:
|
19
|
+
deploy:
|
20
|
+
runs-on: ubuntu-latest
|
21
|
+
environment: pypi
|
22
|
+
permissions:
|
23
|
+
id-token: write
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v3
|
26
|
+
- name: Set up Python
|
27
|
+
uses: actions/setup-python@v3
|
28
|
+
with:
|
29
|
+
python-version: '3.x'
|
30
|
+
- name: Install dependencies
|
31
|
+
run: |
|
32
|
+
python -m pip install --upgrade pip
|
33
|
+
pip install build
|
34
|
+
- name: Build package
|
35
|
+
run: python -m build -s
|
36
|
+
- name: Publish package
|
37
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
thuban-0.0.4/.gitignore
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
2
|
+
__pycache__/
|
3
|
+
*.py[cod]
|
4
|
+
*$py.class
|
5
|
+
|
6
|
+
# C extensions
|
7
|
+
*.so
|
8
|
+
|
9
|
+
# Distribution / packaging
|
10
|
+
.Python
|
11
|
+
build/
|
12
|
+
develop-eggs/
|
13
|
+
dist/
|
14
|
+
downloads/
|
15
|
+
eggs/
|
16
|
+
.eggs/
|
17
|
+
lib/
|
18
|
+
lib64/
|
19
|
+
parts/
|
20
|
+
sdist/
|
21
|
+
var/
|
22
|
+
wheels/
|
23
|
+
share/python-wheels/
|
24
|
+
*.egg-info/
|
25
|
+
.installed.cfg
|
26
|
+
*.egg
|
27
|
+
MANIFEST
|
28
|
+
|
29
|
+
# PyInstaller
|
30
|
+
# Usually these files are written by a python script from a template
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
32
|
+
*.manifest
|
33
|
+
*.spec
|
34
|
+
|
35
|
+
# Installer logs
|
36
|
+
pip-log.txt
|
37
|
+
pip-delete-this-directory.txt
|
38
|
+
|
39
|
+
# Unit test / coverage reports
|
40
|
+
htmlcov/
|
41
|
+
.tox/
|
42
|
+
.nox/
|
43
|
+
.coverage
|
44
|
+
.coverage.*
|
45
|
+
.cache
|
46
|
+
nosetests.xml
|
47
|
+
coverage.xml
|
48
|
+
*.cover
|
49
|
+
*.py,cover
|
50
|
+
.hypothesis/
|
51
|
+
.pytest_cache/
|
52
|
+
cover/
|
53
|
+
|
54
|
+
# Translations
|
55
|
+
*.mo
|
56
|
+
*.pot
|
57
|
+
|
58
|
+
# Django stuff:
|
59
|
+
*.log
|
60
|
+
local_settings.py
|
61
|
+
db.sqlite3
|
62
|
+
db.sqlite3-journal
|
63
|
+
|
64
|
+
# Flask stuff:
|
65
|
+
instance/
|
66
|
+
.webassets-cache
|
67
|
+
|
68
|
+
# Scrapy stuff:
|
69
|
+
.scrapy
|
70
|
+
|
71
|
+
# Sphinx documentation
|
72
|
+
docs/_build/
|
73
|
+
|
74
|
+
# PyBuilder
|
75
|
+
.pybuilder/
|
76
|
+
target/
|
77
|
+
|
78
|
+
# Jupyter Notebook
|
79
|
+
.ipynb_checkpoints
|
80
|
+
|
81
|
+
# IPython
|
82
|
+
profile_default/
|
83
|
+
ipython_config.py
|
84
|
+
|
85
|
+
# pyenv
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
88
|
+
# .python-version
|
89
|
+
|
90
|
+
# pipenv
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
94
|
+
# install all needed dependencies.
|
95
|
+
#Pipfile.lock
|
96
|
+
|
97
|
+
# poetry
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
100
|
+
# commonly ignored for libraries.
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
102
|
+
#poetry.lock
|
103
|
+
|
104
|
+
# pdm
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
106
|
+
#pdm.lock
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
108
|
+
# in version control.
|
109
|
+
# https://pdm.fming.dev/#use-with-ide
|
110
|
+
.pdm.toml
|
111
|
+
|
112
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
113
|
+
__pypackages__/
|
114
|
+
|
115
|
+
# Celery stuff
|
116
|
+
celerybeat-schedule
|
117
|
+
celerybeat.pid
|
118
|
+
|
119
|
+
# SageMath parsed files
|
120
|
+
*.sage.py
|
121
|
+
|
122
|
+
# Environments
|
123
|
+
.env
|
124
|
+
.venv
|
125
|
+
env/
|
126
|
+
venv/
|
127
|
+
ENV/
|
128
|
+
env.bak/
|
129
|
+
venv.bak/
|
130
|
+
|
131
|
+
# Spyder project settings
|
132
|
+
.spyderproject
|
133
|
+
.spyproject
|
134
|
+
|
135
|
+
# Rope project settings
|
136
|
+
.ropeproject
|
137
|
+
|
138
|
+
# mkdocs documentation
|
139
|
+
/site
|
140
|
+
|
141
|
+
# mypy
|
142
|
+
.mypy_cache/
|
143
|
+
.dmypy.json
|
144
|
+
dmypy.json
|
145
|
+
|
146
|
+
# Pyre type checker
|
147
|
+
.pyre/
|
148
|
+
|
149
|
+
# pytype static type analyzer
|
150
|
+
.pytype/
|
151
|
+
|
152
|
+
# Cython debug symbols
|
153
|
+
cython_debug/
|
154
|
+
|
155
|
+
# PyCharm
|
156
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
157
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
158
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
159
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
160
|
+
.idea/
|
@@ -0,0 +1,31 @@
|
|
1
|
+
exclude: "\\.asdf$"
|
2
|
+
repos:
|
3
|
+
# This should be before any formatting hooks like isort
|
4
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
5
|
+
# Ruff version.
|
6
|
+
rev: v0.6.1
|
7
|
+
hooks:
|
8
|
+
# Run the linter.
|
9
|
+
- id: ruff
|
10
|
+
types_or: [ python, pyi ]
|
11
|
+
args: [ --fix ]
|
12
|
+
- repo: https://github.com/PyCQA/isort
|
13
|
+
rev: 5.13.0
|
14
|
+
hooks:
|
15
|
+
- id: isort
|
16
|
+
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|extern.*|sunpy/extern)$"
|
17
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
18
|
+
rev: v4.5.0
|
19
|
+
hooks:
|
20
|
+
- id: check-ast
|
21
|
+
- id: check-case-conflict
|
22
|
+
- id: trailing-whitespace
|
23
|
+
exclude: ".*(.fits|.fts|.fit|.header|.txt)$"
|
24
|
+
- id: check-yaml
|
25
|
+
- id: debug-statements
|
26
|
+
- id: check-added-large-files
|
27
|
+
args: ['--enforce-all','--maxkb=10000']
|
28
|
+
- id: end-of-file-fixer
|
29
|
+
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*|.json)$|^CITATION.rst$"
|
30
|
+
- id: mixed-line-ending
|
31
|
+
exclude: ".*(.fits|.fts|.fit|.header|.txt|tca.*)$"
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# .readthedocs.yaml
|
2
|
+
# Read the Docs configuration file
|
3
|
+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
4
|
+
|
5
|
+
# Required
|
6
|
+
version: 2
|
7
|
+
|
8
|
+
# Set the OS, Python version and other tools you might need
|
9
|
+
build:
|
10
|
+
os: ubuntu-22.04
|
11
|
+
tools:
|
12
|
+
python: "3.12"
|
13
|
+
|
14
|
+
|
15
|
+
# Build documentation in the "docs/" directory with Sphinx
|
16
|
+
sphinx:
|
17
|
+
configuration: docs/conf.py
|
18
|
+
|
19
|
+
# Optionally build your docs in additional formats such as PDF and ePub
|
20
|
+
formats:
|
21
|
+
- pdf
|
22
|
+
- epub
|
23
|
+
|
24
|
+
# Optional but recommended, declare the Python requirements required
|
25
|
+
# to build your documentation
|
26
|
+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
27
|
+
python:
|
28
|
+
install:
|
29
|
+
- method: pip
|
30
|
+
extra_requirements:
|
31
|
+
- all
|
32
|
+
- docs
|
33
|
+
path: .
|
@@ -0,0 +1,11 @@
|
|
1
|
+
cff-version: 1.2.0
|
2
|
+
message: "If you use this software, please cite it as below."
|
3
|
+
authors:
|
4
|
+
- family-names: "Hughes"
|
5
|
+
given-names: "J. Marcus"
|
6
|
+
orcid: "https://orcid.org/0000-0003-3410-7650"
|
7
|
+
title: "thuban"
|
8
|
+
version: 0.0.3
|
9
|
+
doi: 10.5281/zenodo.13340312
|
10
|
+
date-released: 2024-08-18
|
11
|
+
url: "https://github.com/punch-mission/thuban"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: thuban
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.4
|
4
4
|
Summary: High precision and accuracy astrometric image solving from a guess
|
5
5
|
Author-email: "J. Marcus Hughes" <hughes.jmb@gmail.com>
|
6
6
|
Maintainer-email: "J. Marcus Hughes" <hughes.jmb@gmail.com>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
2
|
+
#
|
3
|
+
|
4
|
+
# You can set these variables from the command line, and also
|
5
|
+
# from the environment for the first two.
|
6
|
+
SPHINXOPTS ?=
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
8
|
+
SOURCEDIR = .
|
9
|
+
BUILDDIR = _build
|
10
|
+
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
12
|
+
help:
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
14
|
+
|
15
|
+
.PHONY: help Makefile
|
16
|
+
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
19
|
+
%: Makefile
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
Binary file
|
Binary file
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Configuration file for the Sphinx documentation builder.
|
2
|
+
#
|
3
|
+
# For the full list of built-in configuration values, see the documentation:
|
4
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
5
|
+
|
6
|
+
# -- Project information -----------------------------------------------------
|
7
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
8
|
+
|
9
|
+
project = "thuban"
|
10
|
+
copyright = "2024, PUNCH Science Operations Center"
|
11
|
+
author = "PUNCH Science Operations Center"
|
12
|
+
release = "0.0.3"
|
13
|
+
|
14
|
+
# -- General configuration ---------------------------------------------------
|
15
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
16
|
+
|
17
|
+
extensions = ["autoapi.extension",
|
18
|
+
"sphinx.ext.autodoc",
|
19
|
+
"sphinx.ext.napoleon",
|
20
|
+
"sphinx_favicon",
|
21
|
+
"IPython.sphinxext.ipython_console_highlighting"]
|
22
|
+
|
23
|
+
templates_path = ["_templates"]
|
24
|
+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
25
|
+
|
26
|
+
|
27
|
+
# -- Options for HTML output -------------------------------------------------
|
28
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
29
|
+
|
30
|
+
html_theme = "pydata_sphinx_theme"
|
31
|
+
html_show_sourcelink = False
|
32
|
+
html_static_path = ["_static"]
|
33
|
+
html_theme_options = {
|
34
|
+
"use_edit_page_button": True,
|
35
|
+
"icon_links": [
|
36
|
+
{
|
37
|
+
"name": "GitHub",
|
38
|
+
"url": "https://github.com/punch-mission/thuban",
|
39
|
+
"icon": "fa-brands fa-github",
|
40
|
+
"type": "fontawesome",
|
41
|
+
}
|
42
|
+
],
|
43
|
+
"show_nav_level": 1,
|
44
|
+
"show_toc_level": 3,
|
45
|
+
"logo": {
|
46
|
+
"text": "thuban",
|
47
|
+
"image_light": "_static/logo.png",
|
48
|
+
"image_dark": "_static/logo.png",
|
49
|
+
}
|
50
|
+
}
|
51
|
+
html_context = {
|
52
|
+
# "github_url": "https://github.com", # or your GitHub Enterprise site
|
53
|
+
"github_user": "punch-mission",
|
54
|
+
"github_repo": "thuban",
|
55
|
+
"github_version": "main",
|
56
|
+
"doc_path": "docs/",
|
57
|
+
}
|
58
|
+
|
59
|
+
|
60
|
+
autoapi_dirs = ["../thuban"]
|
61
|
+
|
62
|
+
favicons = ["favicon.ico"]
|
@@ -0,0 +1,20 @@
|
|
1
|
+
.. thuban documentation master file, created by
|
2
|
+
sphinx-quickstart on Fri Mar 22 08:31:44 2024.
|
3
|
+
You can adapt this file completely to your liking, but it should at least
|
4
|
+
contain the root `toctree` directive.
|
5
|
+
|
6
|
+
Welcome to thuban's documentation!
|
7
|
+
==================================
|
8
|
+
|
9
|
+
.. toctree::
|
10
|
+
:maxdepth: 2
|
11
|
+
:caption: Contents:
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
Indices and tables
|
16
|
+
==================
|
17
|
+
|
18
|
+
* :ref:`genindex`
|
19
|
+
* :ref:`modindex`
|
20
|
+
* :ref:`search`
|
@@ -0,0 +1,35 @@
|
|
1
|
+
@ECHO OFF
|
2
|
+
|
3
|
+
pushd %~dp0
|
4
|
+
|
5
|
+
REM Command file for Sphinx documentation
|
6
|
+
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
8
|
+
set SPHINXBUILD=sphinx-build
|
9
|
+
)
|
10
|
+
set SOURCEDIR=.
|
11
|
+
set BUILDDIR=_build
|
12
|
+
|
13
|
+
%SPHINXBUILD% >NUL 2>NUL
|
14
|
+
if errorlevel 9009 (
|
15
|
+
echo.
|
16
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
17
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
18
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
19
|
+
echo.may add the Sphinx directory to PATH.
|
20
|
+
echo.
|
21
|
+
echo.If you don't have Sphinx installed, grab it from
|
22
|
+
echo.https://www.sphinx-doc.org/
|
23
|
+
exit /b 1
|
24
|
+
)
|
25
|
+
|
26
|
+
if "%1" == "" goto help
|
27
|
+
|
28
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
29
|
+
goto end
|
30
|
+
|
31
|
+
:help
|
32
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
33
|
+
|
34
|
+
:end
|
35
|
+
popd
|
@@ -1,11 +1,11 @@
|
|
1
1
|
[build-system]
|
2
|
+
requires = ["setuptools>=64", "setuptools-scm>=8", "wheel"]
|
3
|
+
build-backend = "setuptools.build_meta"
|
2
4
|
|
3
|
-
requires = ["setuptools",
|
4
|
-
"wheel"]
|
5
5
|
|
6
6
|
[project]
|
7
7
|
name = "thuban"
|
8
|
-
|
8
|
+
dynamic = ["version"]
|
9
9
|
dependencies = ["numpy",
|
10
10
|
"astropy",
|
11
11
|
"matplotlib",
|
@@ -47,6 +47,8 @@ Repository = "https://github.com/punch-mission/thuban.git"
|
|
47
47
|
"Bug Tracker" = "https://github.com/punch-mission/thuban/issues"
|
48
48
|
Changelog = "https://github.com/punch-mission/thuban/blob/main/CHANGELOG.md"
|
49
49
|
|
50
|
+
[tool.setuptools_scm]
|
51
|
+
|
50
52
|
[tool.setuptools]
|
51
53
|
packages = ["thuban"]
|
52
54
|
|
@@ -0,0 +1,6 @@
|
|
1
|
+
from thuban.catalog import filter_for_visible_stars, load_raw_hipparcos_catalog
|
2
|
+
|
3
|
+
if __name__ == "__main__":
|
4
|
+
raw_hipparcos = load_raw_hipparcos_catalog()
|
5
|
+
reduced_hipparcos = filter_for_visible_stars(raw_hipparcos, dimmest_magnitude=14)
|
6
|
+
reduced_hipparcos.to_csv("../thuban/data/reduced_hip.csv", index=False)
|
File without changes
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import os
|
2
|
+
from typing import Callable
|
2
3
|
|
3
4
|
import astropy.units as u
|
4
5
|
import numpy as np
|
@@ -163,7 +164,7 @@ def filter_for_visible_stars(catalog: pd.DataFrame, dimmest_magnitude: float = 6
|
|
163
164
|
|
164
165
|
|
165
166
|
def find_catalog_in_image(
|
166
|
-
catalog: pd.DataFrame, wcs: WCS, image_shape: (int, int),
|
167
|
+
catalog: pd.DataFrame, wcs: WCS, image_shape: (int, int), mask: Callable = None,
|
167
168
|
mode: str = "all"
|
168
169
|
) -> np.ndarray:
|
169
170
|
"""Using the provided WCS converts the RA/DEC catalog into pixel coordinates
|
@@ -195,6 +196,10 @@ def find_catalog_in_image(
|
|
195
196
|
except NoConvergence as e:
|
196
197
|
xs, ys = e.best_solution[:, 0], e.best_solution[:, 1]
|
197
198
|
bounds_mask = (0 <= xs) * (xs < image_shape[0]) * (0 <= ys) * (ys < image_shape[1])
|
199
|
+
|
200
|
+
if mask is not None:
|
201
|
+
bounds_mask *= mask(xs, ys)
|
202
|
+
|
198
203
|
reduced_catalog = catalog[bounds_mask].copy()
|
199
204
|
reduced_catalog["x_pix"] = xs[bounds_mask]
|
200
205
|
reduced_catalog['y_pix'] = ys[bounds_mask]
|
@@ -1,9 +1,11 @@
|
|
1
1
|
import warnings
|
2
|
+
from typing import Callable
|
2
3
|
|
3
4
|
import numpy as np
|
4
5
|
import pandas as pd
|
5
6
|
import sep_pjw as sep
|
6
7
|
from astropy.wcs import WCS, utils
|
8
|
+
import astropy.units as u
|
7
9
|
from lmfit import Parameters, minimize
|
8
10
|
|
9
11
|
from thuban.catalog import (filter_for_visible_stars, find_catalog_in_image,
|
@@ -47,19 +49,21 @@ def calculate_pc_matrix(crota: float, cdelt: (float, float)) -> np.ndarray:
|
|
47
49
|
"""
|
48
50
|
return np.array(
|
49
51
|
[
|
50
|
-
[np.cos(crota), np.sin(crota) * (cdelt[0] / cdelt[1])],
|
51
|
-
[
|
52
|
+
[np.cos(crota), -np.sin(crota) * (cdelt[0] / cdelt[1])],
|
53
|
+
[np.sin(crota) * (cdelt[1] / cdelt[0]), np.cos(crota)],
|
52
54
|
],
|
53
55
|
)
|
54
56
|
|
55
57
|
|
56
|
-
|
57
58
|
def _residual(params: Parameters,
|
58
59
|
observed_coords: np.ndarray,
|
59
60
|
catalog: pd.DataFrame,
|
60
61
|
guess_wcs: WCS,
|
61
62
|
n: int,
|
62
|
-
image_shape: (int, int)
|
63
|
+
image_shape: (int, int),
|
64
|
+
edge: int = 100,
|
65
|
+
sigma: float = 3.0,
|
66
|
+
mask: Callable = None):
|
63
67
|
"""Residual used when optimizing the pointing
|
64
68
|
|
65
69
|
Parameters
|
@@ -86,13 +90,13 @@ def _residual(params: Parameters,
|
|
86
90
|
refined_wcs.wcs.crpix = guess_wcs.wcs.crpix
|
87
91
|
refined_wcs.wcs.crval = (params["crval1"].value, params["crval2"].value)
|
88
92
|
refined_wcs.wcs.pc = calculate_pc_matrix(params["crota"], refined_wcs.wcs.cdelt)
|
89
|
-
refined_wcs.cpdis1 = guess_wcs.cpdis1
|
93
|
+
refined_wcs.cpdis1 = guess_wcs.cpdis1
|
90
94
|
refined_wcs.cpdis2 = guess_wcs.cpdis2
|
95
|
+
refined_wcs.wcs.set_pv(guess_wcs.wcs.get_pv())
|
91
96
|
|
92
|
-
reduced_catalog = find_catalog_in_image(catalog, refined_wcs, image_shape=image_shape)
|
97
|
+
reduced_catalog = find_catalog_in_image(catalog, refined_wcs, image_shape=image_shape, mask=mask)
|
93
98
|
refined_coords = np.stack([reduced_catalog['x_pix'], reduced_catalog['y_pix']], axis=-1)
|
94
99
|
|
95
|
-
edge = 300
|
96
100
|
image_bounds = (image_shape[0] - edge, image_shape[1] - edge)
|
97
101
|
refined_coords = np.array([c for c in refined_coords
|
98
102
|
if (c[0] > edge) and (c[1] > edge) and (c[0] < image_bounds[0]) and (c[1] < image_bounds[1])])
|
@@ -104,10 +108,9 @@ def _residual(params: Parameters,
|
|
104
108
|
"Try decreasing `num_stars` or increasing `dimmest_magnitude`.",
|
105
109
|
RepeatedStarWarning)
|
106
110
|
|
107
|
-
sigma = 3
|
108
111
|
out = np.array([np.min(np.linalg.norm(observed_coords - coord, axis=-1)) for coord in refined_coords[:n]])
|
109
|
-
|
110
|
-
out[out >
|
112
|
+
median, stdev = np.median(out), np.std(out)
|
113
|
+
out[out > median + (sigma * stdev)] = 0.0 # TODO: should this be zero?
|
111
114
|
return out
|
112
115
|
|
113
116
|
|
@@ -125,10 +128,16 @@ def refine_pointing_wrapper(image, guess_wcs, file_num, observed_coords=None, ca
|
|
125
128
|
return new_wcs, observed_coords, solution, trial_num, file_num
|
126
129
|
|
127
130
|
|
131
|
+
def extract_crota_from_wcs(wcs: WCS) -> tuple[float, float]:
|
132
|
+
"""Extract CROTA from a WCS."""
|
133
|
+
delta_ratio = wcs.wcs.cdelt[1] / wcs.wcs.cdelt[0]
|
134
|
+
return np.arctan2(wcs.wcs.pc[1, 0]/delta_ratio, wcs.wcs.pc[0, 0]) * u.rad
|
135
|
+
|
136
|
+
|
128
137
|
def refine_pointing(image, guess_wcs, observed_coords=None, catalog=None,
|
129
138
|
background_width=16, background_height=16,
|
130
139
|
detection_threshold=5, num_stars=30, max_trials=15, chisqr_threshold=0.1,
|
131
|
-
dimmest_magnitude=6.0, method='leastsq'):
|
140
|
+
dimmest_magnitude=6.0, method='leastsq', edge=100, sigma=3.0, mask=None):
|
132
141
|
""" Refine the pointing for an image
|
133
142
|
|
134
143
|
Parameters
|
@@ -159,14 +168,15 @@ def refine_pointing(image, guess_wcs, observed_coords=None, catalog=None,
|
|
159
168
|
background = sep.Background(image, bw=background_width, bh=background_height)
|
160
169
|
data_sub = image - background
|
161
170
|
objects = sep.extract(data_sub, detection_threshold, err=background.globalrms)
|
162
|
-
objects = pd.DataFrame(objects).sort_values('flux')
|
171
|
+
objects = pd.DataFrame(objects).sort_values('flux')
|
163
172
|
observed_coords = np.stack([objects["x"], objects["y"]], axis=-1)
|
164
|
-
|
173
|
+
if mask is not None:
|
174
|
+
observed_coords = observed_coords[mask(objects['x'], objects['y'])]
|
175
|
+
observed_coords = observed_coords[-3*num_stars:]
|
165
176
|
# set up the optimization
|
166
177
|
params = Parameters()
|
167
|
-
|
168
|
-
|
169
|
-
params.add("crota", value=initial_crota, min=-np.pi, max=np.pi)
|
178
|
+
initial_crota = extract_crota_from_wcs(guess_wcs)
|
179
|
+
params.add("crota", value=initial_crota.to(u.rad).value, min=-np.pi, max=np.pi)
|
170
180
|
params.add("crval1", value=guess_wcs.wcs.crval[0], min=-180, max=180, vary=True)
|
171
181
|
params.add("crval2", value=guess_wcs.wcs.crval[1], min=-90, max=90, vary=True)
|
172
182
|
|
@@ -176,7 +186,7 @@ def refine_pointing(image, guess_wcs, observed_coords=None, catalog=None,
|
|
176
186
|
while trial_num < max_trials:
|
177
187
|
try:
|
178
188
|
out = minimize(_residual, params, method=method,
|
179
|
-
args=(observed_coords, catalog, guess_wcs, num_stars, image.shape))
|
189
|
+
args=(observed_coords, catalog, guess_wcs, num_stars, image.shape, edge, sigma, mask))
|
180
190
|
chisqr = out.chisqr
|
181
191
|
result_minimizations.append(out)
|
182
192
|
except IndexError:
|
@@ -195,6 +205,7 @@ def refine_pointing(image, guess_wcs, observed_coords=None, catalog=None,
|
|
195
205
|
result_wcs.wcs.pc = calculate_pc_matrix(out.params["crota"], result_wcs.wcs.cdelt)
|
196
206
|
result_wcs.cpdis1 = guess_wcs.cpdis1 # TODO: what if there is no known distortion
|
197
207
|
result_wcs.cpdis2 = guess_wcs.cpdis2
|
208
|
+
result_wcs.wcs.set_pv(guess_wcs.wcs.get_pv())
|
198
209
|
result_wcses.append(result_wcs)
|
199
210
|
trial_num += 1
|
200
211
|
if chisqr < chisqr_threshold:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: thuban
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.4
|
4
4
|
Summary: High precision and accuracy astrometric image solving from a guess
|
5
5
|
Author-email: "J. Marcus Hughes" <hughes.jmb@gmail.com>
|
6
6
|
Maintainer-email: "J. Marcus Hughes" <hughes.jmb@gmail.com>
|
@@ -1,7 +1,24 @@
|
|
1
|
+
.gitignore
|
2
|
+
.pre-commit-config.yaml
|
3
|
+
.readthedocs.yaml
|
4
|
+
CITATION.cff
|
1
5
|
LICENSE
|
2
6
|
MANIFEST.in
|
3
7
|
README.md
|
8
|
+
codecov.yaml
|
4
9
|
pyproject.toml
|
10
|
+
.github/workflows/ci.yaml
|
11
|
+
.github/workflows/ci_fixed.yaml
|
12
|
+
.github/workflows/docs.yaml
|
13
|
+
.github/workflows/publish.yaml
|
14
|
+
docs/Makefile
|
15
|
+
docs/conf.py
|
16
|
+
docs/index.rst
|
17
|
+
docs/make.bat
|
18
|
+
docs/_static/favicon.ico
|
19
|
+
docs/_static/logo.png
|
20
|
+
scripts/prepare_reduced_hip.py
|
21
|
+
tests/__init__.py
|
5
22
|
tests/test_catalog.py
|
6
23
|
tests/test_cli.py
|
7
24
|
tests/test_distortion.py
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|