wintertoo 1.7.1__tar.gz → 1.8.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.

Potentially problematic release.


This version of wintertoo might be problematic. Click here for more details.

Files changed (37) hide show
  1. {wintertoo-1.7.1 → wintertoo-1.8.0}/PKG-INFO +2 -2
  2. {wintertoo-1.7.1 → wintertoo-1.8.0}/pyproject.toml +1 -1
  3. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo/data/__init__.py +1 -1
  4. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo/utils.py +65 -22
  5. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo.egg-info/PKG-INFO +2 -2
  6. {wintertoo-1.7.1 → wintertoo-1.8.0}/.github/dependabot.yml +0 -0
  7. {wintertoo-1.7.1 → wintertoo-1.8.0}/.github/workflows/automerge.yml +0 -0
  8. {wintertoo-1.7.1 → wintertoo-1.8.0}/.github/workflows/black.yml +0 -0
  9. {wintertoo-1.7.1 → wintertoo-1.8.0}/.github/workflows/continuous_integration.yml +0 -0
  10. {wintertoo-1.7.1 → wintertoo-1.8.0}/.github/workflows/isort.yml +0 -0
  11. {wintertoo-1.7.1 → wintertoo-1.8.0}/.github/workflows/pylint.yml +0 -0
  12. {wintertoo-1.7.1 → wintertoo-1.8.0}/.gitignore +0 -0
  13. {wintertoo-1.7.1 → wintertoo-1.8.0}/.pre-commit-config.yaml +0 -0
  14. {wintertoo-1.7.1 → wintertoo-1.8.0}/LICENSE +0 -0
  15. {wintertoo-1.7.1 → wintertoo-1.8.0}/README.md +0 -0
  16. {wintertoo-1.7.1 → wintertoo-1.8.0}/setup.cfg +0 -0
  17. {wintertoo-1.7.1 → wintertoo-1.8.0}/tests/test_fields.py +0 -0
  18. {wintertoo-1.7.1 → wintertoo-1.8.0}/tests/test_schedule.py +0 -0
  19. {wintertoo-1.7.1 → wintertoo-1.8.0}/tests/testdata/test_schedule.json +0 -0
  20. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo/__init__.py +0 -0
  21. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo/data/observing_request_schema.json +0 -0
  22. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo/data/summer_fields.txt +0 -0
  23. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo/data/winter_fields.txt +0 -0
  24. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo/database.py +0 -0
  25. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo/errors.py +0 -0
  26. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo/fields.py +0 -0
  27. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo/models/__init__.py +0 -0
  28. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo/models/image.py +0 -0
  29. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo/models/program.py +0 -0
  30. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo/models/too.py +0 -0
  31. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo/schedule.py +0 -0
  32. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo/submit.py +0 -0
  33. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo/validate.py +0 -0
  34. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo.egg-info/SOURCES.txt +0 -0
  35. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo.egg-info/dependency_links.txt +0 -0
  36. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo.egg-info/requires.txt +0 -0
  37. {wintertoo-1.7.1 → wintertoo-1.8.0}/wintertoo.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: wintertoo
3
- Version: 1.7.1
3
+ Version: 1.8.0
4
4
  Author-email: Robert Stein <rdstein@caltech.edu>, Danielle Frostig <frostig@mit.edu>, Viraj Karambelkar <viraj@astro.caltech.edu>
5
5
  License: MIT
6
6
  Project-URL: homepage, https://github.com/winter-telescope/wintertoo
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "wintertoo"
7
- version = "1.7.1"
7
+ version = "1.8.0"
8
8
  description = ""
