wintertoo 0.3.6__tar.gz → 0.3.8__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.
Potentially problematic release.
This version of wintertoo might be problematic. Click here for more details.
- wintertoo-0.3.8/.github/workflows/black.yml +25 -0
- wintertoo-0.3.8/.github/workflows/continuous_integration.yml +77 -0
- wintertoo-0.3.8/.github/workflows/isort.yml +21 -0
- wintertoo-0.3.8/.github/workflows/pylint.yml +24 -0
- wintertoo-0.3.8/.gitignore +20 -0
- wintertoo-0.3.8/.pre-commit-config.yaml +33 -0
- {wintertoo-0.3.6 → wintertoo-0.3.8}/PKG-INFO +29 -23
- {wintertoo-0.3.6 → wintertoo-0.3.8}/README.md +13 -0
- wintertoo-0.3.8/pyproject.toml +98 -0
- wintertoo-0.3.8/setup.cfg +4 -0
- wintertoo-0.3.8/tests/test_fields.py +58 -0
- wintertoo-0.3.8/tests/test_schedule.py +124 -0
- wintertoo-0.3.8/tests/testdata/test_schedule.json +1 -0
- {wintertoo-0.3.6 → wintertoo-0.3.8}/wintertoo/schedule.py +2 -2
- {wintertoo-0.3.6 → wintertoo-0.3.8}/wintertoo/submit.py +3 -0
- {wintertoo-0.3.6 → wintertoo-0.3.8}/wintertoo/validate.py +3 -1
- wintertoo-0.3.8/wintertoo.egg-info/PKG-INFO +49 -0
- wintertoo-0.3.8/wintertoo.egg-info/SOURCES.txt +33 -0
- wintertoo-0.3.8/wintertoo.egg-info/dependency_links.txt +1 -0
- wintertoo-0.3.8/wintertoo.egg-info/requires.txt +19 -0
- wintertoo-0.3.8/wintertoo.egg-info/top_level.txt +1 -0
- wintertoo-0.3.6/pyproject.toml +0 -45
- {wintertoo-0.3.6 → wintertoo-0.3.8}/LICENSE +0 -0
- {wintertoo-0.3.6 → wintertoo-0.3.8}/wintertoo/__init__.py +0 -0
- {wintertoo-0.3.6 → wintertoo-0.3.8}/wintertoo/data/__init__.py +0 -0
- {wintertoo-0.3.6 → wintertoo-0.3.8}/wintertoo/data/observing_request_schema.json +0 -0
- {wintertoo-0.3.6 → wintertoo-0.3.8}/wintertoo/data/summer_fields.txt +0 -0
- {wintertoo-0.3.6 → wintertoo-0.3.8}/wintertoo/data/winter_fields.txt +0 -0
- {wintertoo-0.3.6 → wintertoo-0.3.8}/wintertoo/database.py +0 -0
- {wintertoo-0.3.6 → wintertoo-0.3.8}/wintertoo/errors.py +0 -0
- {wintertoo-0.3.6 → wintertoo-0.3.8}/wintertoo/fields.py +0 -0
- {wintertoo-0.3.6 → wintertoo-0.3.8}/wintertoo/models/__init__.py +0 -0
- {wintertoo-0.3.6 → wintertoo-0.3.8}/wintertoo/models/image.py +0 -0
- {wintertoo-0.3.6 → wintertoo-0.3.8}/wintertoo/models/program.py +0 -0
- {wintertoo-0.3.6 → wintertoo-0.3.8}/wintertoo/models/too.py +0 -0
- {wintertoo-0.3.6 → wintertoo-0.3.8}/wintertoo/utils.py +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Black
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
black:
|
|
7
|
+
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
steps:
|
|
10
|
+
- uses: actions/checkout@v3
|
|
11
|
+
- name: Install poetry
|
|
12
|
+
run: pipx install poetry
|
|
13
|
+
- name: Set up Python 3.11
|
|
14
|
+
uses: actions/setup-python@v4
|
|
15
|
+
with:
|
|
16
|
+
python-version: 3.11
|
|
17
|
+
cache: 'pip'
|
|
18
|
+
cache-dependency-path: pyproject.toml
|
|
19
|
+
- name: Install dependencies
|
|
20
|
+
run: |
|
|
21
|
+
pip install --upgrade pip
|
|
22
|
+
pip install --editable ".[dev]"
|
|
23
|
+
- name: Reformat the code with black
|
|
24
|
+
run: |
|
|
25
|
+
black . --check
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# This is a basic workflow to help you get started with Actions
|
|
2
|
+
|
|
3
|
+
name: CI
|
|
4
|
+
|
|
5
|
+
# Controls when the action will run.
|
|
6
|
+
on:
|
|
7
|
+
# Triggers the workflow on push or pull request events
|
|
8
|
+
push:
|
|
9
|
+
|
|
10
|
+
pull_request:
|
|
11
|
+
|
|
12
|
+
# Allows you to run this workflow manually from the Actions tab
|
|
13
|
+
workflow_dispatch:
|
|
14
|
+
|
|
15
|
+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
16
|
+
jobs:
|
|
17
|
+
# This workflow contains a single job called "build"
|
|
18
|
+
build:
|
|
19
|
+
# The type of runner that the job will run on
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
|
|
22
|
+
# Specify the python versions to test
|
|
23
|
+
strategy:
|
|
24
|
+
matrix:
|
|
25
|
+
python-version: ["3.9", "3.10", "3.11"]
|
|
26
|
+
|
|
27
|
+
# Steps represent a sequence of tasks that will be executed as part of the job
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v3
|
|
30
|
+
|
|
31
|
+
# Set up the python versions
|
|
32
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
33
|
+
uses: actions/setup-python@v4
|
|
34
|
+
with:
|
|
35
|
+
python-version: ${{ matrix.python-version }}
|
|
36
|
+
cache: 'pip'
|
|
37
|
+
cache-dependency-path: pyproject.toml
|
|
38
|
+
|
|
39
|
+
- name: install packages
|
|
40
|
+
run: |
|
|
41
|
+
pip install --editable ".[dev]"
|
|
42
|
+
|
|
43
|
+
# Runs a set of commands using the runners shell
|
|
44
|
+
- name: Test the code
|
|
45
|
+
run: |
|
|
46
|
+
coverage run -m unittest discover tests/
|
|
47
|
+
|
|
48
|
+
- name: Run Coveralls
|
|
49
|
+
env:
|
|
50
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
51
|
+
run: |
|
|
52
|
+
coveralls --service=github
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
- name: Echo tag name
|
|
56
|
+
run: echo "Tag is ${{ github.ref }}, Tagged is ${{ startsWith(github.ref, 'refs/tags/')}}, Python Check is ${{matrix.python-version == 3.9}}, Deploy is ${{ startsWith(github.ref, 'refs/tags/') && matrix.python-version == 3.9}}"
|
|
57
|
+
|
|
58
|
+
- name: Install pypa/build
|
|
59
|
+
run: >-
|
|
60
|
+
python -m
|
|
61
|
+
pip install
|
|
62
|
+
build
|
|
63
|
+
--user
|
|
64
|
+
- name: Build a binary wheel and a source tarball
|
|
65
|
+
run: >-
|
|
66
|
+
python -m
|
|
67
|
+
build
|
|
68
|
+
--sdist
|
|
69
|
+
--wheel
|
|
70
|
+
--outdir dist/
|
|
71
|
+
.
|
|
72
|
+
|
|
73
|
+
- name: Publish distribution 📦 to PyPI
|
|
74
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') && success() && matrix.python-version == 3.9 && github.event_name == 'push'}}
|
|
75
|
+
uses: pypa/gh-action-pypi-publish@master
|
|
76
|
+
with:
|
|
77
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Run isort
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
isort:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
- uses: actions/checkout@v3
|
|
10
|
+
- name: Set up Python 3.11
|
|
11
|
+
uses: actions/setup-python@v4
|
|
12
|
+
with:
|
|
13
|
+
python-version: 3.11
|
|
14
|
+
cache: 'pip'
|
|
15
|
+
cache-dependency-path: pyproject.toml
|
|
16
|
+
- name: Install dependencies
|
|
17
|
+
run: |
|
|
18
|
+
pip install --upgrade pip
|
|
19
|
+
pip install --editable ".[dev]"
|
|
20
|
+
- name: isort
|
|
21
|
+
uses: isort/isort-action@v1.0.0
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Pylint
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
pylint:
|
|
7
|
+
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v3
|
|
12
|
+
- name: Set up Python 3.11
|
|
13
|
+
uses: actions/setup-python@v4
|
|
14
|
+
with:
|
|
15
|
+
python-version: 3.11
|
|
16
|
+
cache: 'pip'
|
|
17
|
+
cache-dependency-path: pyproject.toml
|
|
18
|
+
- name: Install dependencies
|
|
19
|
+
run: |
|
|
20
|
+
pip install --upgrade pip
|
|
21
|
+
pip install --editable ".[dev]"
|
|
22
|
+
- name: Analysing the code with pylint
|
|
23
|
+
run: |
|
|
24
|
+
pylint wintertoo --fail-under=10.00
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v2.3.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: check-yaml
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- repo: local
|
|
8
|
+
hooks:
|
|
9
|
+
- id: black
|
|
10
|
+
name: black
|
|
11
|
+
entry: black
|
|
12
|
+
language: system
|
|
13
|
+
types: [ python ]
|
|
14
|
+
- repo: local
|
|
15
|
+
hooks:
|
|
16
|
+
- id: isort
|
|
17
|
+
name: isort (python)
|
|
18
|
+
entry: isort
|
|
19
|
+
language: system
|
|
20
|
+
types: [ python ]
|
|
21
|
+
- repo: local
|
|
22
|
+
hooks:
|
|
23
|
+
- id: pylint
|
|
24
|
+
name: pylint
|
|
25
|
+
entry: pylint
|
|
26
|
+
language: system
|
|
27
|
+
types: [python]
|
|
28
|
+
args:
|
|
29
|
+
[
|
|
30
|
+
"-rn", # Only display messages
|
|
31
|
+
"-sn", # Don't display the score
|
|
32
|
+
]
|
|
33
|
+
verbose: true
|
|
@@ -1,33 +1,27 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: wintertoo
|
|
3
|
-
Version: 0.3.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Author-email: frostig@mit.edu
|
|
8
|
-
Requires-Python: >=3.9.0,<3.12
|
|
3
|
+
Version: 0.3.8
|
|
4
|
+
Author-email: Robert Stein <rdstein@caltech.edu>, Danielle Frostig <frostig@mit.edu>, Viraj Karambelkar <viraj@astro.caltech.edu>
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: homepage, https://github.com/winter-telescope/wintertoo
|
|
9
7
|
Classifier: Programming Language :: Python :: 3
|
|
10
8
|
Classifier: Programming Language :: Python :: 3.9
|
|
11
9
|
Classifier: Programming Language :: Python :: 3.10
|
|
12
10
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Requires-
|
|
24
|
-
Requires-Dist: psycopg (>=3.1.8)
|
|
25
|
-
Requires-Dist: psycopg-binary (>=3.1.8)
|
|
26
|
-
Requires-Dist: pydantic (>=1.10.5)
|
|
27
|
-
Requires-Dist: pylint (>=2.16.2,<3.0.0)
|
|
28
|
-
Requires-Dist: pytz (>=2022.7.1)
|
|
29
|
-
Requires-Dist: sqlalchemy (>=2.0.4)
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Natural Language :: English
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
18
|
+
Classifier: Operating System :: POSIX
|
|
19
|
+
Classifier: Operating System :: Unix
|
|
20
|
+
Classifier: Operating System :: MacOS
|
|
21
|
+
Requires-Python: >=3.9
|
|
30
22
|
Description-Content-Type: text/markdown
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
License-File: LICENSE
|
|
31
25
|
|
|
32
26
|
# wintertoo
|
|
33
27
|
[](https://badge.fury.io/py/wintertoo)
|
|
@@ -41,3 +35,15 @@ Current functionality includes:
|
|
|
41
35
|
* Building ToO schedules
|
|
42
36
|
* Verifying ToO schedules
|
|
43
37
|
|
|
38
|
+
## Installation
|
|
39
|
+
### Install from pypi
|
|
40
|
+
```bash
|
|
41
|
+
pip install wintertoo
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Install from source
|
|
45
|
+
```bash
|
|
46
|
+
git clone git@github.com:winter-telescope/wintertoo.git
|
|
47
|
+
cd wintertoo
|
|
48
|
+
pip install --editable ".[dev]"
|
|
49
|
+
```
|
|
@@ -9,3 +9,16 @@ Current functionality includes:
|
|
|
9
9
|
* Converting RA/DEC positions to fields
|
|
10
10
|
* Building ToO schedules
|
|
11
11
|
* Verifying ToO schedules
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
### Install from pypi
|
|
15
|
+
```bash
|
|
16
|
+
pip install wintertoo
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Install from source
|
|
20
|
+
```bash
|
|
21
|
+
git clone git@github.com:winter-telescope/wintertoo.git
|
|
22
|
+
cd wintertoo
|
|
23
|
+
pip install --editable ".[dev]"
|
|
24
|
+
```
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=45", "setuptools-scm"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "wintertoo"
|
|
7
|
+
version = "0.3.8"
|
|
8
|
+
description = ""
|
|
9
|
+
authors = [
|
|
10
|
+
{name = "Robert Stein", email = "rdstein@caltech.edu"},
|
|
11
|
+
{name = "Danielle Frostig", email = "frostig@mit.edu"},
|
|
12
|
+
{name = "Viraj Karambelkar", email = "viraj@astro.caltech.edu"}
|
|
13
|
+
]
|
|
14
|
+
license = {text = "MIT"}
|
|
15
|
+
readme = "README.md"
|
|
16
|
+
requires-python = ">=3.9"
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
'Programming Language :: Python :: 3.9',
|
|
20
|
+
'Programming Language :: Python :: 3.10',
|
|
21
|
+
'Programming Language :: Python :: 3.11',
|
|
22
|
+
'Intended Audience :: Science/Research',
|
|
23
|
+
'Intended Audience :: End Users/Desktop',
|
|
24
|
+
'Intended Audience :: Developers',
|
|
25
|
+
'Natural Language :: English',
|
|
26
|
+
'Topic :: Scientific/Engineering',
|
|
27
|
+
'Topic :: Scientific/Engineering :: Astronomy',
|
|
28
|
+
'Topic :: Scientific/Engineering :: Physics',
|
|
29
|
+
'Operating System :: POSIX',
|
|
30
|
+
'Operating System :: Unix',
|
|
31
|
+
'Operating System :: MacOS',
|
|
32
|
+
]
|
|
33
|
+
dependencies = [
|
|
34
|
+
"pandas >= 2.0.0",
|
|
35
|
+
"astropy",
|
|
36
|
+
"astroplan",
|
|
37
|
+
"matplotlib",
|
|
38
|
+
"numpy",
|
|
39
|
+
"pytz",
|
|
40
|
+
"jsonschema",
|
|
41
|
+
"sqlalchemy",
|
|
42
|
+
"pydantic",
|
|
43
|
+
"pre-commit",
|
|
44
|
+
"bcrypt",
|
|
45
|
+
"psycopg",
|
|
46
|
+
"psycopg-binary"
|
|
47
|
+
]
|
|
48
|
+
[project.optional-dependencies]
|
|
49
|
+
dev = [
|
|
50
|
+
"black == 23.3.0",
|
|
51
|
+
"isort == 5.12.0",
|
|
52
|
+
"pylint == 2.17.4",
|
|
53
|
+
"coveralls",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
[project.urls]
|
|
57
|
+
homepage = "https://github.com/winter-telescope/wintertoo"
|
|
58
|
+
|
|
59
|
+
[tool.setuptools]
|
|
60
|
+
packages = ["wintertoo", "wintertoo.models", "wintertoo.data"]
|
|
61
|
+
|
|
62
|
+
[tool.coverage.run]
|
|
63
|
+
source = ["wintertoo"]
|
|
64
|
+
|
|
65
|
+
[tool.coverage.report]
|
|
66
|
+
# Regexes for lines to exclude from consideration
|
|
67
|
+
exclude_lines = [
|
|
68
|
+
# Have to re-enable the standard pragma
|
|
69
|
+
"pragma: no cover",
|
|
70
|
+
# Don't complain about missing debug-only code:
|
|
71
|
+
"def __repr__",
|
|
72
|
+
# Don't complain if tests don't hit defensive assertion code:
|
|
73
|
+
"raise AssertionError",
|
|
74
|
+
"raise NotImplementedError",
|
|
75
|
+
"raise KeyError",
|
|
76
|
+
"except KeyError",
|
|
77
|
+
"raise ValueError",
|
|
78
|
+
"except JSONDecodeError:",
|
|
79
|
+
"raise requests.exceptions.RequestException",
|
|
80
|
+
# Don't complain if non-runnable code isn't run:
|
|
81
|
+
"if 0:",
|
|
82
|
+
"if False:",
|
|
83
|
+
'if __name__ == "__main__":',
|
|
84
|
+
"err =",
|
|
85
|
+
"logger.error",
|
|
86
|
+
"raise"
|
|
87
|
+
]
|
|
88
|
+
ignore_errors = true
|
|
89
|
+
|
|
90
|
+
[tool.isort]
|
|
91
|
+
profile = "black"
|
|
92
|
+
|
|
93
|
+
[tool.pylint.format]
|
|
94
|
+
max-line-length = "88"
|
|
95
|
+
disable=["logging-fstring-interpolation"]
|
|
96
|
+
good-names=["ax", "ra", "df", "pi", "i"]
|
|
97
|
+
exclude-too-few-public-methods=["pydantic.*"]
|
|
98
|
+
extension-pkg-whitelist=["pydantic"]
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Module for testing submission of a schedule
|
|
3
|
+
"""
|
|
4
|
+
import logging
|
|
5
|
+
import unittest
|
|
6
|
+
|
|
7
|
+
from wintertoo.fields import get_best_field, get_field_info, get_fields_in_box
|
|
8
|
+
|
|
9
|
+
logger = logging.getLogger(__name__)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class TestField(unittest.TestCase):
|
|
13
|
+
"""
|
|
14
|
+
Class for schedule testing
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def test_get_fields_in_box(self):
|
|
18
|
+
"""
|
|
19
|
+
Test getting fields in box
|
|
20
|
+
|
|
21
|
+
:return: None
|
|
22
|
+
"""
|
|
23
|
+
logger.info("Testing getting fields in box")
|
|
24
|
+
|
|
25
|
+
ra_deg = 210.910674637
|
|
26
|
+
dec_deg = 54.3116510708
|
|
27
|
+
|
|
28
|
+
width = 0.7
|
|
29
|
+
|
|
30
|
+
ra_lim = (ra_deg - width, ra_deg + width)
|
|
31
|
+
dec_lim = (dec_deg - width, dec_deg + width)
|
|
32
|
+
|
|
33
|
+
fields = get_fields_in_box(ra_lim, dec_lim, summer=True)
|
|
34
|
+
|
|
35
|
+
assert len(fields) == 17, "Wrong number of fields"
|
|
36
|
+
assert fields["ID"].iloc[0] == 55286, "Wrong field"
|
|
37
|
+
|
|
38
|
+
fields = get_fields_in_box(ra_lim, dec_lim, summer=False)
|
|
39
|
+
|
|
40
|
+
assert len(fields) == 2, "Wrong number of fields"
|
|
41
|
+
assert fields["ID"].iloc[0] == 3735, "Wrong field"
|
|
42
|
+
|
|
43
|
+
def test_get_field_info(self):
|
|
44
|
+
"""
|
|
45
|
+
Test getting field info
|
|
46
|
+
|
|
47
|
+
:return: None
|
|
48
|
+
"""
|
|
49
|
+
get_field_info(55286, summer=True)
|
|
50
|
+
get_field_info(3735, summer=False)
|
|
51
|
+
|
|
52
|
+
def test_get_best_field(self):
|
|
53
|
+
"""
|
|
54
|
+
Test getting best field
|
|
55
|
+
|
|
56
|
+
:return: None
|
|
57
|
+
"""
|
|
58
|
+
get_best_field(210.910674637, 54.3116510708, summer=True, make_plot=True)
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Module for testing submission of a schedule
|
|
3
|
+
"""
|
|
4
|
+
import logging
|
|
5
|
+
import os
|
|
6
|
+
import unittest
|
|
7
|
+
from datetime import date
|
|
8
|
+
|
|
9
|
+
import pandas as pd
|
|
10
|
+
from astropy.time import Time
|
|
11
|
+
|
|
12
|
+
from wintertoo.models import Program, SummerFieldToO, SummerRaDecToO
|
|
13
|
+
from wintertoo.schedule import concat_toos, schedule_field, schedule_ra_dec
|
|
14
|
+
from wintertoo.submit import export_schedule_to_sqlitedb
|
|
15
|
+
from wintertoo.validate import (
|
|
16
|
+
validate_obshist,
|
|
17
|
+
validate_schedule_df,
|
|
18
|
+
validate_target_dates,
|
|
19
|
+
validate_target_pi,
|
|
20
|
+
validate_target_priority,
|
|
21
|
+
validate_target_visibility,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
logger = logging.getLogger(__name__)
|
|
25
|
+
|
|
26
|
+
test_data_dir = os.path.join(os.path.dirname(__file__), "testdata")
|
|
27
|
+
test_json_path = os.path.join(test_data_dir, "test_schedule.json")
|
|
28
|
+
test_df = pd.read_json(test_json_path)
|
|
29
|
+
|
|
30
|
+
program = Program(
|
|
31
|
+
pi_name="Stein",
|
|
32
|
+
progname="2021A000",
|
|
33
|
+
prog_key="763244309190298696786072636901190268976229595667748695826878",
|
|
34
|
+
maxpriority=100,
|
|
35
|
+
startdate=date(2021, 1, 1),
|
|
36
|
+
enddate=date(2023, 12, 31),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class TestSchedule(unittest.TestCase):
|
|
41
|
+
"""
|
|
42
|
+
Class for schedule testing
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
def test_validate_json(self):
|
|
46
|
+
"""
|
|
47
|
+
Test validation of json
|
|
48
|
+
|
|
49
|
+
:return: None
|
|
50
|
+
"""
|
|
51
|
+
logger.info("Testing the validation with a test json")
|
|
52
|
+
validate_schedule_df(test_df)
|
|
53
|
+
|
|
54
|
+
def test_generate_schedule(self):
|
|
55
|
+
"""
|
|
56
|
+
Test generating a schedule
|
|
57
|
+
|
|
58
|
+
:return: None
|
|
59
|
+
"""
|
|
60
|
+
logger.info("Testing schedule generation")
|
|
61
|
+
|
|
62
|
+
schedule = schedule_ra_dec(
|
|
63
|
+
too=SummerRaDecToO(
|
|
64
|
+
ra_deg=173.7056754,
|
|
65
|
+
dec_deg=11.253441,
|
|
66
|
+
start_time_mjd=62721.1894969287,
|
|
67
|
+
end_time_mjd=62722.1894969452,
|
|
68
|
+
),
|
|
69
|
+
program=program,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
validate_target_visibility(schedule)
|
|
73
|
+
|
|
74
|
+
comp = pd.read_json(schedule.to_json()) # pylint: disable=no-member
|
|
75
|
+
self.assertEqual(test_df.to_json(), comp.to_json()) # pylint: disable=no-member
|
|
76
|
+
|
|
77
|
+
schedule = schedule_ra_dec(
|
|
78
|
+
too=SummerRaDecToO(
|
|
79
|
+
ra_deg=173.7056754,
|
|
80
|
+
dec_deg=11.253441,
|
|
81
|
+
),
|
|
82
|
+
program=program,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
validate_schedule_df(schedule)
|
|
86
|
+
validate_obshist(schedule)
|
|
87
|
+
|
|
88
|
+
validate_target_priority(schedule=schedule, max_priority=program.maxpriority)
|
|
89
|
+
|
|
90
|
+
program_start_date = Time(str(program.startdate), format="isot")
|
|
91
|
+
|
|
92
|
+
program_end_date = Time(str(program.enddate), format="isot")
|
|
93
|
+
|
|
94
|
+
validate_target_dates(
|
|
95
|
+
schedule,
|
|
96
|
+
program_start_date=program_start_date,
|
|
97
|
+
program_end_date=program_end_date,
|
|
98
|
+
)
|
|
99
|
+
validate_target_pi(schedule, prog_pi=program.pi_name)
|
|
100
|
+
|
|
101
|
+
export_schedule_to_sqlitedb(schedule, "test_schedule.db")
|
|
102
|
+
|
|
103
|
+
def test_schedule_utils(self):
|
|
104
|
+
"""
|
|
105
|
+
Test generating a schedule
|
|
106
|
+
|
|
107
|
+
:return: None
|
|
108
|
+
"""
|
|
109
|
+
logger.info("Testing schedule util functions")
|
|
110
|
+
|
|
111
|
+
field_too = SummerFieldToO(
|
|
112
|
+
field_id=1,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
schedule_field(
|
|
116
|
+
field_too,
|
|
117
|
+
program=program,
|
|
118
|
+
csv_save_file="test_schedule.csv",
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
concat_toos(
|
|
122
|
+
[field_too, SummerRaDecToO(ra_deg=173.7056754, dec_deg=11.253441)],
|
|
123
|
+
program=program,
|
|
124
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"raDeg":{"0":173.60947,"1":173.60947,"2":173.60947,"3":173.60947},"decDeg":{"0":11.16715,"1":11.16715,"2":11.16715,"3":11.16715},"fieldID":{"0":244641,"1":244641,"2":244641,"3":244641},"filter":{"0":"u","1":"g","2":"r","3":"i"},"visitExpTime":{"0":30.0,"1":30.0,"2":30.0,"3":30.0},"priority":{"0":50.0,"1":50.0,"2":50.0,"3":50.0},"progPI":{"0":"Stein","1":"Stein","2":"Stein","3":"Stein"},"progName":{"0":"2021A000","1":"2021A000","2":"2021A000","3":"2021A000"},"progID":{"0":1,"1":1,"2":1,"3":1},"validStart":{"0":62721.1894969287,"1":62721.1894969287,"2":62721.1894969287,"3":62721.1894969287},"validStop":{"0":62722.1894969452,"1":62722.1894969452,"2":62722.1894969452,"3":62722.1894969452},"observed":{"0":false,"1":false,"2":false,"3":false},"maxAirmass":{"0":2.0,"1":2.0,"2":2.0,"3":2.0},"ditherNumber":{"0":1,"1":1,"2":1,"3":1},"ditherStepSize":{"0":15.0,"1":15.0,"2":15.0,"3":15.0},"obsHistID":{"0":0,"1":1,"2":2,"3":3}}
|
|
@@ -174,12 +174,12 @@ def concat_toos(
|
|
|
174
174
|
schedule = []
|
|
175
175
|
|
|
176
176
|
for too in requests:
|
|
177
|
-
if isinstance(too,
|
|
177
|
+
if isinstance(too, (SummerFieldToO, WinterFieldToO)):
|
|
178
178
|
res = schedule_field(
|
|
179
179
|
too=too,
|
|
180
180
|
program=program,
|
|
181
181
|
)
|
|
182
|
-
elif isinstance(too,
|
|
182
|
+
elif isinstance(too, (SummerRaDecToO, WinterRaDecToO)):
|
|
183
183
|
res = schedule_ra_dec(
|
|
184
184
|
too=too,
|
|
185
185
|
program=program,
|
|
@@ -40,6 +40,7 @@ def submit_schedule( # pylint: disable=too-many-arguments
|
|
|
40
40
|
schedule: pd.DataFrame,
|
|
41
41
|
program_api_key: str,
|
|
42
42
|
program_name: str,
|
|
43
|
+
program_db_name: str,
|
|
43
44
|
program_db_host: str,
|
|
44
45
|
program_db_user: str,
|
|
45
46
|
program_db_password: str,
|
|
@@ -52,6 +53,7 @@ def submit_schedule( # pylint: disable=too-many-arguments
|
|
|
52
53
|
:param schedule: schedule to use
|
|
53
54
|
:param program_api_key: API key of program
|
|
54
55
|
:param program_name: Program name (e.g 2020A000)
|
|
56
|
+
:param program_db_name: Name of program DB
|
|
55
57
|
:param program_db_host: Host of programs DB
|
|
56
58
|
:param program_db_user: User of programs DB
|
|
57
59
|
:param program_db_password: password of programs DB
|
|
@@ -63,6 +65,7 @@ def submit_schedule( # pylint: disable=too-many-arguments
|
|
|
63
65
|
schedule,
|
|
64
66
|
program_api_key=program_api_key,
|
|
65
67
|
program_name=program_name,
|
|
68
|
+
program_db_name=program_db_name,
|
|
66
69
|
program_db_user=program_db_user,
|
|
67
70
|
program_db_password=program_db_password,
|
|
68
71
|
program_db_host=program_db_host,
|
|
@@ -37,7 +37,6 @@ def get_and_validate_program_details( # pylint: disable=too-many-arguments
|
|
|
37
37
|
:param program_db_name: name of database containing program table
|
|
38
38
|
:return: dataframe of program
|
|
39
39
|
"""
|
|
40
|
-
|
|
41
40
|
data = get_program_details(
|
|
42
41
|
program_name=program_name,
|
|
43
42
|
program_api_key=program_api_key,
|
|
@@ -229,6 +228,7 @@ def validate_schedule_request( # pylint: disable=too-many-arguments
|
|
|
229
228
|
schedule_request: pd.DataFrame,
|
|
230
229
|
program_name: str,
|
|
231
230
|
program_api_key: str,
|
|
231
|
+
program_db_name: str,
|
|
232
232
|
program_db_user: str = None,
|
|
233
233
|
program_db_password: str = None,
|
|
234
234
|
program_db_host: str = PROGRAM_DB_HOST,
|
|
@@ -239,6 +239,7 @@ def validate_schedule_request( # pylint: disable=too-many-arguments
|
|
|
239
239
|
:param schedule_request: Schedule to validate
|
|
240
240
|
:param program_name: name of program e.g 2020A000
|
|
241
241
|
:param program_api_key: unique API key for program
|
|
242
|
+
:param program_db_name: name of the programs database
|
|
242
243
|
:param program_db_user: user for the programs database
|
|
243
244
|
:param program_db_password: password for the programs database
|
|
244
245
|
:param program_db_host: host of the programs database
|
|
@@ -255,6 +256,7 @@ def validate_schedule_request( # pylint: disable=too-many-arguments
|
|
|
255
256
|
program = get_and_validate_program_details(
|
|
256
257
|
program_name=program_name,
|
|
257
258
|
program_api_key=program_api_key,
|
|
259
|
+
program_db_name=program_db_name,
|
|
258
260
|
program_db_user=program_db_user,
|
|
259
261
|
program_db_password=program_db_password,
|
|
260
262
|
program_db_host=program_db_host,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: wintertoo
|
|
3
|
+
Version: 0.3.8
|
|
4
|
+
Author-email: Robert Stein <rdstein@caltech.edu>, Danielle Frostig <frostig@mit.edu>, Viraj Karambelkar <viraj@astro.caltech.edu>
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: homepage, https://github.com/winter-telescope/wintertoo
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Natural Language :: English
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
18
|
+
Classifier: Operating System :: POSIX
|
|
19
|
+
Classifier: Operating System :: Unix
|
|
20
|
+
Classifier: Operating System :: MacOS
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
|
|
26
|
+
# wintertoo
|
|
27
|
+
[](https://badge.fury.io/py/wintertoo)
|
|
28
|
+
[](https://github.com/winter-telescope/wintertoo/actions/workflows/continuous_integration.yml)
|
|
29
|
+
[](https://coveralls.io/github/winter-telescope/wintertoo?branch=main)
|
|
30
|
+
|
|
31
|
+
General package for Target-of-Opportunity (ToO) observations with the [WINTER observatory](https://github.com/winter-telescope).
|
|
32
|
+
|
|
33
|
+
Current functionality includes:
|
|
34
|
+
* Converting RA/DEC positions to fields
|
|
35
|
+
* Building ToO schedules
|
|
36
|
+
* Verifying ToO schedules
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
### Install from pypi
|
|
40
|
+
```bash
|
|
41
|
+
pip install wintertoo
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Install from source
|
|
45
|
+
```bash
|
|
46
|
+
git clone git@github.com:winter-telescope/wintertoo.git
|
|
47
|
+
cd wintertoo
|
|
48
|
+
pip install --editable ".[dev]"
|
|
49
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.gitignore
|
|
2
|
+
.pre-commit-config.yaml
|
|
3
|
+
LICENSE
|
|
4
|
+
README.md
|
|
5
|
+
pyproject.toml
|
|
6
|
+
.github/workflows/black.yml
|
|
7
|
+
.github/workflows/continuous_integration.yml
|
|
8
|
+
.github/workflows/isort.yml
|
|
9
|
+
.github/workflows/pylint.yml
|
|
10
|
+
tests/test_fields.py
|
|
11
|
+
tests/test_schedule.py
|
|
12
|
+
tests/testdata/test_schedule.json
|
|
13
|
+
wintertoo/__init__.py
|
|
14
|
+
wintertoo/database.py
|
|
15
|
+
wintertoo/errors.py
|
|
16
|
+
wintertoo/fields.py
|
|
17
|
+
wintertoo/schedule.py
|
|
18
|
+
wintertoo/submit.py
|
|
19
|
+
wintertoo/utils.py
|
|
20
|
+
wintertoo/validate.py
|
|
21
|
+
wintertoo.egg-info/PKG-INFO
|
|
22
|
+
wintertoo.egg-info/SOURCES.txt
|
|
23
|
+
wintertoo.egg-info/dependency_links.txt
|
|
24
|
+
wintertoo.egg-info/requires.txt
|
|
25
|
+
wintertoo.egg-info/top_level.txt
|
|
26
|
+
wintertoo/data/__init__.py
|
|
27
|
+
wintertoo/data/observing_request_schema.json
|
|
28
|
+
wintertoo/data/summer_fields.txt
|
|
29
|
+
wintertoo/data/winter_fields.txt
|
|
30
|
+
wintertoo/models/__init__.py
|
|
31
|
+
wintertoo/models/image.py
|
|
32
|
+
wintertoo/models/program.py
|
|
33
|
+
wintertoo/models/too.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
wintertoo
|
wintertoo-0.3.6/pyproject.toml
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
[tool.poetry]
|
|
2
|
-
name = "wintertoo"
|
|
3
|
-
version = "0.3.6"
|
|
4
|
-
description = ""
|
|
5
|
-
authors = [
|
|
6
|
-
"Danielle Frostig <frostig@mit.edu>",
|
|
7
|
-
"Viraj Karambelkar <viraj@astro.caltech.edu>",
|
|
8
|
-
"Robert Stein <rdstein@caltech.edu>"
|
|
9
|
-
]
|
|
10
|
-
readme = "README.md"
|
|
11
|
-
homepage = "https://github.com/winter-telescope/wintertoo"
|
|
12
|
-
|
|
13
|
-
[tool.poetry.dependencies]
|
|
14
|
-
python = ">=3.9.0,<3.12"
|
|
15
|
-
pandas = ">=2.0.2"
|
|
16
|
-
astropy = ">=5.2.1"
|
|
17
|
-
astroplan = ">=0.8"
|
|
18
|
-
matplotlib = ">=3.7.0"
|
|
19
|
-
numpy = ">=1.24.2"
|
|
20
|
-
pytz = ">=2022.7.1"
|
|
21
|
-
psycopg = ">=3.1.8"
|
|
22
|
-
black = "^23.1.0"
|
|
23
|
-
isort = "^5.12.0"
|
|
24
|
-
pylint = "^2.16.2"
|
|
25
|
-
coveralls = ">=3.3.1"
|
|
26
|
-
jsonschema = ">=4.17.3"
|
|
27
|
-
psycopg-binary = ">=3.1.8"
|
|
28
|
-
sqlalchemy = ">=2.0.4"
|
|
29
|
-
pydantic = ">=1.10.5"
|
|
30
|
-
pre-commit = ">=3.2.2"
|
|
31
|
-
bcrypt = "^4.0.1"
|
|
32
|
-
|
|
33
|
-
[tool.isort]
|
|
34
|
-
profile = "black"
|
|
35
|
-
|
|
36
|
-
[tool.pylint.format]
|
|
37
|
-
max-line-length = "88"
|
|
38
|
-
disable=["logging-fstring-interpolation"]
|
|
39
|
-
good-names=["ax", "ra", "df", "pi", "i"]
|
|
40
|
-
exclude-too-few-public-methods=["pydantic.*"]
|
|
41
|
-
extension-pkg-whitelist=["pydantic"]
|
|
42
|
-
|
|
43
|
-
[build-system]
|
|
44
|
-
requires = ["poetry-core"]
|
|
45
|
-
build-backend = "poetry.core.masonry.api"
|
|
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
|