wintertoo 1.7.1__py3-none-any.whl → 1.8.0__py3-none-any.whl

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.

@@ -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)
wintertoo/utils.py CHANGED
@@ -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
@@ -22,23 +22,23 @@ Requires-Python: >=3.9
22
22
  Description-Content-Type: text/markdown
23
23
  License-File: LICENSE
24
24
  Requires-Dist: pandas
25
- Requires-Dist: astropy >=6.0.0
26
- Requires-Dist: astroplan >=0.10
25
+ Requires-Dist: astropy>=6.0.0
26
+ Requires-Dist: astroplan>=0.10
27
27
  Requires-Dist: matplotlib
28
28
  Requires-Dist: numpy
29
29
  Requires-Dist: pytz
30
30
  Requires-Dist: jsonschema
31
31
  Requires-Dist: sqlalchemy
32
- Requires-Dist: pydantic >=2.2.0
32
+ Requires-Dist: pydantic>=2.2.0
33
33
  Requires-Dist: pre-commit
34
34
  Requires-Dist: bcrypt
35
35
  Requires-Dist: psycopg
36
36
  Requires-Dist: psycopg-binary
37
37
  Provides-Extra: dev
38
- Requires-Dist: black >=24.1.0 ; extra == 'dev'
39
- Requires-Dist: isort >=5.13.0 ; extra == 'dev'
40
- Requires-Dist: pylint >=3.0.0 ; extra == 'dev'
41
- Requires-Dist: coveralls ; extra == 'dev'
38
+ Requires-Dist: black>=24.1.0; extra == "dev"
39
+ Requires-Dist: isort>=5.13.0; extra == "dev"
40
+ Requires-Dist: pylint>=3.0.0; extra == "dev"
41
+ Requires-Dist: coveralls; extra == "dev"
42
42
 
43
43
  # wintertoo
44
44
  [![PyPI version](https://badge.fury.io/py/wintertoo.svg)](https://badge.fury.io/py/wintertoo)
@@ -4,9 +4,9 @@ wintertoo/errors.py,sha256=iAFcy0z3A3bCnkJmAt_P-77fPaPHFGS1JbrK6O2dCEM,223
4
4
  wintertoo/fields.py,sha256=TDSOwJeR4UvfzKQCaIqoPLv0hSU_73TZwQcZ2FbnO8Q,6029
5
5
  wintertoo/schedule.py,sha256=xYQ7tp5Yjg3gi65dAMqfILPEnJOc6GU-GmwhCVSl_Nc,5790
6
6
  wintertoo/submit.py,sha256=2Z3MgL7uYAj8KJaeTDoEMd1w5dk_BEH-Uqm6cniVzus,3194
7
- wintertoo/utils.py,sha256=B3TxnMUzJi05jYqfAuPnZ2gTzYHWzKlK6KW6CHjvbLc,3274
7
+ wintertoo/utils.py,sha256=3UcES0qntC-gR96lmwzMq9KB9_DjDEgB-ITFM65Aslg,4561
8
8
  wintertoo/validate.py,sha256=RfgCnsJrx9GUSgE_WjxT1MhZfsg0AE-58ROMnhS-RKk,10424
9
- wintertoo/data/__init__.py,sha256=X4VXM59gawC6FALWeaA2DfO3TiYvluQCp2UuLNKTSvM,1665
9
+ wintertoo/data/__init__.py,sha256=6y0GEJllhlEO7yFQ_PmKZ_56rgMt25l7d6mRSmN9o_A,1685
10
10
  wintertoo/data/observing_request_schema.json,sha256=HyPcP2ABRDdPmgdnPX4XP4H97DhnSqVhHUk9uDmUnos,1708
11
11
  wintertoo/data/summer_fields.txt,sha256=5Sc7MBUacelzaq1KHSLmfAyZ3WB5YifMNwKRjBRBcRk,52684603
12
12
  wintertoo/data/winter_fields.txt,sha256=d2arp06H9Cy801YqnQy9AaEk4AoNF-Hg0xAwlqv2fgE,3193011
@@ -14,8 +14,8 @@ wintertoo/models/__init__.py,sha256=c2GEbIHvOT34IhpiMyqA7Tn83hEmnwx6Q7BuxURp97k,
14
14
  wintertoo/models/image.py,sha256=VdlyF_goBMzmAmMHSIevEbheQOLMzFdxz10AK5Wwmqw,4066
15
15
  wintertoo/models/program.py,sha256=mtewVnt7NxSK0hxX8aUO8qehEtOi_Cieli4voCCRh4I,1804
16
16
  wintertoo/models/too.py,sha256=-gFig0Zp_QgSrbgpZkx3dQU70Fxko218QUCQp5uptxE,7338
17
- wintertoo-1.7.1.dist-info/LICENSE,sha256=1-4yY2S7St-8Koy4JGheNG9QPkwff7831u2JITQ2oQs,1063
18
- wintertoo-1.7.1.dist-info/METADATA,sha256=rVUufmhbuhWFWOPQtcSI80tU4K4bWOpdFUNjRbVQUNw,2513
19
- wintertoo-1.7.1.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
20
- wintertoo-1.7.1.dist-info/top_level.txt,sha256=6SMjMBzaNrD77erdCiVcRTrPZ-x98SDX43akRjWj4T8,10
21
- wintertoo-1.7.1.dist-info/RECORD,,
17
+ wintertoo-1.8.0.dist-info/LICENSE,sha256=1-4yY2S7St-8Koy4JGheNG9QPkwff7831u2JITQ2oQs,1063
18
+ wintertoo-1.8.0.dist-info/METADATA,sha256=fBZo0U2URqbRD73_mJRCl65TrBZ78ksnnH7ymIC42_M,2503
19
+ wintertoo-1.8.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
20
+ wintertoo-1.8.0.dist-info/top_level.txt,sha256=6SMjMBzaNrD77erdCiVcRTrPZ-x98SDX43akRjWj4T8,10
21
+ wintertoo-1.8.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.3.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5