Browse Source

Fixed and improved GST values

pull/1/head
Benito Marcote 9 months ago
parent
commit
66a42f49e0
  1. 127
      app.py

127
app.py

@ -20,6 +20,7 @@ from os import path
from time import sleep
import itertools
from importlib import resources
import datetime
from datetime import datetime as dt
import numpy as np
import dash
@ -70,36 +71,6 @@ sorted_networks = {'EVN': 'EVN: European VLBI Network', 'eMERLIN': 'eMERLIN (out
'KVN': 'KVN: Korean VLBI Network',
'Other': 'Other antennas',
'Decom': 'Decommissioned antennas'}
# default_arrays = {'EVN': ['Ef', 'Hh', 'Jb2', 'Mc', 'Nt', 'Ur', 'On', 'Sr', 'T6', 'Tr',
# 'Ys', 'Wb', 'Bd', 'Sv', 'Zc', 'Ir'],
# 'e-EVN': ['Ef', 'Hh', 'Jb2', 'Mc', 'Nt', 'On', 'T6', 'Tr', 'Ys', 'Wb',
# 'Bd', 'Sv', 'Zc', 'Ir', 'Sr'],
# 'eMERLIN': ['Cm', 'Kn', 'Pi', 'Da', 'De', 'Jb2'],
# 'LBA': ['ATCA', 'Pa', 'Mo', 'Ho', 'Cd', 'Td', 'Ww'],
# 'VLBA': ['Br', 'Fd', 'Hn', 'Kp', 'La', 'Mk', 'Nl', 'Ov', 'Pt', 'Sc'],
# 'KVN': ['Ky', 'Ku', 'Kt'],
# 'Global VLBI': ['Ef', 'Hh', 'Jb2', 'Mc', 'Nt', 'Ur', 'On', 'Sr', 'T6',
# 'Tr', 'Ys', 'Wb', 'Bd', 'Sv', 'Zc', 'Ir', 'Br', 'Fd', 'Hn',
# 'Kp', 'La', 'Mk', 'Nl', 'Ov', 'Pt', 'Sc'],
# 'HSA': ['Br', 'Fd', 'Hn', 'Kp', 'La', 'Mk', 'Nl', 'Ov', 'Pt', 'Sc', 'Ef', #'Ar',
# 'Gb', 'Y27'],
# 'GMVA': ['Ef', 'Mh', 'On', 'Ys', 'Pv', 'PdB', 'Br', 'Fd', 'Kp', 'La', 'Mk', 'Nl',
# 'Ov', 'Pt', 'Gb'],
# 'EHT': ['ALMA', 'Pv', 'LMT', 'PdB', 'SMA', 'JCMT', 'APEX', 'SMT', 'SPT']}
#
# vlbi_networks_names = {'EVN': 'European VLBI Network',
# 'eMERLIN': 'eMERLIN',
# 'LBA': 'Australian Long Baseline Array',
# 'VLBA': 'Very Long Baseline Array',
# 'KVN': 'Korean VLBI Network',
# # 'Global VLBI': 'Global VLBI (VLBA+EVN)',
# 'HSA': 'High Sensitivity Array',
# 'GMVA': 'Global mm-VLBI Array',
# 'EHT': 'Event Horizon Telescope'}
# default_datarates = {'EVN': 2048, 'e-EVN': 2048, 'eMERLIN': 4096, 'LBA': 1024, 'VLBA': 4096, 'KVN': 4096,
# 'Global VLBI': 2048, 'HSA': 2048, 'GMVA': 4096, 'EHT': 2**15}
# Safety check that all these antennas are available in the file
for a_array in default_arrays:
@ -749,7 +720,7 @@ def main_page(results_visible=False, summary_output=None, fig_elev_output=None,
]),
]),
html.Div(className='col-9 text-center justify-content-center', children=[
dcc.Loading(id="loading", children=[html.Div(id="loading-output")],
dcc.Loading(id="loading", children=[html.Br(), html.Div(id="loading-output")],
type="dot")
]),
html.Div([dbc.Tooltip(ge.antenna_card(app, s), placement='right',
@ -1244,7 +1215,7 @@ def get_fig_ant_elev(obs):
data_fig.append({'x': obs.times.datetime, 'y': np.zeros_like(obs.times)+10,
'mode': 'lines', 'hoverinfo': 'skip', 'name': 'Elev. limit 10º',
'line': {'dash': 'dash', 'opacity': 0.5, 'color': 'gray'}})
data_fig.append({'x': np.unwrap(obs.gstimes.value), 'y': np.zeros_like(obs.times)+20,
data_fig.append({'x': np.unwrap(obs.gstimes.value*2*np.pi/24)*24/(2*np.pi), 'y': np.zeros_like(obs.times)+20,
'xaxis': 'x2', 'mode': 'lines', 'hoverinfo': 'skip',
'name': 'Elev. limit 20º', 'line': {'dash': 'dot', 'opacity': 0.5,
'color': 'gray'}})
@ -1257,26 +1228,30 @@ def get_fig_ant_elev(obs):
'xaxis2': {'title': {'text': 'Time (GST)', 'standoff': 0},
'showgrid': False, 'overlaying': 'x', #'dtick': 1.0,
'tickvals': np.arange(np.ceil(obs.gstimes.value[0]),
np.floor(np.unwrap(obs.gstimes.value)[-1])+1),
np.floor(np.unwrap(obs.gstimes.value*2*np.pi/24)[-1]*24/(2*np.pi))+1),
'ticktext': np.arange(np.ceil(obs.gstimes.value[0]),
np.floor(np.unwrap(obs.gstimes.value)[-1])+1) % 24,
np.floor(np.unwrap(obs.gstimes.value*2*np.pi/24)[-1]*24/(2*np.pi))+1)%24,
'ticks': 'inside', 'showline': True, 'mirror': False,
'hovermode': 'closest', 'color': 'black', 'side': 'top'},
'yaxis': {'title': 'Elevation (degrees)', 'range': [0., 92.],
'ticks': 'inside', 'showline': True, 'mirror': "all",
'showgrid': False, 'hovermode': 'closest'},
'zeroline': True, 'zerolinecolor': 'k'}}
'zeroline': True, 'zerolinecolor': 'k'}}
def get_fig_ant_up(obs):
data_fig = []
data_dict = obs.is_visible()
gstimes = np.unwrap(obs.gstimes.value*2*np.pi/24)*24/(2*np.pi)
gstimes = np.array([dt(obs.times.datetime[0].year, obs.times.datetime[0].month, obs.times.datetime[0].day) \
+ datetime.timedelta(seconds=gst*3600) for gst in gstimes])
for i,ant in enumerate(data_dict):
data_fig.append({'x': np.unwrap(obs.gstimes.value)[data_dict[ant]],
# obs.times.datetime[data_dict[ant]],
# xs = [obs.times.datetime[0].date() + datetime.timedelta(seconds=i*3600) for i in np.unwrap(obs.gstimes.value*2*np.pi/24)[data_dict[ant]]*24/(2*np.pi)]
xs = gstimes[data_dict[ant]]
data_fig.append({'x': xs,
'y': np.zeros_like(data_dict[ant][0])-i, 'type': 'scatter',
'hovertemplate': "%{x}",
'hovertemplate': "GST %{x}",
'mode': 'markers', 'marker_symbol': "41",
'hoverinfo': "skip",
'name': obs.stations[ant].name})
@ -1286,16 +1261,20 @@ def get_fig_ant_up(obs):
'mode': 'lines', 'hoverinfo': 'skip', 'showlegend': False,
'line': {'dash': 'dot', 'opacity': 0.0, 'color': 'white'}})
return {'data': data_fig,
'layout': {'title': 'Source visible during the observation',
'layout': {'title': {'text': 'Source visible during the observation',
'y': 1, 'yanchor': 'top'},
'hovermode': 'closest',
'xaxis': {'title': 'Time (GST)', 'showgrid': False,
'range': [gstimes[0], gstimes[-1]],
# 'tickvals': np.arange(np.ceil(obs.gstimes.value[0]),
# np.floor(np.unwrap(obs.gstimes.value*2*np.pi/24)[-1]*24/(2*np.pi))+1),
# 'ticktext': np.arange(np.ceil(obs.gstimes.value[0]),
# np.floor(np.unwrap(obs.gstimes.value*2*np.pi/24)[-1]*24/(2*np.pi))+1)%24,
'tickformat': '%H:%M',
'ticks': 'inside', 'showline': True, 'mirror': False,
'hovermode': 'closest', 'color': 'black'},
'xaxis2': {'title': {'text': 'Time (UTC)', 'standoff': 0},
'showgrid': False, 'overlaying': 'x', #'dtick': 1.0,
# 'tickvals': np.arange(np.ceil(obs.gstimes.value[0]),
# np.floor(np.unwrap(obs.gstimes.value)[-1])+1),
# 'ticktext': np.arange(np.ceil(obs.gstimes.value[0]),
# np.floor(np.unwrap(obs.gstimes.value)[-1])+1) % 24,
'ticks': 'inside', 'showline': True, 'mirror': False,
'hovermode': 'closest', 'color': 'black', 'side': 'top'},
'yaxis': {'ticks': '', 'showline': True, 'mirror': True,
@ -1303,37 +1282,37 @@ def get_fig_ant_up(obs):
'showgrid': False, 'hovermode': 'closest',
'startline': False}}}
# data_fig = []
# data_dict = obs.is_visible()
# for i,ant in enumerate(data_dict):
# data_fig.append({'x': obs.times.datetime[data_dict[ant]],
# 'y': np.zeros_like(data_dict[ant][0])-i, 'type': 'scatter',
# 'hovertemplate': "%{x}",
# 'mode': 'markers', 'marker_symbol': "41",
# 'hoverinfo': "skip",
# 'name': obs.stations[ant].name})
#
# data_fig.append({'x': np.unwrap(obs.gstimes.value), 'y': np.zeros_like(obs.times)-0.5,
# 'xaxis': 'x2',
# 'mode': 'lines', 'hoverinfo': 'skip', 'showlegend': False,
# 'line': {'dash': 'dot', 'opacity': 0.0, 'color': 'white'}})
# return {'data': data_fig,
# 'layout': {'title': 'Source visible during the observation',
# 'xaxis': {'title': 'Time (UTC)', 'showgrid': False,
# 'ticks': 'inside', 'showline': True, 'mirror': False,
# 'hovermode': 'closest', 'color': 'black'},
# 'xaxis2': {'title': {'text': 'Time (GST)', 'standoff': 0},
# 'showgrid': False, 'overlaying': 'x', #'dtick': 1.0,
# 'tickvals': np.arange(np.ceil(obs.gstimes.value[0]),
# np.floor(np.unwrap(obs.gstimes.value)[-1])+1),
# 'ticktext': np.arange(np.ceil(obs.gstimes.value[0]),
# np.floor(np.unwrap(obs.gstimes.value)[-1])+1) % 24,
# 'ticks': 'inside', 'showline': True, 'mirror': False,
# 'hovermode': 'closest', 'color': 'black', 'side': 'top'},
# 'yaxis': {'ticks': '', 'showline': True, 'mirror': True,
# 'showticklabels': False, 'zeroline': False,
# 'showgrid': False, 'hovermode': 'closest',
# 'startline': False}}}
data_fig = []
data_dict = obs.is_visible()
for i,ant in enumerate(data_dict):
data_fig.append({'x': obs.times.datetime[data_dict[ant]],
'y': np.zeros_like(data_dict[ant][0])-i, 'type': 'scatter',
'hovertemplate': "%{x}",
'mode': 'markers', 'marker_symbol': "41",
'hoverinfo': "skip",
'name': obs.stations[ant].name})
data_fig.append({'x': np.unwrap(obs.gstimes.value), 'y': np.zeros_like(obs.times)-0.5,
'xaxis': 'x2',
'mode': 'lines', 'hoverinfo': 'skip', 'showlegend': False,
'line': {'dash': 'dot', 'opacity': 0.0, 'color': 'white'}})
return {'data': data_fig,
'layout': {'title': 'Source visible during the observation',
'xaxis': {'title': 'Time (UTC)', 'showgrid': False,
'ticks': 'inside', 'showline': True, 'mirror': False,
'hovermode': 'closest', 'color': 'black'},
'xaxis2': {'title': {'text': 'Time (GST)', 'standoff': 0},
'showgrid': False, 'overlaying': 'x', #'dtick': 1.0,
'tickvals': np.arange(np.ceil(obs.gstimes.value[0]),
np.floor(np.unwrap(obs.gstimes.value)[-1])+1),
'ticktext': np.arange(np.ceil(obs.gstimes.value[0]),
np.floor(np.unwrap(obs.gstimes.value)[-1])+1) % 24,
'ticks': 'inside', 'showline': True, 'mirror': False,
'hovermode': 'closest', 'color': 'black', 'side': 'top'},
'yaxis': {'ticks': '', 'showline': True, 'mirror': True,
'showticklabels': False, 'zeroline': False,
'showgrid': False, 'hovermode': 'closest',
'startline': False}}}
def get_fig_uvplane(obs):

Loading…
Cancel
Save