Compare commits

...

3 Commits

  1. 9
      antab_editor_lib/edit_widget.py
  2. 10
      antab_editor_lib/general.py
  3. 25
      antab_editor_lib/poly_plot.py
  4. 11
      antab_editor_lib/station_widget.py
  5. 2
      setup.py

9
antab_editor_lib/edit_widget.py

@ -69,10 +69,10 @@ class FillWidget(QWidget):
# create a list of indices to update values
if what.startswith("Fill"):
target_indices = data[target].isna().to_numpy().nonzero()[0]
if len(target_indices) == 0:
continue
else:
target_indices = list(range(data.shape[0]))
if len(target_indices) == 0:
continue
if method == "interpolating":
valid_series = data.loc[data[target].notna(), target]
valid_values = valid_series.to_numpy()
@ -104,8 +104,11 @@ class FillWidget(QWidget):
interpolate.splev(destination_timestamps, fit, der=0))
elif method == "nominal values":
time_range = (min(self.station_data.data.index),
max(self.station_data.data.index))
frequency_channels = get_frequency_channels(
self.meta_data.get_vex(), self.station_data.station)
self.meta_data.get_vex(), self.station_data.station,
time_range)
gain = get_gain(self.station_data.header, frequency_channels)
if gain is None:
raise RuntimeError("No matching GAIN frequency, cannot "

10
antab_editor_lib/general.py

@ -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 \

25
antab_editor_lib/poly_plot.py

@ -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)

11
antab_editor_lib/station_widget.py

@ -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)]

2
setup.py

@ -4,7 +4,7 @@ import setuptools
setuptools.setup(
name="antab_editor",
version="0.11.1",
version="0.11.2",
author="Bob Eldering",
author_email="eldering@jive.eu",
description="Antab editor",

Loading…
Cancel
Save