9
9
  authors = [
10
10
  {name = "Robert Stein", email = "rdstein@caltech.edu"},
@@ -56,6 +56,6 @@ def get_default_value(key: str):
56
56
 
57
57
 
58
58
  # define location of Palomar Observatory
59
- PALOMAR_LOC = coords.EarthLocation.of_site("Palomar")
59
+ PALOMAR_LOC = coords.EarthLocation.of_site("Palomar", refresh_cache=True)
60
60
 
61
61
  palomar_observer = astroplan.Observer(location=PALOMAR_LOC)
@@ -2,7 +2,7 @@
2
2
  # -*- coding: utf-8 -*-
3
3
  """
4
4
  Created on Tue Jan 25 13:51:59 2022
5
- @author: frostig, belatedly edited by Robert Stein
5
+ @author: frostig, belatedly edited by Robert Stein, further belatedly edited by Sam Rose
6
6
  """
7
7
  import logging
8
8
 
@@ -38,6 +38,54 @@ def get_alt_az(times_mjd: list, ra: float, dec: float) -> tuple:
38
38
  return alt_array, az_array
39
39
 
40
40
 
41
+ def get_night_times(time_mjd: astropy.time.Time):
42
+ """
43
+ Get an array of times which cover the night of the date given.
44
+
45
+ Parameters
46
+ ----------
47
+ time_mjd : astropy.time.Time
48
+ date in MJD (median Julian Date), e.g. 59480 (Sept 23)
49
+
50
+ Returns
51
+ -------
52
+ time_array : numpy array
53
+ array of times during the night
54
+
55
+ """
56
+ time = Time(time_mjd, format="mjd")
57
+
58
+ # Rise/fade can fail if target is close to a bin edge
59
+ sun_rise_next = palomar_observer.sun_rise_time(time, which="next")
60
+ sun_set_next = palomar_observer.sun_set_time(time, which="next")
61
+ sun_set_prev = palomar_observer.sun_set_time(time, which="previous")
62
+
63
+ if isinstance(sun_rise_next.value, Masked):
64
+ sun_rise_next = palomar_observer.sun_rise_time(
65
+ time - 0.05 * u.day, which="next"
66
+ )
67
+
68
+ if isinstance(sun_set_next.value, Masked):
69
+ sun_set_next = palomar_observer.sun_set_time(time - 0.05 * u.day, which="next")
70
+
71
+ if isinstance(sun_set_prev.value, Masked):
72
+ sun_set_prev = palomar_observer.sun_set_time(
73
+ time + 0.05 * u.day, which="previous"
74
+ )
75
+
76
+ until_next_sunset = sun_set_next.jd - time.jd
77
+ until_next_sunrise = sun_rise_next.jd - time.jd
78
+
79
+ if until_next_sunrise < until_next_sunset:
80
+ # this is the case where time is during the night
81
+ time_array = np.linspace(sun_set_prev.jd, sun_rise_next.jd, 100)
82
+ else:
83
+ # this is the case where time is during the day
84
+ time_array = np.linspace(sun_set_next.jd, sun_rise_next.jd, 100)
85
+
86
+ return time_array
87
+
88
+
41
89
  def up_tonight(time_mjd: astropy.time.Time, ra: str, dec: str) -> tuple[bool, str]:
42
90
  """
43
91
  what is up (above altitude 20 deg) in a given night?
@@ -50,23 +98,9 @@ def up_tonight(time_mjd: astropy.time.Time, ra: str, dec: str) -> tuple[bool, st
50
98
  :return:
51
99
  """
52
100
  loc = SkyCoord(ra=ra, dec=dec, frame="icrs")
101
+ time_array = get_night_times(time_mjd)
53
102
  time = Time(time_mjd, format="mjd")
54
103
 
55
- # Rise/fade can fail if target is close to a bin edge
56
- sun_rise = palomar_observer.sun_rise_time(time, which="previous")
57
- if isinstance(sun_rise.value, Masked):
58
- sun_rise = palomar_observer.sun_rise_time(time - 0.05 * u.day, which="previous")
59
- sun_set = palomar_observer.sun_set_time(time, which="next")
60
- if isinstance(sun_rise.value, Masked):
61
- sun_set = palomar_observer.sun_rise_time(time + 0.05 * u.day, which="next")
62
-
63
- night = sun_set.jd - sun_rise.jd
64
- if night >= 1:
65
- # if next day, subtract a day
66
- time_array = np.linspace(sun_set.jd, sun_set.jd + (night - 1), 100)
67
- else:
68
- time_array = np.linspace(sun_set.jd, sun_set.jd + night, 100)
69
-
70
104
  altaz = loc.transform_to(
71
105
  AltAz(obstime=Time(time_array, format="jd"), location=PALOMAR_LOC)
72
106
  )
@@ -81,12 +115,21 @@ def up_tonight(time_mjd: astropy.time.Time, ra: str, dec: str) -> tuple[bool, st
81
115
  pass
82
116
 
83
117
  if time_up > 0:
84
- is_available = (
85
- f"Object is up between UTC "
86
- f'{Time(df["time"].iloc[0], format="jd").isot} '
87
- f'and {Time(df["time"].iloc[-1], format="jd").isot}'
88
- )
89
- avail_bool = True
118
+ if time.jd > df["time"].iloc[-1]:
119
+ is_available = (
120
+ f"Object is up between UTC "
121
+ f'{Time(df["time"].iloc[0]+1, format="jd").isot} '
122
+ f'and {Time(df["time"].iloc[-1]+1, format="jd").isot}'
123
+ )
124
+ avail_bool = True
125
+
126
+ else:
127
+ is_available = (
128
+ f"Object is up between UTC "
129
+ f'{Time(df["time"].iloc[0], format="jd").isot} '
130
+ f'and {Time(df["time"].iloc[-1], format="jd").isot}'
131
+ )
132
+ avail_bool = True
90
133
  else:
91
134
  is_available = "Object is not up"
92
135
  avail_bool = False
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: wintertoo
3
- Version: 1.7.1
3
+ Version: 1.8.0
4
4
  Author-email: Robert Stein <rdstein@caltech.edu>, Danielle Frostig <frostig@mit.edu>, Viraj Karambelkar <viraj@astro.caltech.edu>
5
5
  License: MIT
6
6
  Project-URL: homepage, https://github.com/winter-telescope/wintertoo
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes