panoptes-data 0.2.0__tar.gz → 0.2.3__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.
- {panoptes_data-0.2.0 → panoptes_data-0.2.3}/PKG-INFO +57 -33
- {panoptes_data-0.2.0 → panoptes_data-0.2.3}/README.md +23 -17
- panoptes_data-0.2.3/pyproject.toml +80 -0
- {panoptes_data-0.2.0 → panoptes_data-0.2.3}/src/panoptes/data/observations.py +1 -17
- {panoptes_data-0.2.0 → panoptes_data-0.2.3}/src/panoptes/data/search.py +5 -6
- panoptes_data-0.2.3/src/panoptes/data/settings.py +45 -0
- {panoptes_data-0.2.0 → panoptes_data-0.2.3}/src/panoptes/data/utils/cli/main.py +8 -9
- panoptes_data-0.2.0/.coveragerc +0 -28
- panoptes_data-0.2.0/.github/workflows/create-release.yml +0 -50
- panoptes_data-0.2.0/.isort.cfg +0 -3
- panoptes_data-0.2.0/.pre-commit-config.yaml +0 -67
- panoptes_data-0.2.0/.readthedocs.yaml +0 -23
- panoptes_data-0.2.0/CHANGELOG.md +0 -50
- panoptes_data-0.2.0/CODE_OF_CONDUCT.md +0 -43
- panoptes_data-0.2.0/CONTRIBUTING.md +0 -371
- panoptes_data-0.2.0/docs/Makefile +0 -29
- panoptes_data-0.2.0/docs/_static/.gitignore +0 -1
- panoptes_data-0.2.0/docs/authors.md +0 -4
- panoptes_data-0.2.0/docs/changelog.md +0 -4
- panoptes_data-0.2.0/docs/conf.py +0 -302
- panoptes_data-0.2.0/docs/contributing.md +0 -4
- panoptes_data-0.2.0/docs/index.md +0 -26
- panoptes_data-0.2.0/docs/license.md +0 -5
- panoptes_data-0.2.0/docs/readme.md +0 -4
- panoptes_data-0.2.0/docs/requirements.txt +0 -7
- panoptes_data-0.2.0/environment.yaml +0 -18
- panoptes_data-0.2.0/notebooks/ObservationBasicStats.ipynb +0 -811
- panoptes_data-0.2.0/notebooks/SearchObservations.ipynb +0 -1135
- panoptes_data-0.2.0/pyproject.toml +0 -9
- panoptes_data-0.2.0/setup.cfg +0 -93
- panoptes_data-0.2.0/setup.py +0 -21
- panoptes_data-0.2.0/src/panoptes/data/images.py +0 -158
- panoptes_data-0.2.0/src/panoptes/data/settings.py +0 -29
- panoptes_data-0.2.0/src/panoptes_data.egg-info/PKG-INFO +0 -129
- panoptes_data-0.2.0/src/panoptes_data.egg-info/SOURCES.txt +0 -44
- panoptes_data-0.2.0/src/panoptes_data.egg-info/dependency_links.txt +0 -1
- panoptes_data-0.2.0/src/panoptes_data.egg-info/entry_points.txt +0 -2
- panoptes_data-0.2.0/src/panoptes_data.egg-info/not-zip-safe +0 -1
- panoptes_data-0.2.0/src/panoptes_data.egg-info/requires.txt +0 -21
- panoptes_data-0.2.0/src/panoptes_data.egg-info/top_level.txt +0 -1
- panoptes_data-0.2.0/tests/conftest.py +0 -10
- panoptes_data-0.2.0/tests/test_skeleton.py +0 -25
- panoptes_data-0.2.0/tox.ini +0 -84
- {panoptes_data-0.2.0 → panoptes_data-0.2.3}/.gitignore +0 -0
- {panoptes_data-0.2.0 → panoptes_data-0.2.3}/AUTHORS.md +0 -0
- {panoptes_data-0.2.0 → panoptes_data-0.2.3}/LICENSE.txt +0 -0
- {panoptes_data-0.2.0 → panoptes_data-0.2.3}/src/panoptes/data/__init__.py +0 -0
|
@@ -1,25 +1,47 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: panoptes-data
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Tools for working with PANOPTES data.
|
|
5
|
-
Home-page: https://github.com/panoptes/panoptes-data
|
|
6
|
-
Author: Wilfred Tyler Gee
|
|
7
|
-
Author-email: wtylergee@gmail.com
|
|
8
|
-
License: MIT
|
|
9
5
|
Project-URL: Documentation, https://projectpanoptes.org/
|
|
10
6
|
Project-URL: Source, https://github.com/panoptes/panoptes-data/
|
|
11
7
|
Project-URL: Download, https://pypi.org/project/panoptes-data/#files
|
|
12
|
-
|
|
8
|
+
Author-email: Wilfred Tyler Gee <wtylergee@gmail.com>
|
|
9
|
+
License: The MIT License (MIT)
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2022 Wilfred Tyler Gee
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
SOFTWARE.
|
|
30
|
+
License-File: AUTHORS.md
|
|
31
|
+
License-File: LICENSE.txt
|
|
32
|
+
Keywords: astronomy,data,panoptes
|
|
13
33
|
Classifier: Development Status :: 4 - Beta
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Operating System :: OS Independent
|
|
14
36
|
Classifier: Programming Language :: Python
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
37
|
+
Classifier: Programming Language :: Python :: 3
|
|
38
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
40
|
+
Requires-Python: >=3.12
|
|
18
41
|
Requires-Dist: astropy
|
|
19
42
|
Requires-Dist: numpy
|
|
20
43
|
Requires-Dist: pandas
|
|
21
44
|
Requires-Dist: panoptes-utils[images]
|
|
22
|
-
Requires-Dist: pip
|
|
23
45
|
Requires-Dist: pydantic
|
|
24
46
|
Requires-Dist: pydantic-settings
|
|
25
47
|
Requires-Dist: python-dateutil
|
|
@@ -27,11 +49,7 @@ Requires-Dist: rich[jupyter]
|
|
|
27
49
|
Requires-Dist: tabulate
|
|
28
50
|
Requires-Dist: tqdm
|
|
29
51
|
Requires-Dist: typer
|
|
30
|
-
|
|
31
|
-
Requires-Dist: setuptools; extra == "testing"
|
|
32
|
-
Requires-Dist: pytest; extra == "testing"
|
|
33
|
-
Requires-Dist: pytest-cov; extra == "testing"
|
|
34
|
-
Requires-Dist: tox; extra == "testing"
|
|
52
|
+
Description-Content-Type: text/markdown
|
|
35
53
|
|
|
36
54
|
[](https://panoptes-data.readthedocs.io/en/latest/?badge=latest)
|
|
37
55
|
|
|
@@ -49,20 +67,29 @@ pip install panoptes-data
|
|
|
49
67
|
|
|
50
68
|
## Examples
|
|
51
69
|
|
|
52
|
-
|
|
70
|
+
See the example Jupyter Notebooks in the `notebooks/` directory.
|
|
53
71
|
|
|
54
72
|
### Finding observations
|
|
55
73
|
|
|
56
74
|
```py
|
|
57
|
-
|
|
58
|
-
|
|
75
|
+
from panoptes.data.search import search_observations
|
|
76
|
+
from panoptes.data.observations import ObservationInfo
|
|
77
|
+
|
|
78
|
+
# Find some observations
|
|
79
|
+
results = search_observations(by_name='M42')
|
|
59
80
|
|
|
60
|
-
|
|
61
|
-
|
|
81
|
+
# Use last result entry to create ObservationInfo object.
|
|
82
|
+
obs_info = ObservationInfo(meta=results.iloc[0])
|
|
83
|
+
print(obs_info.meta)
|
|
84
|
+
|
|
85
|
+
# Create an ObservationInfo object directly from a sequence_id.
|
|
86
|
+
obs_info = ObservationInfo('PAN001_14d3bd_20180113T052325')
|
|
87
|
+
# But then there is no metadata:
|
|
88
|
+
print(obs_info.meta)
|
|
89
|
+
```
|
|
62
90
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
>>> obs_info.meta
|
|
91
|
+
```text
|
|
92
|
+
Sample output (truncated):
|
|
66
93
|
|
|
67
94
|
camera_id 14d3bd
|
|
68
95
|
camera_lens_serial_number HA0028608
|
|
@@ -78,13 +105,6 @@ time 2018-01-13 05:23:25+00:00
|
|
|
78
105
|
total_exptime 3360.0
|
|
79
106
|
unit_id PAN001
|
|
80
107
|
Name: 6121, dtype: object
|
|
81
|
-
|
|
82
|
-
>>> # Create an ObservationInfo object directly from a sequence_id.
|
|
83
|
-
>>> obs_info = ObservationInfo('PAN001_14d3bd_20180113T052325')
|
|
84
|
-
>>> # But then there is no metadata:
|
|
85
|
-
>>> obs_info.meta
|
|
86
|
-
|
|
87
|
-
{}
|
|
88
108
|
```
|
|
89
109
|
|
|
90
110
|
### Downloading images
|
|
@@ -92,7 +112,7 @@ Name: 6121, dtype: object
|
|
|
92
112
|
The `ObservationInfo` object makes it easy to download the files:
|
|
93
113
|
|
|
94
114
|
```py
|
|
95
|
-
|
|
115
|
+
obs_info.download_images()
|
|
96
116
|
```
|
|
97
117
|
|
|
98
118
|
### Command-line tools
|
|
@@ -102,8 +122,12 @@ There is a simple command line tool that allows for both searching and downloadi
|
|
|
102
122
|
#### Search for observations:
|
|
103
123
|
|
|
104
124
|
```bash
|
|
105
|
-
|
|
125
|
+
panoptes-data search --name M42 --min-num-images 90
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Example table output:
|
|
106
129
|
|
|
130
|
+
```text
|
|
107
131
|
| sequence_id | field_name | unit_id | coordinates_mount_ra | coordinates_mount_dec | num_images | exptime | total_exptime | time |
|
|
108
132
|
|:------------------------------|:-------------|:----------|-----------------------:|------------------------:|-------------:|----------:|----------------:|:--------------------------|
|
|
109
133
|
| PAN022_977c86_20220108T090553 | M42 | PAN022 | 83.8221 | -5.39111 | 95 | 90 | 8550 | 2022-01-08 09:05:53+00:00 |
|
|
@@ -14,20 +14,29 @@ pip install panoptes-data
|
|
|
14
14
|
|
|
15
15
|
## Examples
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
See the example Jupyter Notebooks in the `notebooks/` directory.
|
|
18
18
|
|
|
19
19
|
### Finding observations
|
|
20
20
|
|
|
21
21
|
```py
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
from panoptes.data.search import search_observations
|
|
23
|
+
from panoptes.data.observations import ObservationInfo
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
# Find some observations
|
|
26
|
+
results = search_observations(by_name='M42')
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
# Use last result entry to create ObservationInfo object.
|
|
29
|
+
obs_info = ObservationInfo(meta=results.iloc[0])
|
|
30
|
+
print(obs_info.meta)
|
|
31
|
+
|
|
32
|
+
# Create an ObservationInfo object directly from a sequence_id.
|
|
33
|
+
obs_info = ObservationInfo('PAN001_14d3bd_20180113T052325')
|
|
34
|
+
# But then there is no metadata:
|
|
35
|
+
print(obs_info.meta)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
Sample output (truncated):
|
|
31
40
|
|
|
32
41
|
camera_id 14d3bd
|
|
33
42
|
camera_lens_serial_number HA0028608
|
|
@@ -43,13 +52,6 @@ time 2018-01-13 05:23:25+00:00
|
|
|
43
52
|
total_exptime 3360.0
|
|
44
53
|
unit_id PAN001
|
|
45
54
|
Name: 6121, dtype: object
|
|
46
|
-
|
|
47
|
-
>>> # Create an ObservationInfo object directly from a sequence_id.
|
|
48
|
-
>>> obs_info = ObservationInfo('PAN001_14d3bd_20180113T052325')
|
|
49
|
-
>>> # But then there is no metadata:
|
|
50
|
-
>>> obs_info.meta
|
|
51
|
-
|
|
52
|
-
{}
|
|
53
55
|
```
|
|
54
56
|
|
|
55
57
|
### Downloading images
|
|
@@ -57,7 +59,7 @@ Name: 6121, dtype: object
|
|
|
57
59
|
The `ObservationInfo` object makes it easy to download the files:
|
|
58
60
|
|
|
59
61
|
```py
|
|
60
|
-
|
|
62
|
+
obs_info.download_images()
|
|
61
63
|
```
|
|
62
64
|
|
|
63
65
|
### Command-line tools
|
|
@@ -67,8 +69,12 @@ There is a simple command line tool that allows for both searching and downloadi
|
|
|
67
69
|
#### Search for observations:
|
|
68
70
|
|
|
69
71
|
```bash
|
|
70
|
-
|
|
72
|
+
panoptes-data search --name M42 --min-num-images 90
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Example table output:
|
|
71
76
|
|
|
77
|
+
```text
|
|
72
78
|
| sequence_id | field_name | unit_id | coordinates_mount_ra | coordinates_mount_dec | num_images | exptime | total_exptime | time |
|
|
73
79
|
|:------------------------------|:-------------|:----------|-----------------------:|------------------------:|-------------:|----------:|----------------:|:--------------------------|
|
|
74
80
|
| PAN022_977c86_20220108T090553 | M42 | PAN022 | 83.8221 | -5.39111 | 95 | 90 | 8550 | 2022-01-08 09:05:53+00:00 |
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.18", "hatch-vcs>=0.3"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "panoptes-data"
|
|
7
|
+
description = "Tools for working with PANOPTES data."
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = ">=3.12"
|
|
10
|
+
license = { file = "LICENSE.txt" }
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Wilfred Tyler Gee", email = "wtylergee@gmail.com" },
|
|
13
|
+
]
|
|
14
|
+
keywords = ["astronomy", "panoptes", "data"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Programming Language :: Python",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
]
|
|
24
|
+
dependencies = [
|
|
25
|
+
"astropy",
|
|
26
|
+
"numpy",
|
|
27
|
+
"pandas",
|
|
28
|
+
"panoptes-utils[images]",
|
|
29
|
+
"pydantic",
|
|
30
|
+
"pydantic-settings",
|
|
31
|
+
"python-dateutil",
|
|
32
|
+
"rich[jupyter]",
|
|
33
|
+
"tabulate",
|
|
34
|
+
"tqdm",
|
|
35
|
+
"typer",
|
|
36
|
+
]
|
|
37
|
+
dynamic = ["version"]
|
|
38
|
+
|
|
39
|
+
[project.urls]
|
|
40
|
+
Documentation = "https://projectpanoptes.org/"
|
|
41
|
+
Source = "https://github.com/panoptes/panoptes-data/"
|
|
42
|
+
Download = "https://pypi.org/project/panoptes-data/#files"
|
|
43
|
+
|
|
44
|
+
[project.scripts]
|
|
45
|
+
panoptes-data = "panoptes.data.utils.cli.main:app"
|
|
46
|
+
|
|
47
|
+
[tool.hatch.version]
|
|
48
|
+
source = "vcs"
|
|
49
|
+
|
|
50
|
+
[tool.hatch.build]
|
|
51
|
+
include = ["src/panoptes/**", "README.md", "LICENSE.txt"]
|
|
52
|
+
|
|
53
|
+
[tool.hatch.build.targets.wheel]
|
|
54
|
+
packages = ["src/panoptes"]
|
|
55
|
+
|
|
56
|
+
[tool.hatch.envs.default]
|
|
57
|
+
dependencies = [
|
|
58
|
+
"ruff>=0.5.0"
|
|
59
|
+
]
|
|
60
|
+
[tool.hatch.envs.default.scripts]
|
|
61
|
+
lint = "ruff check ."
|
|
62
|
+
lint-fix = "ruff check --fix ."
|
|
63
|
+
fmt = "ruff format ."
|
|
64
|
+
fmt-check = "ruff format --check ."
|
|
65
|
+
|
|
66
|
+
[tool.ruff]
|
|
67
|
+
line-length = 100
|
|
68
|
+
target-version = "py312"
|
|
69
|
+
src = ["src"]
|
|
70
|
+
|
|
71
|
+
[tool.hatch.envs.tests]
|
|
72
|
+
dependencies = [
|
|
73
|
+
"coverage>=7.0,<8.0",
|
|
74
|
+
"pytest>=7.0,<8.0",
|
|
75
|
+
"pytest-cov>=4.0,<5.0",
|
|
76
|
+
"pytest-doctestplus>=1.0,<2.0",
|
|
77
|
+
]
|
|
78
|
+
[tool.hatch.envs.tests.scripts]
|
|
79
|
+
test = "pytest"
|
|
80
|
+
test-cov = "pytest --cov=panoptes.data --cov-report term-missing --verbose"
|
|
@@ -1,35 +1,19 @@
|
|
|
1
1
|
import shutil
|
|
2
2
|
import warnings
|
|
3
|
-
from enum import IntEnum, auto
|
|
4
3
|
from pathlib import Path
|
|
5
4
|
|
|
6
5
|
import pandas as pd
|
|
7
6
|
from astropy.nddata import CCDData, Cutout2D
|
|
8
7
|
from astropy.utils.data import download_file
|
|
9
8
|
from astropy.wcs import FITSFixedWarning
|
|
10
|
-
from panoptes.utils.images import fits as fits_utils
|
|
11
9
|
from tqdm.auto import tqdm
|
|
12
10
|
|
|
13
11
|
from panoptes.data.settings import CloudSettings
|
|
12
|
+
from panoptes.utils.images import fits as fits_utils
|
|
14
13
|
|
|
15
14
|
warnings.filterwarnings('ignore', category=FITSFixedWarning)
|
|
16
15
|
|
|
17
16
|
|
|
18
|
-
class ObservationStatus(IntEnum):
|
|
19
|
-
"""The status of an observation."""
|
|
20
|
-
ERROR = auto()
|
|
21
|
-
NOT_ENOUGH_FRAMES = auto()
|
|
22
|
-
UNKNOWN = auto()
|
|
23
|
-
CREATED = auto()
|
|
24
|
-
RECEIVING = auto()
|
|
25
|
-
RECEIVED = auto()
|
|
26
|
-
PROCESSING = auto()
|
|
27
|
-
CALIBRATING = auto()
|
|
28
|
-
CALIBRATED = auto()
|
|
29
|
-
MATCHING = auto()
|
|
30
|
-
MATCHED = auto()
|
|
31
|
-
|
|
32
|
-
|
|
33
17
|
class ObservationInfo:
|
|
34
18
|
"""A container class for information about an Observation."""
|
|
35
19
|
|
|
@@ -2,17 +2,16 @@ import logging
|
|
|
2
2
|
from contextlib import suppress
|
|
3
3
|
from datetime import datetime as dt
|
|
4
4
|
|
|
5
|
-
import astropy
|
|
6
5
|
import pandas as pd
|
|
7
6
|
from astropy import units as u
|
|
8
7
|
from astropy.coordinates import SkyCoord
|
|
9
8
|
from astropy.utils.data import download_file
|
|
10
9
|
from dateutil.parser import parse as parse_date
|
|
11
|
-
from panoptes.utils.time import current_time
|
|
12
|
-
from panoptes.utils.utils import listify
|
|
13
10
|
|
|
14
11
|
from panoptes.data.observations import ObservationInfo
|
|
15
12
|
from panoptes.data.settings import CloudSettings
|
|
13
|
+
from panoptes.utils.time import current_time
|
|
14
|
+
from panoptes.utils.utils import listify
|
|
16
15
|
|
|
17
16
|
logger = logging.getLogger()
|
|
18
17
|
|
|
@@ -85,7 +84,7 @@ def search_observations(
|
|
|
85
84
|
Returns:
|
|
86
85
|
`pandas.DataFrame`: A table with the matching observation results.
|
|
87
86
|
"""
|
|
88
|
-
logger.debug(
|
|
87
|
+
logger.debug('Setting up search params')
|
|
89
88
|
|
|
90
89
|
if coords is None:
|
|
91
90
|
if by_name is not None:
|
|
@@ -118,7 +117,7 @@ def search_observations(
|
|
|
118
117
|
obs_df = source if source is not None else get_all_observations()
|
|
119
118
|
|
|
120
119
|
# Perform filtering on other fields here.
|
|
121
|
-
print(
|
|
120
|
+
print('Filtering observations')
|
|
122
121
|
query_string = (f'`{dec_col}` >= {dec_min} '
|
|
123
122
|
f'and '
|
|
124
123
|
f'`{dec_col}` <= {dec_max}'
|
|
@@ -202,7 +201,7 @@ def get_metadata(observations: pd.DataFrame) -> pd.DataFrame:
|
|
|
202
201
|
for idx, rec in observations.iterrows():
|
|
203
202
|
try:
|
|
204
203
|
dfs.append(ObservationInfo(meta=rec).image_metadata)
|
|
205
|
-
except Exception
|
|
204
|
+
except Exception:
|
|
206
205
|
pass
|
|
207
206
|
|
|
208
207
|
return pd.concat(dfs)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from enum import IntEnum, auto
|
|
2
|
+
|
|
3
|
+
from pydantic.networks import AnyHttpUrl
|
|
4
|
+
from pydantic_settings import BaseSettings
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class CloudSettings(BaseSettings):
|
|
8
|
+
img_base_url: AnyHttpUrl = 'https://storage.googleapis.com'
|
|
9
|
+
img_bucket: str = 'panoptes-images-incoming'
|
|
10
|
+
img_metadata_url: AnyHttpUrl = 'https://us-central1-project-panoptes-01.cloudfunctions.net/get-observation-info'
|
|
11
|
+
observations_url: AnyHttpUrl = 'https://storage.googleapis.com/panoptes-assets/observations.csv'
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ImageStatus(IntEnum):
|
|
15
|
+
"""The status of an image."""
|
|
16
|
+
ERROR = auto()
|
|
17
|
+
MASKED = auto()
|
|
18
|
+
UNKNOWN = auto()
|
|
19
|
+
RECEIVING = auto()
|
|
20
|
+
RECEIVED = auto()
|
|
21
|
+
UNSOLVED = auto()
|
|
22
|
+
PROCESSING = auto()
|
|
23
|
+
CALIBRATING = auto()
|
|
24
|
+
CALIBRATED = auto()
|
|
25
|
+
SOLVING = auto()
|
|
26
|
+
SOLVED = auto()
|
|
27
|
+
MATCHING = auto()
|
|
28
|
+
MATCHED = auto()
|
|
29
|
+
EXTRACTING = auto()
|
|
30
|
+
EXTRACTED = auto()
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class ObservationStatus(IntEnum):
|
|
34
|
+
"""The status of an observation."""
|
|
35
|
+
ERROR = auto()
|
|
36
|
+
NOT_ENOUGH_FRAMES = auto()
|
|
37
|
+
UNKNOWN = auto()
|
|
38
|
+
CREATED = auto()
|
|
39
|
+
RECEIVING = auto()
|
|
40
|
+
RECEIVED = auto()
|
|
41
|
+
PROCESSING = auto()
|
|
42
|
+
CALIBRATING = auto()
|
|
43
|
+
CALIBRATED = auto()
|
|
44
|
+
MATCHING = auto()
|
|
45
|
+
MATCHED = auto()
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
|
-
from typing import List, Union
|
|
3
2
|
|
|
4
3
|
import pandas as pd
|
|
5
4
|
import typer
|
|
6
5
|
from astropy.time import Time
|
|
7
|
-
from panoptes.utils.time import current_time, flatten_time
|
|
8
6
|
from rich import print
|
|
9
7
|
from tqdm import tqdm
|
|
10
8
|
|
|
11
9
|
from panoptes.data.observations import ObservationInfo
|
|
12
10
|
from panoptes.data.search import search_observations
|
|
11
|
+
from panoptes.utils.time import current_time, flatten_time
|
|
13
12
|
|
|
14
13
|
app = typer.Typer(pretty_exceptions_enable=False)
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
@app.command()
|
|
18
|
-
def download(sequence_id:
|
|
17
|
+
def download(sequence_id: str | None = typer.Argument(..., help='Sequence ID for the Observation.'),
|
|
19
18
|
output_dir: Path = typer.Option(
|
|
20
19
|
None,
|
|
21
20
|
'--output-dir', '-o',
|
|
@@ -26,7 +25,7 @@ def download(sequence_id: Union[str, None] = typer.Argument(..., help='Sequence
|
|
|
26
25
|
'--image-query', '-q',
|
|
27
26
|
help='Query for images, default \'status!="ERROR"\''
|
|
28
27
|
),
|
|
29
|
-
) ->
|
|
28
|
+
) -> list[str]:
|
|
30
29
|
"""Downloads all FITS images for the observation."""
|
|
31
30
|
local_files = list()
|
|
32
31
|
|
|
@@ -49,20 +48,20 @@ def download(sequence_id: Union[str, None] = typer.Argument(..., help='Sequence
|
|
|
49
48
|
|
|
50
49
|
@app.command()
|
|
51
50
|
def get_metadata(
|
|
52
|
-
sequence_id:
|
|
51
|
+
sequence_id: str | None = typer.Option(
|
|
53
52
|
None, '--sequence-id', '-s',
|
|
54
53
|
help='Sequence ID for the Observation.'
|
|
55
54
|
),
|
|
56
|
-
unit_id:
|
|
55
|
+
unit_id: str | None = typer.Option(
|
|
57
56
|
None, '--unit-id', '-u',
|
|
58
57
|
help='Unit ID for the Observation. '
|
|
59
58
|
'Use with a date range to download all metadata for a unit.'
|
|
60
59
|
),
|
|
61
|
-
start_date:
|
|
60
|
+
start_date: str | None = typer.Option(
|
|
62
61
|
None, '--start-date', '-s',
|
|
63
62
|
help='Start date for downloading metadata in form YYYY-MM-DD'
|
|
64
63
|
),
|
|
65
|
-
end_date:
|
|
64
|
+
end_date: str | None = typer.Option(
|
|
66
65
|
None, '--end-date', '-s',
|
|
67
66
|
help='End date for downloading metadata, defaults to now.'
|
|
68
67
|
),
|
|
@@ -115,7 +114,7 @@ def get_metadata(
|
|
|
115
114
|
try:
|
|
116
115
|
pbar.set_description(f'Getting metadata for {rec["sequence_id"]}')
|
|
117
116
|
dfs.append(ObservationInfo(meta=rec).image_metadata)
|
|
118
|
-
except Exception
|
|
117
|
+
except Exception:
|
|
119
118
|
pbar.write(f'Error in {idx} {rec["sequence_id"]}')
|
|
120
119
|
|
|
121
120
|
pd.concat(dfs).to_csv(output_fn)
|
panoptes_data-0.2.0/.coveragerc
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# .coveragerc to control coverage.py
|
|
2
|
-
[run]
|
|
3
|
-
branch = True
|
|
4
|
-
source = panoptes.data
|
|
5
|
-
# omit = bad_file.py
|
|
6
|
-
|
|
7
|
-
[paths]
|
|
8
|
-
source =
|
|
9
|
-
src/
|
|
10
|
-
*/site-packages/
|
|
11
|
-
|
|
12
|
-
[report]
|
|
13
|
-
# Regexes for lines to exclude from consideration
|
|
14
|
-
exclude_lines =
|
|
15
|
-
# Have to re-enable the standard pragma
|
|
16
|
-
pragma: no cover
|
|
17
|
-
|
|
18
|
-
# Don't complain about missing debug-only code:
|
|
19
|
-
def __repr__
|
|
20
|
-
if self\.debug
|
|
21
|
-
|
|
22
|
-
# Don't complain if tests don't hit defensive assertion code:
|
|
23
|
-
raise AssertionError
|
|
24
|
-
raise NotImplementedError
|
|
25
|
-
|
|
26
|
-
# Don't complain if non-runnable code isn't run:
|
|
27
|
-
if 0:
|
|
28
|
-
if __name__ == .__main__.:
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# This will create a release for any properly tagged branch.
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
# Sequence of patterns matched against refs/tags
|
|
5
|
-
tags:
|
|
6
|
-
- 'v[0-9].[0-9]+.[0-9]+' # Push events to matching vX.Y.Z, but not vX.Y.Zdev
|
|
7
|
-
|
|
8
|
-
name: Create GitHub Release
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
build:
|
|
12
|
-
name: Create Release
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
steps:
|
|
15
|
-
- name: Checkout code
|
|
16
|
-
uses: actions/checkout@v2
|
|
17
|
-
- name: Create Release
|
|
18
|
-
id: create_release
|
|
19
|
-
uses: actions/create-release@v1
|
|
20
|
-
env:
|
|
21
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
|
|
22
|
-
with:
|
|
23
|
-
tag_name: ${{ github.ref }}
|
|
24
|
-
release_name: Release ${{ github.ref }}
|
|
25
|
-
body: |
|
|
26
|
-
See Changelog for details
|
|
27
|
-
draft: false
|
|
28
|
-
prerelease: false
|
|
29
|
-
deploy:
|
|
30
|
-
name: Push Release to PyPi
|
|
31
|
-
runs-on: ubuntu-latest
|
|
32
|
-
steps:
|
|
33
|
-
- uses: actions/checkout@v2
|
|
34
|
-
- name: Set up Python
|
|
35
|
-
uses: actions/setup-python@v2
|
|
36
|
-
with:
|
|
37
|
-
python-version: '3.x'
|
|
38
|
-
- name: Install dependencies
|
|
39
|
-
run: |
|
|
40
|
-
python -m pip install --upgrade pip
|
|
41
|
-
pip install ".[testing]"
|
|
42
|
-
- name: tox clean and build
|
|
43
|
-
run: |
|
|
44
|
-
tox -e clean
|
|
45
|
-
tox -e build
|
|
46
|
-
- name: Publish package
|
|
47
|
-
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
|
|
48
|
-
with:
|
|
49
|
-
user: __token__
|
|
50
|
-
password: ${{ secrets.PYPI_API_TOKEN }}
|
panoptes_data-0.2.0/.isort.cfg
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
exclude: '^docs/conf.py'
|
|
2
|
-
|
|
3
|
-
repos:
|
|
4
|
-
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
5
|
-
rev: v4.4.0
|
|
6
|
-
hooks:
|
|
7
|
-
- id: trailing-whitespace
|
|
8
|
-
- id: check-added-large-files
|
|
9
|
-
- id: check-ast
|
|
10
|
-
- id: check-json
|
|
11
|
-
- id: check-merge-conflict
|
|
12
|
-
- id: check-xml
|
|
13
|
-
- id: check-yaml
|
|
14
|
-
- id: debug-statements
|
|
15
|
-
- id: end-of-file-fixer
|
|
16
|
-
- id: requirements-txt-fixer
|
|
17
|
-
- id: mixed-line-ending
|
|
18
|
-
args: ['--fix=auto'] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows
|
|
19
|
-
|
|
20
|
-
## If you want to automatically "modernize" your Python code:
|
|
21
|
-
# - repo: https://github.com/asottile/pyupgrade
|
|
22
|
-
# rev: v3.7.0
|
|
23
|
-
# hooks:
|
|
24
|
-
# - id: pyupgrade
|
|
25
|
-
# args: ['--py37-plus']
|
|
26
|
-
|
|
27
|
-
## If you want to avoid flake8 errors due to unused vars or imports:
|
|
28
|
-
# - repo: https://github.com/PyCQA/autoflake
|
|
29
|
-
# rev: v2.1.1
|
|
30
|
-
# hooks:
|
|
31
|
-
# - id: autoflake
|
|
32
|
-
# args: [
|
|
33
|
-
# --in-place,
|
|
34
|
-
# --remove-all-unused-imports,
|
|
35
|
-
# --remove-unused-variables,
|
|
36
|
-
# ]
|
|
37
|
-
|
|
38
|
-
- repo: https://github.com/PyCQA/isort
|
|
39
|
-
rev: 5.11.5
|
|
40
|
-
hooks:
|
|
41
|
-
- id: isort
|
|
42
|
-
|
|
43
|
-
- repo: https://github.com/psf/black
|
|
44
|
-
rev: stable
|
|
45
|
-
hooks:
|
|
46
|
-
- id: black
|
|
47
|
-
language_version: python3
|
|
48
|
-
|
|
49
|
-
## If like to embrace black styles even in the docs:
|
|
50
|
-
# - repo: https://github.com/asottile/blacken-docs
|
|
51
|
-
# rev: v1.13.0
|
|
52
|
-
# hooks:
|
|
53
|
-
# - id: blacken-docs
|
|
54
|
-
# additional_dependencies: [black]
|
|
55
|
-
|
|
56
|
-
- repo: https://github.com/PyCQA/flake8
|
|
57
|
-
rev: 5.0.4
|
|
58
|
-
hooks:
|
|
59
|
-
- id: flake8
|
|
60
|
-
## You can add flake8 plugins via `additional_dependencies`:
|
|
61
|
-
# additional_dependencies: [flake8-bugbear]
|
|
62
|
-
|
|
63
|
-
## Check for misspells in documentation files:
|
|
64
|
-
# - repo: https://github.com/codespell-project/codespell
|
|
65
|
-
# rev: v2.2.5
|
|
66
|
-
# hooks:
|
|
67
|
-
# - id: codespell
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
# Build documentation in the "docs/" directory with Sphinx
|
|
15
|
-
sphinx:
|
|
16
|
-
configuration: docs/conf.py
|
|
17
|
-
|
|
18
|
-
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
|
19
|
-
python:
|
|
20
|
-
install:
|
|
21
|
-
- requirements: docs/requirements.txt
|
|
22
|
-
- method: pip
|
|
23
|
-
path: .
|