stdpipe 0.2.4__tar.gz → 0.3.0__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.
- stdpipe-0.3.0/.gitignore +88 -0
- stdpipe-0.3.0/PKG-INFO +161 -0
- stdpipe-0.3.0/pyproject.toml +275 -0
- stdpipe-0.3.0/setup.py +24 -0
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe/__init__.py +2 -0
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe/astrometry.py +30 -39
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe/catalogs.py +24 -2
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe/cutouts.py +2 -3
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe/db.py +2 -2
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe/lcs.py +0 -1
- stdpipe-0.3.0/stdpipe/photometry.py +1337 -0
- stdpipe-0.3.0/stdpipe/photometry_iraf.py +853 -0
- stdpipe-0.3.0/stdpipe/photometry_measure.py +752 -0
- stdpipe-0.3.0/stdpipe/photometry_model.py +484 -0
- stdpipe-0.3.0/stdpipe/photometry_psf.py +505 -0
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe/pipeline.py +43 -12
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe/plots.py +437 -8
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe/psf.py +127 -1
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe/resolve.py +1 -2
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe/subtraction.py +15 -1
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe/templates.py +2 -3
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe/utils.py +13 -1
- stdpipe-0.3.0/stdpipe.egg-info/PKG-INFO +161 -0
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe.egg-info/SOURCES.txt +15 -2
- stdpipe-0.3.0/stdpipe.egg-info/not-zip-safe +1 -0
- stdpipe-0.3.0/stdpipe.egg-info/requires.txt +40 -0
- stdpipe-0.3.0/tests/test_astrometry.py +184 -0
- stdpipe-0.3.0/tests/test_catalogs.py +144 -0
- stdpipe-0.3.0/tests/test_photometry.py +1147 -0
- stdpipe-0.3.0/tests/test_photometry_iraf.py +752 -0
- stdpipe-0.3.0/tests/test_photometry_measure.py +868 -0
- stdpipe-0.3.0/tests/test_photometry_model.py +42 -0
- stdpipe-0.3.0/tests/test_photometry_psf.py +687 -0
- stdpipe-0.3.0/tests/test_pipeline.py +668 -0
- stdpipe-0.3.0/tests/test_utils.py +183 -0
- stdpipe-0.2.4/.gitignore +0 -121
- stdpipe-0.2.4/PKG-INFO +0 -29
- stdpipe-0.2.4/setup.py +0 -37
- stdpipe-0.2.4/stdpipe/flycheck_catalogs.py +0 -637
- stdpipe-0.2.4/stdpipe/photometry.py +0 -1388
- stdpipe-0.2.4/stdpipe.egg-info/PKG-INFO +0 -29
- stdpipe-0.2.4/stdpipe.egg-info/requires.txt +0 -15
- stdpipe-0.2.4/tests/test_dependencies.py +0 -1
- {stdpipe-0.2.4 → stdpipe-0.3.0}/LICENSE.md +0 -0
- {stdpipe-0.2.4 → stdpipe-0.3.0}/MANIFEST.in +0 -0
- {stdpipe-0.2.4 → stdpipe-0.3.0}/README.md +0 -0
- {stdpipe-0.2.4 → stdpipe-0.3.0}/setup.cfg +0 -0
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe/data/legacysurvey.py +0 -0
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe/data/legacysurvey_bricks.fits.gz +0 -0
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe/data/ps1skycells.txt +0 -0
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe/data/ps1skycells.txt.orig +0 -0
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe.egg-info/dependency_links.txt +0 -0
- {stdpipe-0.2.4 → stdpipe-0.3.0}/stdpipe.egg-info/top_level.txt +0 -0
stdpipe-0.3.0/.gitignore
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
MANIFEST
|
|
23
|
+
|
|
24
|
+
# Virtual environments
|
|
25
|
+
venv/
|
|
26
|
+
ENV/
|
|
27
|
+
env/
|
|
28
|
+
.venv
|
|
29
|
+
|
|
30
|
+
# IDEs
|
|
31
|
+
.vscode/
|
|
32
|
+
.idea/
|
|
33
|
+
*.swp
|
|
34
|
+
*.swo
|
|
35
|
+
*~
|
|
36
|
+
.dir-locals.el
|
|
37
|
+
flycheck_*.py
|
|
38
|
+
*#
|
|
39
|
+
|
|
40
|
+
# Testing
|
|
41
|
+
.pytest_cache/
|
|
42
|
+
.coverage
|
|
43
|
+
.coverage.*
|
|
44
|
+
htmlcov/
|
|
45
|
+
.tox/
|
|
46
|
+
.hypothesis/
|
|
47
|
+
*.cover
|
|
48
|
+
.cache
|
|
49
|
+
nosetests.xml
|
|
50
|
+
coverage.xml
|
|
51
|
+
*.log
|
|
52
|
+
|
|
53
|
+
# Documentation
|
|
54
|
+
docs/_build/
|
|
55
|
+
docs/_static/
|
|
56
|
+
docs/_templates/
|
|
57
|
+
doc/_build/
|
|
58
|
+
doc/api/
|
|
59
|
+
.readthedocs.yaml.1
|
|
60
|
+
|
|
61
|
+
# Jupyter
|
|
62
|
+
.ipynb_checkpoints/
|
|
63
|
+
notebooks/Untitled*.ipynb
|
|
64
|
+
|
|
65
|
+
# OS
|
|
66
|
+
.DS_Store
|
|
67
|
+
.Rhistory
|
|
68
|
+
.RData
|
|
69
|
+
|
|
70
|
+
# Build and distribution
|
|
71
|
+
*.tar.gz
|
|
72
|
+
*.whl
|
|
73
|
+
|
|
74
|
+
# Aider
|
|
75
|
+
.aider*
|
|
76
|
+
|
|
77
|
+
# Temporary files
|
|
78
|
+
backup/
|
|
79
|
+
*.tmp
|
|
80
|
+
*.bak
|
|
81
|
+
*~
|
|
82
|
+
|
|
83
|
+
# Misc files
|
|
84
|
+
*.new
|
|
85
|
+
*.orig
|
|
86
|
+
|
|
87
|
+
test_data/
|
|
88
|
+
pyraf/
|
stdpipe-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stdpipe
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Simple Transient Detection Pipeline
|
|
5
|
+
Author-email: Sergey Karpov <karpov.sv@gmail.com>
|
|
6
|
+
Maintainer-email: Sergey Karpov <karpov.sv@gmail.com>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2022 Sergey Karpov
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
Project-URL: Homepage, https://github.com/karpov-sv/stdpipe
|
|
30
|
+
Project-URL: Documentation, https://stdpipe.readthedocs.io/
|
|
31
|
+
Project-URL: Repository, https://github.com/karpov-sv/stdpipe
|
|
32
|
+
Project-URL: Bug Tracker, https://github.com/karpov-sv/stdpipe/issues
|
|
33
|
+
Project-URL: Changelog, https://github.com/karpov-sv/stdpipe/commits/master
|
|
34
|
+
Keywords: astronomy,astrophysics,transients,photometry,astrometry,image-processing,pipeline
|
|
35
|
+
Classifier: Development Status :: 4 - Beta
|
|
36
|
+
Classifier: Intended Audience :: Science/Research
|
|
37
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
38
|
+
Classifier: Operating System :: OS Independent
|
|
39
|
+
Classifier: Programming Language :: Python :: 3
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
42
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
43
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
44
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
45
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
46
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
47
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
48
|
+
Requires-Python: >=3.8
|
|
49
|
+
Description-Content-Type: text/markdown
|
|
50
|
+
License-File: LICENSE.md
|
|
51
|
+
Requires-Dist: numpy
|
|
52
|
+
Requires-Dist: scipy
|
|
53
|
+
Requires-Dist: astropy>=4.1
|
|
54
|
+
Requires-Dist: matplotlib
|
|
55
|
+
Requires-Dist: astroquery>0.4.1
|
|
56
|
+
Requires-Dist: sep
|
|
57
|
+
Requires-Dist: astroscrappy
|
|
58
|
+
Requires-Dist: photutils>=2.2
|
|
59
|
+
Requires-Dist: scikit-image
|
|
60
|
+
Requires-Dist: statsmodels
|
|
61
|
+
Requires-Dist: tqdm
|
|
62
|
+
Requires-Dist: regions
|
|
63
|
+
Requires-Dist: python-dateutil
|
|
64
|
+
Requires-Dist: requests
|
|
65
|
+
Requires-Dist: sip_tpv
|
|
66
|
+
Requires-Dist: pyfftw
|
|
67
|
+
Provides-Extra: dev
|
|
68
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
|
69
|
+
Requires-Dist: pytest-cov>=2.10; extra == "dev"
|
|
70
|
+
Requires-Dist: pytest-xdist>=2.0; extra == "dev"
|
|
71
|
+
Requires-Dist: pytest-mock>=3.0; extra == "dev"
|
|
72
|
+
Requires-Dist: pytest-timeout>=2.0; extra == "dev"
|
|
73
|
+
Requires-Dist: pytest-benchmark>=3.4; extra == "dev"
|
|
74
|
+
Requires-Dist: hypothesis>=6.0; extra == "dev"
|
|
75
|
+
Provides-Extra: docs
|
|
76
|
+
Requires-Dist: sphinx>=4.0; extra == "docs"
|
|
77
|
+
Requires-Dist: sphinx-rtd-theme; extra == "docs"
|
|
78
|
+
Requires-Dist: sphinx-math-dollar; extra == "docs"
|
|
79
|
+
Requires-Dist: numpydoc; extra == "docs"
|
|
80
|
+
Requires-Dist: myst-parser; extra == "docs"
|
|
81
|
+
Requires-Dist: sphinxcontrib-apidoc; extra == "docs"
|
|
82
|
+
Requires-Dist: sphinx-prompt; extra == "docs"
|
|
83
|
+
Provides-Extra: adaptive
|
|
84
|
+
Requires-Dist: powerbin; extra == "adaptive"
|
|
85
|
+
Provides-Extra: all
|
|
86
|
+
Requires-Dist: stdpipe[adaptive,dev,docs]; extra == "all"
|
|
87
|
+
Dynamic: license-file
|
|
88
|
+
|
|
89
|
+
# STDPipe - Simple Transient Detection Pipeline
|
|
90
|
+
*AKA: random codes noone else will ever use*
|
|
91
|
+
|
|
92
|
+
*STDPipe* is a set of Python routines for astrometry, photometry and transient detection related tasks, intended for quick and easy implementation of custom pipelines, as well as for interactive data analysis.
|
|
93
|
+
|
|
94
|
+
### Design principles
|
|
95
|
+
- implemented as a library of routines covering most common tasks
|
|
96
|
+
- operates on standard Python objects: NumPy arrays for images, Astropy Tables for catalogs and object lists, etc
|
|
97
|
+
- does not try to re-implement the things already implemented in other Python packages
|
|
98
|
+
- conveniently wraps external codes that do not have their own Python interfaces (*SExtractor*, *SCAMP*, *PSFEx*, *HOTPANTS*, *Astrometry.Net*, ...)
|
|
99
|
+
- wrapping is transparent: all data passed from Python, all options customizable from Python, all (or most of) outputs available back
|
|
100
|
+
- everything operates on temporary files, nothing is kept after the run unless explicitly asked for
|
|
101
|
+
|
|
102
|
+
### Features
|
|
103
|
+
- ~~pre-processing~~ - should be handled before in an instrument-specific way
|
|
104
|
+
- bias/dark subtraction, flatfielding, masking
|
|
105
|
+
- object detection and photometry
|
|
106
|
+
- SExtractor or SEP for detection, photutils for photometry
|
|
107
|
+
- astrometric calibration
|
|
108
|
+
- Astrometry.Net for blind WCS solving
|
|
109
|
+
- SCAMP or Astropy-based code for refinement
|
|
110
|
+
- photometric calibration
|
|
111
|
+
- Vizier catalogues, passband conversion (PS1 to Johnson, Gaia to Johnson, ...)
|
|
112
|
+
- spatial polynomial + color term + intrinsic scatter
|
|
113
|
+
- image subtraction
|
|
114
|
+
- HiPS templates
|
|
115
|
+
- PanSTARRS DR1 or Legacy Survey templates
|
|
116
|
+
- HOTPANTS + custom noise model
|
|
117
|
+
- ZOGY
|
|
118
|
+
- transient detection and photometry
|
|
119
|
+
- noise-weighted detection, cutout adjustment, ...
|
|
120
|
+
- auxiliary functions
|
|
121
|
+
- PSF estimation, simulated stars, FITS header utilities, plotting, ...
|
|
122
|
+
- light curve creation (soon)
|
|
123
|
+
- spatial clustering, color regression, variability analysis, ...
|
|
124
|
+
|
|
125
|
+
# Installation
|
|
126
|
+
|
|
127
|
+
*STDpipe* is available at https://github.com/karpov-sv/stdpipe and is mirrored at https://gitlab.in2p3.fr/icare/stdpipe
|
|
128
|
+
|
|
129
|
+
The package is in constant development, so to keep track of the changes the suggested way of installing it is by cloning the repository
|
|
130
|
+
```
|
|
131
|
+
git clone https://github.com/karpov-sv/stdpipe.git
|
|
132
|
+
```
|
|
133
|
+
and then installing from it in development (or "editable") mode by running the command
|
|
134
|
+
```
|
|
135
|
+
cd stdpipe
|
|
136
|
+
python3 -m pip install -e .
|
|
137
|
+
```
|
|
138
|
+
This way you may update the repository or apply local patches, and it will immediately be reflected in the installed package.
|
|
139
|
+
|
|
140
|
+
Apart of Python requirements that will be installed automatically, *STDPipe* also (optionally) makes use of the following external software:
|
|
141
|
+
- [SExtractor](https://github.com/astromatic/sextractor)
|
|
142
|
+
- [SCAMP](https://github.com/astromatic/scamp)
|
|
143
|
+
- [PSFEx](https://github.com/astromatic/psfex)
|
|
144
|
+
- [SWarp](https://github.com/astromatic/swarp)
|
|
145
|
+
- [HOTPANTS](https://github.com/acbecker/hotpants)
|
|
146
|
+
- [Astrometry.Net](https://github.com/dstndstn/astrometry.net)
|
|
147
|
+
|
|
148
|
+
Most of them may be installed from your package manager. E.g. on Debian or Ubuntu systems it may look like that:
|
|
149
|
+
```
|
|
150
|
+
sudo apt install sextractor scamp psfex swarp
|
|
151
|
+
```
|
|
152
|
+
or, on Miniconda/Anaconda, like that:
|
|
153
|
+
```
|
|
154
|
+
conda install -c conda-forge astromatic-source-extractor astromatic-scamp astromatic-psfex astromatic-swarp
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
You may also check more detailed installation instructions [here](https://stdpipe.readthedocs.io/en/latest/installation.html).
|
|
158
|
+
|
|
159
|
+
# Usage
|
|
160
|
+
|
|
161
|
+
Please consult the [documentation for *STDPipe*](https://stdpipe.readthedocs.io/) for the basic usage patterns and description of its API. You may check the examples inside [notebooks/](notebooks/) folder, especially the [tutorial](notebooks/stdpipe_tutorial.ipynb) that demonstrates basic steps of a typical image processing.
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "stdpipe"
|
|
7
|
+
version = "0.3.0"
|
|
8
|
+
description = "Simple Transient Detection Pipeline"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {file = "LICENSE.md"}
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "Sergey Karpov", email = "karpov.sv@gmail.com"}
|
|
13
|
+
]
|
|
14
|
+
maintainers = [
|
|
15
|
+
{name = "Sergey Karpov", email = "karpov.sv@gmail.com"}
|
|
16
|
+
]
|
|
17
|
+
keywords = [
|
|
18
|
+
"astronomy",
|
|
19
|
+
"astrophysics",
|
|
20
|
+
"transients",
|
|
21
|
+
"photometry",
|
|
22
|
+
"astrometry",
|
|
23
|
+
"image-processing",
|
|
24
|
+
"pipeline"
|
|
25
|
+
]
|
|
26
|
+
classifiers = [
|
|
27
|
+
"Development Status :: 4 - Beta",
|
|
28
|
+
"Intended Audience :: Science/Research",
|
|
29
|
+
"License :: OSI Approved :: MIT License",
|
|
30
|
+
"Operating System :: OS Independent",
|
|
31
|
+
"Programming Language :: Python :: 3",
|
|
32
|
+
"Programming Language :: Python :: 3.8",
|
|
33
|
+
"Programming Language :: Python :: 3.9",
|
|
34
|
+
"Programming Language :: Python :: 3.10",
|
|
35
|
+
"Programming Language :: Python :: 3.11",
|
|
36
|
+
"Programming Language :: Python :: 3.12",
|
|
37
|
+
"Programming Language :: Python :: 3.13",
|
|
38
|
+
"Topic :: Scientific/Engineering :: Astronomy",
|
|
39
|
+
"Topic :: Scientific/Engineering :: Image Processing",
|
|
40
|
+
]
|
|
41
|
+
requires-python = ">=3.8"
|
|
42
|
+
|
|
43
|
+
# Core dependencies
|
|
44
|
+
dependencies = [
|
|
45
|
+
"numpy",
|
|
46
|
+
"scipy",
|
|
47
|
+
"astropy>=4.1",
|
|
48
|
+
"matplotlib",
|
|
49
|
+
"astroquery>0.4.1",
|
|
50
|
+
"sep",
|
|
51
|
+
"astroscrappy",
|
|
52
|
+
"photutils>=2.2",
|
|
53
|
+
"scikit-image",
|
|
54
|
+
"statsmodels",
|
|
55
|
+
"tqdm",
|
|
56
|
+
"regions",
|
|
57
|
+
"python-dateutil",
|
|
58
|
+
"requests",
|
|
59
|
+
# "sip_tpv @ git+https://github.com/pmvreeswijk/sip_tpv.git",
|
|
60
|
+
"sip_tpv",
|
|
61
|
+
"pyfftw",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
[project.optional-dependencies]
|
|
65
|
+
# Development dependencies
|
|
66
|
+
dev = [
|
|
67
|
+
"pytest>=6.0",
|
|
68
|
+
"pytest-cov>=2.10",
|
|
69
|
+
"pytest-xdist>=2.0",
|
|
70
|
+
"pytest-mock>=3.0",
|
|
71
|
+
"pytest-timeout>=2.0",
|
|
72
|
+
"pytest-benchmark>=3.4",
|
|
73
|
+
"hypothesis>=6.0",
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
# Documentation dependencies
|
|
77
|
+
docs = [
|
|
78
|
+
"sphinx>=4.0",
|
|
79
|
+
"sphinx-rtd-theme",
|
|
80
|
+
"sphinx-math-dollar",
|
|
81
|
+
"numpydoc",
|
|
82
|
+
"myst-parser",
|
|
83
|
+
"sphinxcontrib-apidoc",
|
|
84
|
+
"sphinx-prompt",
|
|
85
|
+
]
|
|
86
|
+
|
|
87
|
+
# Adaptive binning (Voronoi tessellation)
|
|
88
|
+
adaptive = [
|
|
89
|
+
"powerbin",
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
# All optional dependencies
|
|
93
|
+
all = [
|
|
94
|
+
"stdpipe[dev,docs,adaptive]",
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
[project.urls]
|
|
98
|
+
Homepage = "https://github.com/karpov-sv/stdpipe"
|
|
99
|
+
Documentation = "https://stdpipe.readthedocs.io/"
|
|
100
|
+
Repository = "https://github.com/karpov-sv/stdpipe"
|
|
101
|
+
"Bug Tracker" = "https://github.com/karpov-sv/stdpipe/issues"
|
|
102
|
+
Changelog = "https://github.com/karpov-sv/stdpipe/commits/master"
|
|
103
|
+
|
|
104
|
+
# ============================================================================
|
|
105
|
+
# Tool configurations
|
|
106
|
+
# ============================================================================
|
|
107
|
+
|
|
108
|
+
[tool.setuptools]
|
|
109
|
+
zip-safe = false
|
|
110
|
+
include-package-data = true
|
|
111
|
+
|
|
112
|
+
[tool.setuptools.packages.find]
|
|
113
|
+
where = ["."]
|
|
114
|
+
include = ["stdpipe*"]
|
|
115
|
+
exclude = ["tests*", "docs*", "notebooks*", "build*", "dist*"]
|
|
116
|
+
|
|
117
|
+
[tool.setuptools.package-data]
|
|
118
|
+
stdpipe = ["data/*"]
|
|
119
|
+
|
|
120
|
+
# ============================================================================
|
|
121
|
+
# pytest configuration
|
|
122
|
+
# ============================================================================
|
|
123
|
+
|
|
124
|
+
[tool.pytest.ini_options]
|
|
125
|
+
minversion = "6.0"
|
|
126
|
+
testpaths = ["tests"]
|
|
127
|
+
python_files = ["test_*.py"]
|
|
128
|
+
python_classes = ["Test*"]
|
|
129
|
+
python_functions = ["test_*"]
|
|
130
|
+
addopts = [
|
|
131
|
+
"-v",
|
|
132
|
+
"--strict-markers",
|
|
133
|
+
"--showlocals",
|
|
134
|
+
"-ra",
|
|
135
|
+
]
|
|
136
|
+
markers = [
|
|
137
|
+
"unit: Unit tests that don't require external dependencies",
|
|
138
|
+
"integration: Integration tests that may require external tools",
|
|
139
|
+
"slow: Tests that take significant time to run",
|
|
140
|
+
"requires_sextractor: Tests requiring SExtractor to be installed",
|
|
141
|
+
"requires_scamp: Tests requiring SCAMP to be installed",
|
|
142
|
+
"requires_psfex: Tests requiring PSFEx to be installed",
|
|
143
|
+
"requires_hotpants: Tests requiring HOTPANTS to be installed",
|
|
144
|
+
"requires_astrometry_net: Tests requiring Astrometry.Net to be installed",
|
|
145
|
+
"requires_pyraf: Tests requiring PyRAF/IRAF to be installed",
|
|
146
|
+
"requires_network: Tests that require network access",
|
|
147
|
+
]
|
|
148
|
+
filterwarnings = [
|
|
149
|
+
"ignore::FutureWarning",
|
|
150
|
+
"ignore::DeprecationWarning:astropy.*",
|
|
151
|
+
"ignore::astropy.wcs.FITSFixedWarning",
|
|
152
|
+
]
|
|
153
|
+
|
|
154
|
+
# ============================================================================
|
|
155
|
+
# coverage configuration
|
|
156
|
+
# ============================================================================
|
|
157
|
+
|
|
158
|
+
[tool.coverage.run]
|
|
159
|
+
source = ["stdpipe"]
|
|
160
|
+
omit = [
|
|
161
|
+
"*/tests/*",
|
|
162
|
+
"*/test_*.py",
|
|
163
|
+
"setup.py",
|
|
164
|
+
"*/flycheck_*.py",
|
|
165
|
+
]
|
|
166
|
+
parallel = true
|
|
167
|
+
branch = true
|
|
168
|
+
|
|
169
|
+
[tool.coverage.report]
|
|
170
|
+
precision = 2
|
|
171
|
+
show_missing = true
|
|
172
|
+
skip_covered = false
|
|
173
|
+
exclude_lines = [
|
|
174
|
+
"pragma: no cover",
|
|
175
|
+
"def __repr__",
|
|
176
|
+
"raise AssertionError",
|
|
177
|
+
"raise NotImplementedError",
|
|
178
|
+
"if __name__ == .__main__.:",
|
|
179
|
+
"if TYPE_CHECKING:",
|
|
180
|
+
"class .*\\bProtocol\\):",
|
|
181
|
+
"@(abc\\.)?abstractmethod",
|
|
182
|
+
]
|
|
183
|
+
|
|
184
|
+
[tool.coverage.html]
|
|
185
|
+
directory = "htmlcov"
|
|
186
|
+
|
|
187
|
+
# ============================================================================
|
|
188
|
+
# Black code formatter
|
|
189
|
+
# ============================================================================
|
|
190
|
+
|
|
191
|
+
[tool.black]
|
|
192
|
+
line-length = 100
|
|
193
|
+
target-version = ["py38", "py39", "py310", "py311", "py312"]
|
|
194
|
+
include = '\.pyi?$'
|
|
195
|
+
extend-exclude = '''
|
|
196
|
+
/(
|
|
197
|
+
\.git
|
|
198
|
+
| \.venv
|
|
199
|
+
| build
|
|
200
|
+
| dist
|
|
201
|
+
| __pycache__
|
|
202
|
+
| \.pytest_cache
|
|
203
|
+
| \.eggs
|
|
204
|
+
)/
|
|
205
|
+
'''
|
|
206
|
+
|
|
207
|
+
# ============================================================================
|
|
208
|
+
# isort import sorter
|
|
209
|
+
# ============================================================================
|
|
210
|
+
|
|
211
|
+
[tool.isort]
|
|
212
|
+
profile = "black"
|
|
213
|
+
line_length = 100
|
|
214
|
+
multi_line_output = 3
|
|
215
|
+
include_trailing_comma = true
|
|
216
|
+
force_grid_wrap = 0
|
|
217
|
+
use_parentheses = true
|
|
218
|
+
ensure_newline_before_comments = true
|
|
219
|
+
skip_glob = ["*/flycheck_*.py"]
|
|
220
|
+
|
|
221
|
+
# ============================================================================
|
|
222
|
+
# ruff linter (modern alternative to flake8)
|
|
223
|
+
# ============================================================================
|
|
224
|
+
|
|
225
|
+
[tool.ruff]
|
|
226
|
+
line-length = 100
|
|
227
|
+
target-version = "py38"
|
|
228
|
+
extend-exclude = [
|
|
229
|
+
"flycheck_*.py",
|
|
230
|
+
"__pycache__",
|
|
231
|
+
".pytest_cache",
|
|
232
|
+
"build",
|
|
233
|
+
"dist",
|
|
234
|
+
]
|
|
235
|
+
|
|
236
|
+
[tool.ruff.lint]
|
|
237
|
+
select = [
|
|
238
|
+
"E", # pycodestyle errors
|
|
239
|
+
"W", # pycodestyle warnings
|
|
240
|
+
"F", # pyflakes
|
|
241
|
+
"I", # isort
|
|
242
|
+
"N", # pep8-naming
|
|
243
|
+
"UP", # pyupgrade
|
|
244
|
+
"B", # flake8-bugbear
|
|
245
|
+
"C4", # flake8-comprehensions
|
|
246
|
+
"SIM", # flake8-simplify
|
|
247
|
+
]
|
|
248
|
+
ignore = [
|
|
249
|
+
"E501", # line too long (handled by black)
|
|
250
|
+
"B008", # do not perform function calls in argument defaults
|
|
251
|
+
"C901", # function is too complex
|
|
252
|
+
"N803", # argument name should be lowercase (conflicts with astronomical conventions)
|
|
253
|
+
"N806", # variable in function should be lowercase (conflicts with astronomical conventions)
|
|
254
|
+
]
|
|
255
|
+
|
|
256
|
+
[tool.ruff.lint.per-file-ignores]
|
|
257
|
+
"__init__.py" = ["F401"] # Unused imports in __init__.py
|
|
258
|
+
"tests/*" = ["F401", "F811"] # Unused imports and redefinitions in tests
|
|
259
|
+
|
|
260
|
+
# ============================================================================
|
|
261
|
+
# mypy type checker
|
|
262
|
+
# ============================================================================
|
|
263
|
+
|
|
264
|
+
[tool.mypy]
|
|
265
|
+
python_version = "3.8"
|
|
266
|
+
warn_return_any = true
|
|
267
|
+
warn_unused_configs = true
|
|
268
|
+
disallow_untyped_defs = false # Start lenient, can tighten later
|
|
269
|
+
ignore_missing_imports = true
|
|
270
|
+
exclude = [
|
|
271
|
+
"tests/",
|
|
272
|
+
"docs/",
|
|
273
|
+
"build/",
|
|
274
|
+
"dist/",
|
|
275
|
+
]
|
stdpipe-0.3.0/setup.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
Minimal setup.py for backward compatibility.
|
|
5
|
+
|
|
6
|
+
Modern configuration is in pyproject.toml.
|
|
7
|
+
This file is kept for backward compatibility with older pip versions
|
|
8
|
+
and tools that don't yet support PEP 517/518.
|
|
9
|
+
|
|
10
|
+
For development installation:
|
|
11
|
+
pip install -e .
|
|
12
|
+
|
|
13
|
+
For installation with optional dependencies:
|
|
14
|
+
pip install -e ".[dev]"
|
|
15
|
+
pip install -e ".[docs]"
|
|
16
|
+
pip install -e ".[all]"
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from setuptools import setup
|
|
20
|
+
|
|
21
|
+
# All configuration is in pyproject.toml
|
|
22
|
+
# This setup.py is just for backward compatibility
|
|
23
|
+
if __name__ == "__main__":
|
|
24
|
+
setup()
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from __future__ import absolute_import, division, print_function, unicode_literals
|
|
2
1
|
|
|
3
2
|
import os, tempfile, shutil, shlex, re, warnings
|
|
4
3
|
import numpy as np
|
|
@@ -123,11 +122,11 @@ def spherical_match(ra1, dec1, ra2, dec2, sr=1 / 3600):
|
|
|
123
122
|
|
|
124
123
|
"""
|
|
125
124
|
|
|
126
|
-
# Ensure that inputs are arrays
|
|
127
|
-
ra1 = np.atleast_1d(ra1)
|
|
128
|
-
dec1 = np.atleast_1d(dec1)
|
|
129
|
-
ra2 = np.atleast_1d(ra2)
|
|
130
|
-
dec2 = np.atleast_1d(dec2)
|
|
125
|
+
# Ensure that inputs are arrays, and drop units if any
|
|
126
|
+
ra1 = np.array(np.atleast_1d(ra1))
|
|
127
|
+
dec1 = np.array(np.atleast_1d(dec1))
|
|
128
|
+
ra2 = np.array(np.atleast_1d(ra2))
|
|
129
|
+
dec2 = np.array(np.atleast_1d(dec2))
|
|
131
130
|
|
|
132
131
|
idx1, idx2, dist, _ = search_around_sky(
|
|
133
132
|
SkyCoord(ra1, dec1, unit='deg'), SkyCoord(ra2, dec2, unit='deg'), sr * u.deg
|
|
@@ -299,6 +298,7 @@ def blind_match_objects(
|
|
|
299
298
|
'sort-column': 'FLUX',
|
|
300
299
|
'width': width,
|
|
301
300
|
'height': height,
|
|
301
|
+
'crpix-center': True,
|
|
302
302
|
#
|
|
303
303
|
'overwrite': True,
|
|
304
304
|
'no-plots': True,
|
|
@@ -309,7 +309,7 @@ def blind_match_objects(
|
|
|
309
309
|
if config is not None:
|
|
310
310
|
opts['config'] = config
|
|
311
311
|
|
|
312
|
-
if order is not None:
|
|
312
|
+
if order is not None and order > 0:
|
|
313
313
|
opts['tweak-order'] = order
|
|
314
314
|
else:
|
|
315
315
|
opts['no-tweak'] = True
|
|
@@ -330,52 +330,43 @@ def blind_match_objects(
|
|
|
330
330
|
|
|
331
331
|
opts.update(extra)
|
|
332
332
|
|
|
333
|
-
# Build the command line
|
|
334
|
-
command = binname + ' ' + shlex.quote(objname) + ' ' + utils.format_long_opts(opts)
|
|
335
|
-
if not verbose:
|
|
336
|
-
command += ' > /dev/null 2>/dev/null'
|
|
337
|
-
log('Will run first iteration of Astrometry.Net like that:')
|
|
338
|
-
log(command)
|
|
339
|
-
|
|
340
|
-
res = os.system(command)
|
|
341
|
-
|
|
342
333
|
wcs = None
|
|
343
|
-
if res == 0 and os.path.exists(wcsname):
|
|
344
|
-
log('Successfully run first iteration')
|
|
345
|
-
shutil.move(wcsname, tmpname)
|
|
346
334
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
335
|
+
for iter in range(2):
|
|
336
|
+
if os.path.exists(wcsname):
|
|
337
|
+
shutil.move(wcsname, tmpname)
|
|
338
|
+
opts['verify'] = tmpname
|
|
339
|
+
|
|
340
|
+
# Build the command line
|
|
341
|
+
command = binname + ' ' + shlex.quote(objname) + ' ' + utils.format_long_opts(opts)
|
|
351
342
|
if not verbose:
|
|
352
343
|
command += ' > /dev/null 2>/dev/null'
|
|
353
|
-
log('Will run
|
|
344
|
+
log('Will run iteration %d of Astrometry.Net like that:' % (iter,))
|
|
354
345
|
log(command)
|
|
355
346
|
|
|
356
347
|
res = os.system(command)
|
|
357
348
|
|
|
358
349
|
if res == 0 and os.path.exists(wcsname):
|
|
359
|
-
log('Successfully run
|
|
360
|
-
header = fits.getheader(wcsname)
|
|
361
|
-
wcs = WCS(header)
|
|
350
|
+
log('Successfully run iteration %d' % (iter,))
|
|
362
351
|
|
|
363
|
-
|
|
364
|
-
|
|
352
|
+
else:
|
|
353
|
+
log('Error %s running Astrometry.Net' % res)
|
|
365
354
|
|
|
366
|
-
log(
|
|
367
|
-
'Got WCS solution with center at %.4f %.4f radius %.2f deg and pixel scale %.2f arcsec/pix'
|
|
368
|
-
% (ra0, dec0, sr0, pixscale * 3600)
|
|
369
|
-
)
|
|
370
355
|
|
|
371
|
-
|
|
372
|
-
|
|
356
|
+
if res == 0 and os.path.exists(wcsname):
|
|
357
|
+
header = fits.getheader(wcsname)
|
|
358
|
+
wcs = WCS(header)
|
|
373
359
|
|
|
374
|
-
|
|
375
|
-
|
|
360
|
+
ra0, dec0, sr0 = get_frame_center(wcs=wcs, width=width, height=height)
|
|
361
|
+
pixscale = get_pixscale(wcs=wcs)
|
|
376
362
|
|
|
377
|
-
|
|
378
|
-
|
|
363
|
+
log(
|
|
364
|
+
'Got WCS solution with center at %.4f %.4f radius %.2f deg and pixel scale %.2f arcsec/pix'
|
|
365
|
+
% (ra0, dec0, sr0, pixscale * 3600)
|
|
366
|
+
)
|
|
367
|
+
|
|
368
|
+
if update and wcs:
|
|
369
|
+
obj['ra'], obj['dec'] = wcs.all_pix2world(obj['x'], obj['y'], 0)
|
|
379
370
|
|
|
380
371
|
if _workdir is None:
|
|
381
372
|
shutil.rmtree(workdir)
|