2019-09-01 21:13:21 +00:00
|
|
|
# NanoVNASaver - a python program to view and export Touchstone data from a NanoVNA
|
|
|
|
# Copyright (C) 2019. Rune B. Broberg
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
import collections
|
2019-09-05 12:56:40 +00:00
|
|
|
import math
|
2019-10-13 15:35:32 +00:00
|
|
|
from typing import List, Set
|
2019-09-13 15:08:20 +00:00
|
|
|
import numpy as np
|
2019-09-22 11:42:05 +00:00
|
|
|
import logging
|
2019-11-08 12:58:14 +00:00
|
|
|
from scipy import signal
|
2019-09-01 21:13:21 +00:00
|
|
|
|
|
|
|
from PyQt5 import QtWidgets, QtGui, QtCore
|
2019-10-13 08:37:14 +00:00
|
|
|
from PyQt5.QtCore import pyqtSignal
|
2019-09-01 21:13:21 +00:00
|
|
|
|
2020-05-18 18:58:18 +00:00
|
|
|
from NanoVNASaver.Charts.Chart import Chart
|
2019-10-18 22:58:31 +00:00
|
|
|
from NanoVNASaver.RFTools import Datapoint, RFTools
|
2019-11-10 18:52:40 +00:00
|
|
|
from NanoVNASaver.SITools import Format, Value
|
2020-05-18 18:58:18 +00:00
|
|
|
from NanoVNASaver.Marker import Marker
|
2019-09-22 11:42:05 +00:00
|
|
|
logger = logging.getLogger(__name__)
|
2019-09-01 21:13:21 +00:00
|
|
|
|
|
|
|
|
2019-09-19 12:15:47 +00:00
|
|
|
class SquareChart(Chart):
|
|
|
|
def __init__(self, name):
|
|
|
|
super().__init__(name)
|
|
|
|
sizepolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.MinimumExpanding)
|
|
|
|
self.setSizePolicy(sizepolicy)
|
2019-10-14 17:14:10 +00:00
|
|
|
self.chartWidth = self.width()-40
|
|
|
|
self.chartHeight = self.height()-40
|
2019-09-19 12:15:47 +00:00
|
|
|
|
|
|
|
def resizeEvent(self, a0: QtGui.QResizeEvent) -> None:
|
2019-10-14 17:14:10 +00:00
|
|
|
if not self.isPopout:
|
|
|
|
self.setFixedWidth(a0.size().height())
|
|
|
|
self.chartWidth = a0.size().height()-40
|
|
|
|
self.chartHeight = a0.size().height()-40
|
|
|
|
else:
|
|
|
|
min_dimension = min(a0.size().height(), a0.size().width())
|
|
|
|
self.chartWidth = self.chartHeight = min_dimension - 40
|
2019-09-19 12:15:47 +00:00
|
|
|
self.update()
|
|
|
|
|
|
|
|
|