Browse Source

GST in summary. Persistence checked ant

pull/1/head
Benito Marcote 2 years ago
parent
commit
877cb6564b
  1. 2
      app.py
  2. BIN
      src/__pycache__/functions.cpython-36.pyc
  3. BIN
      src/__pycache__/graphical_elements.cpython-36.pyc
  4. 19
      src/functions.py
  5. 5
      src/graphical_elements.py

2
app.py

@ -470,7 +470,7 @@ app.layout = html.Div([
html.Br(),
html.Div(className='antcheck', children=[
dbc.FormGroup([
Checkbox(id=f"check_{s.codename}",
Checkbox(id=f"check_{s.codename}", persistence=True,
className='custom-control-input',
disabled=not s.has_band(selected_band)),
dbc.Label(s.name, html_for=f"check_{s.codename}",

BIN
src/__pycache__/functions.cpython-36.pyc

Binary file not shown.

BIN
src/__pycache__/graphical_elements.cpython-36.pyc

Binary file not shown.

19
src/functions.py

@ -161,6 +161,7 @@ def print_obs_times(obs, date_format='%d %b %Y'):
"""Given an observation, it returns the time range (starttime-endtime) in a smart
way. If the observation lasts for less than one day it omits the end date:
20 Jan 1971 10:00-20:00UT
It also adds the GST range after that.
Input:
- obs : observation.Observation
@ -173,19 +174,25 @@ def print_obs_times(obs, date_format='%d %b %Y'):
A string showing the time-range of the observation.
"""
gsttext = "{:02n}:{:02.2n}-{:02n}:{:02.2n}".format((obs.gstimes[0].hour*60) // 60,
(obs.gstimes[0].hour*60) % 60,
(obs.gstimes[-1].hour*60) // 60,
(obs.gstimes[0].hour*60) % 60)
if obs.times[0].datetime.date() == obs.times[-1].datetime.date():
return "{}\n{}-{} UTC".format(obs.times[0].datetime.strftime(date_format),
return "{}\n{}-{} UTC\nGST: {}".format(obs.times[0].datetime.strftime(date_format),
obs.times[0].datetime.strftime('%H:%M'),
obs.times[-1].datetime.strftime('%H:%M'))
obs.times[-1].datetime.strftime('%H:%M'), gsttext)
elif (obs.times[-1] - obs.times[0]) < 24*u.h:
return "{}\n{}-{} UTC (+1d)".format(obs.times[0].datetime.strftime(date_format),
return "{}\n{}-{} UTC (+1d)\nGST: {}".format(
obs.times[0].datetime.strftime(date_format),
obs.times[0].datetime.strftime('%H:%M'),
obs.times[-1].datetime.strftime('%H:%M'))
obs.times[-1].datetime.strftime('%H:%M'), gsttext)
else:
return "{} {} to {} {} UTC".format(obs.times[0].datetime.strftime(date_format),
return "{} {} to {} {} UTC\nGST: {}".format(
obs.times[0].datetime.strftime(date_format),
obs.times[0].datetime.strftime('%H:%M'),
obs.times[-1].datetime.strftime(date_format),
obs.times[-1].datetime.strftime('%H:%M'))
obs.times[-1].datetime.strftime('%H:%M'), gsttext)

5
src/graphical_elements.py

@ -192,8 +192,9 @@ def summary_card_times(app, obs):
prtobstimes = fx.print_obs_times(obs)
if '\n' in prtobstimes:
tmp = [html.Span(t) for t in fx.print_obs_times(obs).split('\n')]
tmp.insert(1, html.Br())
temp_msg = [tmp]
for i in range(len(tmp)-1):
tmp.insert(2*i+1, html.Br())
temp_msg = [tmp]
else:
temp_msg = [f"{fx.print_obs_times(obs)}."]

Loading…
Cancel
Save