wintertoo 0.2.1__tar.gz → 0.4.2__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.

Files changed (46) hide show
  1. wintertoo-0.4.2/.github/dependabot.yml +11 -0
  2. wintertoo-0.4.2/.github/workflows/automerge.yml +30 -0
  3. wintertoo-0.4.2/.github/workflows/black.yml +25 -0
  4. wintertoo-0.4.2/.github/workflows/continuous_integration.yml +77 -0
  5. wintertoo-0.4.2/.github/workflows/isort.yml +21 -0
  6. wintertoo-0.4.2/.github/workflows/pylint.yml +24 -0
  7. wintertoo-0.4.2/.gitignore +20 -0
  8. wintertoo-0.4.2/.pre-commit-config.yaml +33 -0
  9. {wintertoo-0.2.1 → wintertoo-0.4.2}/PKG-INFO +30 -9
  10. {wintertoo-0.2.1 → wintertoo-0.4.2}/README.md +14 -0
  11. wintertoo-0.4.2/pyproject.toml +98 -0
  12. wintertoo-0.4.2/tests/test_fields.py +58 -0
  13. wintertoo-0.4.2/tests/test_schedule.py +127 -0
  14. wintertoo-0.4.2/tests/testdata/test_schedule.json +1 -0
  15. wintertoo-0.4.2/wintertoo/data/__init__.py +57 -0
  16. wintertoo-0.4.2/wintertoo/data/observing_request_schema.json +36 -0
  17. {wintertoo-0.2.1 → wintertoo-0.4.2}/wintertoo/data/summer_fields.txt +1 -1
  18. wintertoo-0.4.2/wintertoo/data/winter_fields.txt +41167 -0
  19. wintertoo-0.4.2/wintertoo/database.py +106 -0
  20. wintertoo-0.4.2/wintertoo/errors.py +11 -0
  21. wintertoo-0.4.2/wintertoo/fields.py +225 -0
  22. wintertoo-0.4.2/wintertoo/models/__init__.py +11 -0
  23. wintertoo-0.4.2/wintertoo/models/image.py +81 -0
  24. wintertoo-0.4.2/wintertoo/models/program.py +69 -0
  25. wintertoo-0.4.2/wintertoo/models/too.py +181 -0
  26. wintertoo-0.4.2/wintertoo/schedule.py +198 -0
  27. wintertoo-0.4.2/wintertoo/submit.py +79 -0
  28. wintertoo-0.4.2/wintertoo/utils.py +112 -0
  29. wintertoo-0.4.2/wintertoo/validate.py +279 -0
  30. {wintertoo-0.2.1 → wintertoo-0.4.2}/wintertoo.egg-info/PKG-INFO +30 -9
  31. wintertoo-0.4.2/wintertoo.egg-info/SOURCES.txt +35 -0
  32. wintertoo-0.4.2/wintertoo.egg-info/requires.txt +19 -0
  33. wintertoo-0.2.1/setup.py +0 -52
  34. wintertoo-0.2.1/wintertoo/data/__init__.py +0 -38
  35. wintertoo-0.2.1/wintertoo/data/observing_request_schema.json +0 -38
  36. wintertoo-0.2.1/wintertoo/fields.py +0 -97
  37. wintertoo-0.2.1/wintertoo/schedule.py +0 -206
  38. wintertoo-0.2.1/wintertoo/utils.py +0 -197
  39. wintertoo-0.2.1/wintertoo/validate.py +0 -182
  40. wintertoo-0.2.1/wintertoo.egg-info/SOURCES.txt +0 -16
  41. wintertoo-0.2.1/wintertoo.egg-info/requires.txt +0 -15
  42. {wintertoo-0.2.1 → wintertoo-0.4.2}/LICENSE +0 -0
  43. {wintertoo-0.2.1 → wintertoo-0.4.2}/setup.cfg +0 -0
  44. {wintertoo-0.2.1 → wintertoo-0.4.2}/wintertoo/__init__.py +0 -0
  45. {wintertoo-0.2.1 → wintertoo-0.4.2}/wintertoo.egg-info/dependency_links.txt +0 -0
  46. {wintertoo-0.2.1 → wintertoo-0.4.2}/wintertoo.egg-info/top_level.txt +0 -0
@@ -0,0 +1,11 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "pip" # See documentation for possible values
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "weekly"
@@ -0,0 +1,30 @@
1
+ name: Dependabot auto-merge
2
+
3
+ on:
4
+ pull_request:
5
+ merge_group:
6
+
7
+ permissions:
8
+ pull-requests: write
9
+ contents: write
10
+
11
+ jobs:
12
+ automerge:
13
+ runs-on: ubuntu-latest
14
+ if: ${{ github.actor == 'dependabot[bot]' }}
15
+ steps:
16
+ - name: Dependabot metadata
17
+ id: metadata
18
+ uses: dependabot/fetch-metadata@v1.1.1
19
+ with:
20
+ github-token: "${{ secrets.GITHUB_TOKEN }}"
21
+
22
+ - name: Echo auto-merge
23
+ run: echo "Update type is ${{steps.metadata.outputs.update-type}}, check is ${{contains(steps.metadata.outputs.update-type,'version-update:semver')}}"
24
+
25
+ - name: Enable auto-merge for Dependabot PRs
26
+ if: ${{contains(steps.metadata.outputs.update-type,'version-update:semver')}}
27
+ run: gh pr merge --auto --squash "$PR_URL"
28
+ env:
29
+ PR_URL: ${{github.event.pull_request.html_url}}
30
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -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,20 @@
1
+ .env
2
+ __pycache__/
3
+ *.pyc
4
+ .DS_Store
5
+ .idea/
6
+
7
+ # Distribution / packaging
8
+ bin/
9
+ build/
10
+ develop-eggs/
11
+ dist/
12
+ eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ *.egg-info/
19
+ .installed.cfg
20
+ *.egg
@@ -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,19 +1,26 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wintertoo
3
- Version: 0.2.1
4
- Home-page: https://github.com/winter-telescope/wintertoo
5
- Author: Danielle Frostig, Viraj Karambelkar, Robert Stein
3
+ Version: 0.4.2
4
+ Author-email: Robert Stein <rdstein@caltech.edu>, Danielle Frostig <frostig@mit.edu>, Viraj Karambelkar <viraj@astro.caltech.edu>
6
5
  License: MIT
7
- Keywords: astronomy image WINTER
8
- Classifier: License :: OSI Approved :: MIT License
9
- Classifier: Operating System :: OS Independent
6
+ Project-URL: homepage, https://github.com/winter-telescope/wintertoo
10
7
  Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.7
12
- Classifier: Programming Language :: Python :: 3.8
13
8
  Classifier: Programming Language :: Python :: 3.9
14
9
  Classifier: Programming Language :: Python :: 3.10
15
- Requires-Python: >=3.7
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
16
22
  Description-Content-Type: text/markdown
23
+ Provides-Extra: dev
17
24
  License-File: LICENSE
18
25
 
19
26
  # wintertoo
@@ -27,3 +34,17 @@ Current functionality includes:
27
34
  * Converting RA/DEC positions to fields
28
35
  * Building ToO schedules
