From 595ac5f02fb695928c9e030a5f399f0787fc92c4 Mon Sep 17 00:00:00 2001 From: Tammo Jan Dijkema <T.J.Dijkema@gmail.com> Date: Tue, 16 Jan 2024 22:33:04 +0100 Subject: [PATCH] Remove most of astropy --- power_plot.py | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/power_plot.py b/power_plot.py index b1124fe..a9d7cc7 100755 --- a/power_plot.py +++ b/power_plot.py @@ -1,10 +1,6 @@ #!/usr/bin/env python3 -from astropy.table import Table from astropy.time import Time -from astropy.coordinates import ICRS, AltAz, EarthLocation, SkyCoord -import astropy.units as u -import astropy.constants import sys import os @@ -44,7 +40,7 @@ last_seconds = 10 * 60 class PowerPlot: """A power plot with two time scales""" - def __init__(self, fig, freq): + def __init__(self, fig): self.fig = fig self.ax = fig.add_subplot() self.ax.set_xlabel("time (s)") @@ -54,7 +50,7 @@ class PowerPlot: self.ax.xaxis.set_major_formatter( FuncFormatter(lambda x, pos: f"{num2date(x):%H:%M}") ) - fig.suptitle(f"Sgr A Occultation ({freq:.0f} MHz)", fontsize=16) + fig.suptitle(f"Plot title", fontsize=16) fig.tight_layout() (self.totalplot,) = self.ax.plot([], [], "-", color="blue") (self.totalplothighlight,) = self.ax.plot( @@ -121,16 +117,6 @@ class PowerPlotMainWindow(QMainWindow): column_names = line.split() break - table = Table.read("".join(header_lines), format="ascii.ecsv") - - self.col_first_bin = table.meta["spectrum"]["col_first_bin"] - freqs = ( - np.array([float(col) for col in table.columns[self.col_first_bin :]]) / 1e6 - ) # In MHz - num_bins = table.meta["spectrum"]["bins"] - in_db = table.meta["spectrum"]["db"] - freq = table.meta["vrt"]["frequency"] / 1e6 - line = sys.stdin.readline() values = line.split(",") self.time_dt = np.array(Time(values[0], format="unix").to_datetime()) @@ -140,9 +126,7 @@ class PowerPlotMainWindow(QMainWindow): self.min_range = np.arange(-last_seconds, 1, 1) - self.data = np.array( - [(np.array(values[self.col_first_bin :], dtype=float).mean())] - ) + self.data = np.array([float(values[1])]) self.start_time = Time("2023-12-13T09:15:00").to_datetime() self.stop_time = Time("2023-12-13T11:30:00").to_datetime() @@ -169,7 +153,7 @@ class PowerPlotMainWindow(QMainWindow): # fig.canvas.manager.set_window_title("Dwingeloo Radio Telescope") - self.powerplot = PowerPlot(fig, freq) + self.powerplot = PowerPlot(fig) self.read_stdin() self.stdin_notifier = QSocketNotifier( @@ -186,12 +170,9 @@ class PowerPlotMainWindow(QMainWindow): self.output_counter += 1 values = line.split(",") time_now = float(values[0]) - power_now = ( - np.array(values[self.col_first_bin :], dtype=float)[0] - ) - self.time_dt = np.append( - self.time_dt, Time(values[0], format="unix").to_datetime() - ) + power_now = float(values[1]) + + self.time_dt = np.append(self.time_dt, Time(values[0], format="unix").to_datetime()) self.data = np.append(self.data, power_now) self.last_x_buffer = np.roll(self.last_x_buffer, -1) @@ -212,8 +193,6 @@ class PowerPlotMainWindow(QMainWindow): self.powerplot.fig.canvas.flush_events() self.last_update = now - # time.sleep(1) - def handle_interrupt_signal(signum, frame): print("Ctrl+C pressed. Handling interrupt signal.") -- GitLab