Exemplo n.º 1
0
def calculate_everything(button, array_codes, band, data_rate, source,
                         starttime, duration):
    if duration == '0.0' or float(duration) <= 0.0:
        return 'Set a duration and press "Calculate"'

    duration = float(duration)
    antennas = stationList.get_stations_with_codes(array_codes)
    # If source and/or start of observation are not set, then regular sensitivity calc.
    if source == 'hh:mm:ss dd:mm:ss' or starttime == 'DD/MM/YYYY HH:MM':
        obs_times = uf.get_obs_times(uf.get_time('01/01/1993 03:14'), duration,
                                     duration)
        ant_times = [obs_times] * len(antennas)
        # Dummy elevation (40 deg) for all stations
        elevations = np.ones((len(antennas), len(obs_times))) * 40
    else:
        # NOTE: Check for source and startime format!!!!
        obs_times = uf.get_obs_times(uf.get_time(starttime), duration, 0.3)
        ant_times, elevations = uf.times_elev_with_source_above(
            uf.get_coordinates(source), antennas, obs_times)

    # Remove all stations that do not observe the source
    antennas = [a for a, t in zip(antennas, ant_times) if len(t) > 0]
    if len(antennas) > 0:
        ant_times = [t for t in ant_times if len(t) > 0]
        elevations = [e for e in elevations if len(e) > 0]
        rms = uf.get_thermal_noise(antennas, ant_times, data_rate * 1e6, band)
        return formatted_text(rms, uf.get_bandwidth_smearing(),
                              uf.get_time_smearing())
Exemplo n.º 2
0
def update_plot_visibility(button, antenna_codes, bands, source, starttime,
                           duration):
    if (source == 'hh:mm:ss dd:mm:ss' or starttime == 'DD/MM/YYYY HH:MM'
            or float(duration) <= 0.0):
        return None

    obs_times = uf.get_obs_times(uf.get_time(starttime), float(duration),
                                 time_interval)
    antennas = stationList.get_stations_with_codes(antenna_codes)
    ant_times, elevations = uf.times_elev_with_source_above(
        uf.get_coordinates(source), antennas, obs_times)
    antennas = [a for a, t in zip(antennas, ant_times) if len(t) > 0]
    if len(antennas) > 0:
        ant_times = [t for t in ant_times if len(t) > 0]
        elevations = [e for e in elevations if len(e) > 0]
        return pf.time_visibility(ant_times,
                                  elevations, [s.name for s in antennas],
                                  xlim=(obs_times[0].datetime,
                                        obs_times[-1].datetime))