Browse Source

Bug fix: use the time range appointed to a station widget tab, when its data range is empty.

master
Bob Eldering 3 months ago
parent
commit
8c461f1a3f
3 changed files with 34 additions and 12 deletions
  1. +7
    -3
      antab_editor_lib/general.py
  2. +17
    -8
      antab_editor_lib/poly_plot.py
  3. +10
    -1
      antab_editor_lib/station_widget.py

+ 7
- 3
antab_editor_lib/general.py View File

@@ -59,9 +59,13 @@ class WarningsWidget(QTableWidget):
def check_frequency_range(self, station):
widget = self.station_widgets[station]
all_in_range = True
for station_data in widget.get_station_data_sections():
time_range = (min(station_data.data.index),
max(station_data.data.index))
for inherent_time_range, station_data in \
widget.get_timed_station_data_sections():
if len(station_data.data.index) == 0:
time_range = inherent_time_range
else:
time_range = (min(station_data.data.index),
max(station_data.data.index))
frequency_channels = get_frequency_channels(
self.meta_data.get_vex(), station, time_range)
all_in_range = all_in_range and \


+ 17
- 8
antab_editor_lib/poly_plot.py View File

@@ -1,6 +1,7 @@
from .plot import clickable_legend, update_legend
from .station_data import get_gain
from .meta_data import get_frequency_channels, get_station_scans_for_times
from .meta_data import get_frequency_channels, get_station_scans_for_times, \
get_station_scans_for_time_range

import matplotlib.pyplot as plt
from matplotlib.text import Text
@@ -48,16 +49,24 @@ class PolyPlotWidget(QWidget):
def plot(self):
station_polys = defaultdict(dict)
station_axis_types = defaultdict(set)
scans = self.meta_data.get_vex()["SCHED"].values()
for station, station_widget in self.station_widgets.items():
for station_data in station_widget.get_station_data_sections():
time_range = (min(station_data.data.index),
max(station_data.data.index))
for inherent_time_range, station_data in \
station_widget.get_timed_station_data_sections():
if len(station_data.data.index) == 0:
# when an antab file has no time data (anymore),
# use the time range it was initially create with
time_range = inherent_time_range
station_scans = get_station_scans_for_time_range(
scans, station, time_range)
else:
time_range = (min(station_data.data.index),
max(station_data.data.index))
station_scans = get_station_scans_for_times(
scans, station, station_data.data.index)
frequency_channels = get_frequency_channels(
self.meta_data.get_vex(), station, time_range)
modes = set(scan["mode"]
for scan in get_station_scans_for_times(
self.meta_data.get_vex()["SCHED"].values(),
station, station_data.data.index))
modes = set(scan["mode"] for scan in station_scans)
line_label = ",".join(modes)
gain = get_gain(station_data.header, frequency_channels)


+ 10
- 1
antab_editor_lib/station_widget.py View File

@@ -206,7 +206,12 @@ class StationTabsWidget(QTabWidget):
def get_station_data_sections(self):
return [station_data for w in self._get_tab_widgets()
for station_data in w.get_station_data_sections()]

def get_timed_station_data_sections(self):
# returns [(inherent_time_range, station_data)]
return [timed_station_data for w in self._get_tab_widgets()
for timed_station_data in w.get_timed_station_data_sections()]


class StationWidget(QSplitter):
header_changed = pyqtSignal()
@@ -216,6 +221,7 @@ class StationWidget(QSplitter):
super().__init__(parent)

self.station_data = station_data
self.inherent_time_range = time_range
self.meta_data = meta_data
self.model = TsysModel(self.station_data)
plot = PlotWidget(self.station_data, meta_data, parent=self)
@@ -293,3 +299,6 @@ class StationWidget(QSplitter):

def get_station_data_sections(self):
return [self.station_data]

def get_timed_station_data_sections(self):
return [(self.inherent_time_range, self.station_data)]

Loading…
Cancel
Save