29
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
+ pre-commit install
50
+ ```
@@ -9,3 +9,17 @@ 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
+ pre-commit install
25
+ ```
@@ -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.4.2"
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",
35
+ "astropy",
36
+ "astroplan",
37
+ "matplotlib",
38
+ "numpy",
39
+ "pytz",
40
+ "jsonschema",
41
+ "sqlalchemy",
42
+ "pydantic>=2.2.0",
43
+ "pre-commit",
44
+ "bcrypt",
45
+ "psycopg",
46
+ "psycopg-binary"
47
+ ]
48
+ [project.optional-dependencies]
49
+ dev = [
50
+ "black == 23.7.0",
51
+ "isort == 5.12.0",
52
+ "pylint == 2.17.5",
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) == 28, f"Wrong number of fields ({len(fields)})"
36
+ assert fields["ID"].iloc[0] == 54494, f"Wrong field {fields['ID'].iloc[0]}"
37
+
38
+ fields = get_fields_in_box(ra_lim, dec_lim, summer=False)
39
+
40
+ assert len(fields) == 3, f"Wrong number of fields ({len(fields)})"
41
+ assert fields["ID"].iloc[0] == 3735, f"Wrong field {fields['ID'].iloc[0]}"
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,127 @@
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
+ # Uncomment to generate a new test json
73
+ # schedule.to_json(test_json_path)
74
+
75
+ validate_target_visibility(schedule)
76
+
77
+ comp = pd.read_json(schedule.to_json()) # pylint: disable=no-member
78
+ self.assertEqual(test_df.to_json(), comp.to_json()) # pylint: disable=no-member
79
+
80
+ schedule = schedule_ra_dec(
81
+ too=SummerRaDecToO(
82
+ ra_deg=173.7056754,
83
+ dec_deg=11.253441,
84
+ ),
85
+ program=program,
86
+ )
87
+
88
+ validate_schedule_df(schedule)
89
+ validate_obshist(schedule)
90
+
91
+ validate_target_priority(schedule=schedule, max_priority=program.maxpriority)
92
+
93
+ program_start_date = Time(str(program.startdate), format="isot")
94
+
95
+ program_end_date = Time(str(program.enddate), format="isot")
96
+
97
+ validate_target_dates(
98
+ schedule,
99
+ program_start_date=program_start_date,
100
+ program_end_date=program_end_date,
101
+ )
102
+ validate_target_pi(schedule, prog_pi=program.pi_name)
103
+
104
+ export_schedule_to_sqlitedb(schedule, "test_schedule.db")
105
+
106
+ def test_schedule_utils(self):
107
+ """
108
+ Test generating a schedule
109
+
110
+ :return: None
111
+ """
112
+ logger.info("Testing schedule util functions")
113
+
114
+ field_too = SummerFieldToO(
115
+ field_id=1,
116
+ )
117
+
118
+ schedule_field(
119
+ field_too,
120
+ program=program,
121
+ csv_save_file="test_schedule.csv",
122
+ )
123
+
124
+ concat_toos(
125
+ [field_too, SummerRaDecToO(ra_deg=173.7056754, dec_deg=11.253441)],
126
+ program=program,
127
+ )
@@ -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":600.0,"1":600.0,"2":600.0,"3":600.0},"obsHistID":{"0":0,"1":1,"2":2,"3":3}}
@@ -0,0 +1,57 @@
1
+ """
2
+ Central module for general data and telescope constants
3
+ """
4
+ import json
5
+ import typing
6
+ from pathlib import Path
7
+ from typing import Literal
8
+
9
+ import astroplan
10
+ import astropy.coordinates as coords
11
+ import pandas as pd
12
+
13
+ data_dir = Path(__file__).parent.resolve()
14
+
15
+ summer_fields_path = data_dir.joinpath("summer_fields.txt")
16
+ summer_fields = pd.read_csv(summer_fields_path, sep=r"\s+")
17
+
18
+ winter_fields_path = data_dir.joinpath("winter_fields.txt")
19
+ winter_fields = pd.read_csv(winter_fields_path, sep=r"\s+")
20
+
21
+ SummerFilters = Literal["u", "g", "r", "i"]
22
+
23
+ WinterFilters = Literal["dark", "Y", "J", "Hs"]
24
+
25
+ SUMMER_FILTERS = list(typing.get_args(SummerFilters))
26
+ WINTER_FILTERS = list(typing.get_args(WinterFilters))
27
+ WINTER_SCIENCE_FILTERS = ["Y", "J", "Hs"]
28
+
29
+ SUMMER_BASE_WIDTH = 0.26112
30
+ WINTER_BASE_WIDTH = 1.0
31
+
32
+ PROGRAM_DB_HOST = "jagati.caltech.edu"
33
+
34
+ too_schedule_config_path = data_dir.joinpath("observing_request_schema.json")
35
+
36
+ with open(too_schedule_config_path, "rb") as f:
37
+ too_db_schedule_config = json.load(f)
38
+
39
+
40
+ def get_default_value(key: str):
41
+ """
42
+ Get default value for a parameter.
43
+
44
+ :param key: Key to check
45
+ :return: default value
46
+ """
47
+ return too_db_schedule_config["properties"][key]["default"]
48
+
49
+
50
+ # define location of Palomar Observatory
51
+ PALOMAR_LOC = coords.EarthLocation(
52
+ lat=coords.Latitude("33d21m25.5s"),
53
+ lon=coords.Longitude("-116d51m58.4s"),
54
+ height=1696.0,
55
+ )
56
+
57
+ palomar_observer = astroplan.Observer(location=PALOMAR_LOC)