thuban 0.0.3__tar.gz → 0.0.5__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.
Files changed (44) hide show
  1. thuban-0.0.5/.github/workflows/ci.yaml +45 -0
  2. thuban-0.0.5/.github/workflows/ci_fixed.yaml +46 -0
  3. thuban-0.0.5/.github/workflows/publish.yaml +37 -0
  4. thuban-0.0.5/.gitignore +160 -0
  5. thuban-0.0.5/.pre-commit-config.yaml +31 -0
  6. thuban-0.0.5/.readthedocs.yaml +33 -0
  7. thuban-0.0.5/CITATION.cff +11 -0
  8. {thuban-0.0.3 → thuban-0.0.5}/PKG-INFO +2 -1
  9. thuban-0.0.5/codecov.yaml +8 -0
  10. thuban-0.0.5/docs/Makefile +20 -0
  11. thuban-0.0.5/docs/_static/favicon.ico +0 -0
  12. thuban-0.0.5/docs/_static/logo.png +0 -0
  13. thuban-0.0.5/docs/conf.py +70 -0
  14. thuban-0.0.5/docs/index.rst +20 -0
  15. thuban-0.0.5/docs/make.bat +35 -0
  16. {thuban-0.0.3 → thuban-0.0.5}/pyproject.toml +6 -4
  17. thuban-0.0.5/scripts/prepare_reduced_hip.py +6 -0
  18. thuban-0.0.5/tests/test_visualize.py +0 -0
  19. {thuban-0.0.3 → thuban-0.0.5}/thuban/pointing.py +32 -8
  20. {thuban-0.0.3 → thuban-0.0.5}/thuban.egg-info/PKG-INFO +2 -1
  21. {thuban-0.0.3 → thuban-0.0.5}/thuban.egg-info/SOURCES.txt +16 -0
  22. {thuban-0.0.3 → thuban-0.0.5}/thuban.egg-info/requires.txt +1 -0
  23. {thuban-0.0.3 → thuban-0.0.5}/LICENSE +0 -0
  24. {thuban-0.0.3 → thuban-0.0.5}/MANIFEST.in +0 -0
  25. {thuban-0.0.3 → thuban-0.0.5}/README.md +0 -0
  26. {thuban-0.0.3 → thuban-0.0.5}/setup.cfg +0 -0
  27. /thuban-0.0.3/tests/test_cli.py → /thuban-0.0.5/tests/__init__.py +0 -0
  28. {thuban-0.0.3 → thuban-0.0.5}/tests/test_catalog.py +0 -0
  29. /thuban-0.0.3/tests/test_visualize.py → /thuban-0.0.5/tests/test_cli.py +0 -0
  30. {thuban-0.0.3 → thuban-0.0.5}/tests/test_distortion.py +0 -0
  31. {thuban-0.0.3 → thuban-0.0.5}/tests/test_pointing.py +0 -0
  32. {thuban-0.0.3 → thuban-0.0.5}/tests/test_util.py +0 -0
  33. {thuban-0.0.3 → thuban-0.0.5}/thuban/__init__.py +0 -0
  34. {thuban-0.0.3 → thuban-0.0.5}/thuban/catalog.py +0 -0
  35. {thuban-0.0.3 → thuban-0.0.5}/thuban/cli.py +0 -0
  36. {thuban-0.0.3 → thuban-0.0.5}/thuban/data/reduced_hip.csv +0 -0
  37. {thuban-0.0.3 → thuban-0.0.5}/thuban/distortion.py +0 -0
  38. {thuban-0.0.3 → thuban-0.0.5}/thuban/error.py +0 -0
  39. {thuban-0.0.3 → thuban-0.0.5}/thuban/simulate.py +0 -0
  40. {thuban-0.0.3 → thuban-0.0.5}/thuban/util.py +0 -0
  41. {thuban-0.0.3 → thuban-0.0.5}/thuban/visualize.py +0 -0
  42. {thuban-0.0.3 → thuban-0.0.5}/thuban.egg-info/dependency_links.txt +0 -0
  43. {thuban-0.0.3 → thuban-0.0.5}/thuban.egg-info/entry_points.txt +0 -0
  44. {thuban-0.0.3 → thuban-0.0.5}/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,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
@@ -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.7.3
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.2
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: v5.0.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
3
+ Version: 0.0.5
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>
@@ -38,6 +38,7 @@ Requires-Dist: sphinx-automodapi; extra == "docs"
38
38
  Requires-Dist: pydata-sphinx-theme; extra == "docs"
39
39
  Requires-Dist: sphinx-favicon; extra == "docs"
40
40
  Requires-Dist: ipython; extra == "docs"
41
+ Requires-Dist: packaging; extra == "docs"
41
42
 
42
43
  # thuban
43
44
 
@@ -0,0 +1,8 @@
1
+ coverage:
2
+ status:
3
+ patch:
4
+ default:
5
+ target: 80%
6
+ project:
7
+ default:
8
+ target: 95%
@@ -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,70 @@
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
+ from importlib.metadata import version as get_version
6
+
7
+ from packaging.version import Version
8
+
9
+ # -- Project information -----------------------------------------------------
10
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
11
+
12
+ project = "thuban"
13
+ copyright = "2024, PUNCH Science Operations Center"
14
+ author = "PUNCH Science Operations Center"
15
+
16
+ release: str = get_version("thuban")
17
+ version: str = release
18
+ _version = Version(release)
19
+ if _version.is_devrelease:
20
+ version = release = f"{_version.base_version}.dev{_version.dev}"
21
+
22
+ # -- General configuration ---------------------------------------------------
23
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
24
+
25
+ extensions = ["autoapi.extension",
26
+ "sphinx.ext.autodoc",
27
+ "sphinx.ext.napoleon",
28
+ "sphinx_favicon",
29
+ "IPython.sphinxext.ipython_console_highlighting"]
30
+
31
+ templates_path = ["_templates"]
32
+ exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
33
+
34
+
35
+ # -- Options for HTML output -------------------------------------------------
36
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
37
+
38
+ html_theme = "pydata_sphinx_theme"
39
+ html_show_sourcelink = False
40
+ html_static_path = ["_static"]
41
+ html_theme_options = {
42
+ "use_edit_page_button": True,
43
+ "icon_links": [
44
+ {
45
+ "name": "GitHub",
46
+ "url": "https://github.com/punch-mission/thuban",
47
+ "icon": "fa-brands fa-github",
48
+ "type": "fontawesome",
49
+ }
50
+ ],
51
+ "show_nav_level": 1,
52
+ "show_toc_level": 3,
53
+ "logo": {
54
+ "text": "thuban",
55
+ "image_light": "_static/logo.png",
56
+ "image_dark": "_static/logo.png",
57
+ }
58
+ }
59
+ html_context = {
60
+ # "github_url": "https://github.com", # or your GitHub Enterprise site
61
+ "github_user": "punch-mission",
62
+ "github_repo": "thuban",
63
+ "github_version": "main",
64
+ "doc_path": "docs/",
65
+ }
66
+
67
+
68
+ autoapi_dirs = ["../thuban"]
69
+
70
+ 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
- version = "0.0.3"
8
+ dynamic = ["version"]
9
9
  dependencies = ["numpy",
10
10
  "astropy",
11
11
  "matplotlib",
@@ -35,7 +35,7 @@ classifiers = [
35
35
 
36
36
  [project.optional-dependencies]
37
37
  test = ["pytest", "pytest-doctestplus", "pytest-cov", "ruff", "coverage"]
38
- docs = ["sphinx", "sphinx-autoapi", "sphinx-automodapi", "pydata-sphinx-theme", "sphinx-favicon", "ipython"]
38
+ docs = ["sphinx", "sphinx-autoapi", "sphinx-automodapi", "pydata-sphinx-theme", "sphinx-favicon", "ipython", "packaging"]
39
39
 
40
40
  [project.scripts]
41
41
  thuban = "thuban.cli:determine_pointing_and_distortion"
@@ -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,11 +1,11 @@
1
1
  import warnings
2
2
  from typing import Callable
3
3
 
4
+ import astropy.units as u
4
5
  import numpy as np
5
6
  import pandas as pd
6
7
  import sep_pjw as sep
7
8
  from astropy.wcs import WCS, utils
8
- import astropy.units as u
9
9
  from lmfit import Parameters, minimize
10
10
 
11
11
  from thuban.catalog import (filter_for_visible_stars, find_catalog_in_image,
@@ -63,6 +63,7 @@ def _residual(params: Parameters,
63
63
  image_shape: (int, int),
64
64
  edge: int = 100,
65
65
  sigma: float = 3.0,
66
+ max_error: float = 15,
66
67
  mask: Callable = None):
67
68
  """Residual used when optimizing the pointing
68
69
 
@@ -111,20 +112,23 @@ def _residual(params: Parameters,
111
112
  out = np.array([np.min(np.linalg.norm(observed_coords - coord, axis=-1)) for coord in refined_coords[:n]])
112
113
  median, stdev = np.median(out), np.std(out)
113
114
  out[out > median + (sigma * stdev)] = 0.0 # TODO: should this be zero?
115
+ out[out > max_error] = 0.0 # TODO: should this be zero?
114
116
  return out
115
117
 
116
118
 
117
119
  def refine_pointing_wrapper(image, guess_wcs, file_num, observed_coords=None, catalog=None,
118
120
  background_width=16, background_height=16,
119
121
  detection_threshold=5, num_stars=30, max_trials=15, chisqr_threshold=0.1,
120
- dimmest_magnitude=6.0, method='leastsq'):
122
+ dimmest_magnitude=6.0, method='leastsq', ra_tolerance=10, dec_tolerance=5, max_error=15):
121
123
  new_wcs, observed_coords, solution, trial_num = refine_pointing(image,
122
124
  guess_wcs,
123
125
  observed_coords=observed_coords, catalog=catalog,
124
126
  background_width=background_width, background_height=background_height,
125
127
  detection_threshold=detection_threshold, num_stars=num_stars, max_trials=max_trials,
126
128
  chisqr_threshold=chisqr_threshold,
127
- dimmest_magnitude=dimmest_magnitude, method=method)
129
+ dimmest_magnitude=dimmest_magnitude, method=method,
130
+ ra_tolerance=ra_tolerance,
131
+ dec_tolerance=dec_tolerance, max_error=max_error)
128
132
  return new_wcs, observed_coords, solution, trial_num, file_num
129
133
 
130
134
 
@@ -137,7 +141,8 @@ def extract_crota_from_wcs(wcs: WCS) -> tuple[float, float]:
137
141
  def refine_pointing(image, guess_wcs, observed_coords=None, catalog=None,
138
142
  background_width=16, background_height=16,
139
143
  detection_threshold=5, num_stars=30, max_trials=15, chisqr_threshold=0.1,
140
- dimmest_magnitude=6.0, method='leastsq', edge=100, sigma=3.0, mask=None):
144
+ dimmest_magnitude=6.0, method='leastsq', edge=100, sigma=3.0, mask=None,
145
+ ra_tolerance=10, dec_tolerance=5, max_error=15):
141
146
  """ Refine the pointing for an image
142
147
 
143
148
  Parameters
@@ -172,21 +177,40 @@ def refine_pointing(image, guess_wcs, observed_coords=None, catalog=None,
172
177
  observed_coords = np.stack([objects["x"], objects["y"]], axis=-1)
173
178
  if mask is not None:
174
179
  observed_coords = observed_coords[mask(objects['x'], objects['y'])]
180
+
181
+ image_shape = image.shape
182
+ reduced_catalog = find_catalog_in_image(catalog, guess_wcs, image_shape=image_shape, mask=mask)
183
+ refined_coords = np.stack([reduced_catalog['x_pix'], reduced_catalog['y_pix']], axis=-1)
184
+ # print("catalog found", len(refined_coords), refined_coords)
185
+
186
+ image_bounds = (image_shape[0] - edge, image_shape[1] - edge)
187
+ refined_coords = np.array([c for c in refined_coords
188
+ if (c[0] > edge) and (c[1] > edge) and (c[0] < image_bounds[0]) and (
189
+ c[1] < image_bounds[1])])
190
+
191
+ distances = np.array([np.min(np.linalg.norm(refined_coords - coord, axis=-1)) for coord in observed_coords])
192
+ observed_coords = observed_coords[distances < max_error]
175
193
  observed_coords = observed_coords[-3*num_stars:]
176
194
  # set up the optimization
177
195
  params = Parameters()
178
196
  initial_crota = extract_crota_from_wcs(guess_wcs)
179
197
  params.add("crota", value=initial_crota.to(u.rad).value, min=-np.pi, max=np.pi)
180
- params.add("crval1", value=guess_wcs.wcs.crval[0], min=-180, max=180, vary=True)
181
- params.add("crval2", value=guess_wcs.wcs.crval[1], min=-90, max=90, vary=True)
182
-
198
+ params.add("crval1", value=guess_wcs.wcs.crval[0],
199
+ min=guess_wcs.wcs.crval[0]-ra_tolerance,
200
+ max=guess_wcs.wcs.crval[0]+ra_tolerance, vary=True)
201
+ params.add("crval2", value=guess_wcs.wcs.crval[1],
202
+ min=guess_wcs.wcs.crval[1]-dec_tolerance,
203
+ max=guess_wcs.wcs.crval[1]+dec_tolerance, vary=True)
204
+
205
+ # return guess_wcs, observed_coords, None, None
183
206
  # optimize
184
207
  trial_num = 0
185
208
  result_wcses, result_minimizations = [], []
186
209
  while trial_num < max_trials:
187
210
  try:
188
211
  out = minimize(_residual, params, method=method,
189
- args=(observed_coords, catalog, guess_wcs, num_stars, image.shape, edge, sigma, mask))
212
+ args=(observed_coords, catalog, guess_wcs,
213
+ num_stars, image.shape, edge, sigma, max_error, mask))
190
214
  chisqr = out.chisqr
191
215
  result_minimizations.append(out)
192
216
  except IndexError:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: thuban
3
- Version: 0.0.3
3
+ Version: 0.0.5
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>
@@ -38,6 +38,7 @@ Requires-Dist: sphinx-automodapi; extra == "docs"
38
38
  Requires-Dist: pydata-sphinx-theme; extra == "docs"
39
39
  Requires-Dist: sphinx-favicon; extra == "docs"
40
40
  Requires-Dist: ipython; extra == "docs"
41
+ Requires-Dist: packaging; extra == "docs"
41
42
 
42
43
  # thuban
43
44
 
@@ -1,7 +1,23 @@
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/publish.yaml
13
+ docs/Makefile
14
+ docs/conf.py
15
+ docs/index.rst
16
+ docs/make.bat
17
+ docs/_static/favicon.ico
18
+ docs/_static/logo.png
19
+ scripts/prepare_reduced_hip.py
20
+ tests/__init__.py
5
21
  tests/test_catalog.py
6
22
  tests/test_cli.py
7
23
  tests/test_distortion.py
@@ -16,6 +16,7 @@ sphinx-automodapi
16
16
  pydata-sphinx-theme
17
17
  sphinx-favicon
18
18
  ipython
19
+ packaging
19
20
 
20
21
  [test]
21
22
  pytest
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