Skip to content

Commit

Permalink
add log(x), log(y) to read/view curve
Browse files Browse the repository at this point in the history
  • Loading branch information
gituser789 committed Jul 13, 2022
1 parent c1bb98b commit ffb1a7b
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 56 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- General: Gecko Exporter for GaN-Transistors: mirror 1. quadrant forward characteristic to 3rd quadrant
- GUI: Add options to display virtual and original datasheet for selected transistor
- #90: Add email-workflow to add new transistor to the transistordatabase file exchange (TDB-FE)
- Add log(x), log(y) for adding/viewing plots

### Fixed
- Fix PDF preview not working due to a workaround
Expand Down
95 changes: 60 additions & 35 deletions transistordatabase/gui/CurveCheckerWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,11 @@
<rect>
<x>0</x>
<y>0</y>
<width>780</width>
<height>539</height>
<width>784</width>
<height>525</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="4" column="1">
<widget class="QCheckBox" name="checkBox_logarithmic">
<property name="text">
<string>scale logarithmic</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QPushButton" name="button_save_curve">
<property name="sizePolicy">
Expand All @@ -62,6 +55,22 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="comboBox_data">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>35</height>
</size>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBox_first_x_to_0">
<property name="sizePolicy">
Expand All @@ -81,8 +90,40 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBox_mirror_xy_data">
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="radioButton_scale_linear">
<property name="text">
<string>Linear scale</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_scale_log_x">
<property name="text">
<string>log(x)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_scale_log_y">
<property name="text">
<string>log(y)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_scale_log_xy">
<property name="text">
<string>log(x), log(y)</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox_first_xy_to_00">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
Expand All @@ -96,7 +137,7 @@
</size>
</property>
<property name="text">
<string>mirror_xy_data</string>
<string>first_xy_to_00</string>
</property>
</widget>
</item>
Expand All @@ -110,8 +151,8 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox_first_xy_to_00">
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_second_y_to_0">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
Expand All @@ -125,12 +166,12 @@
</size>
</property>
<property name="text">
<string>first_xy_to_00</string>
<string>second_y_to_0</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_second_y_to_0">
<item row="3" column="0">
<widget class="QCheckBox" name="checkBox_mirror_xy_data">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
Expand All @@ -144,23 +185,7 @@
</size>
</property>
<property name="text">
<string>second_y_to_0</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="comboBox_data">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>35</height>
</size>
<string>mirror_xy_data</string>
</property>
</widget>
</item>
Expand All @@ -176,7 +201,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>21</height>
<height>32</height>
</rect>
</property>
</widget>
Expand Down
47 changes: 36 additions & 11 deletions transistordatabase/gui/ViewCurveWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>780</width>
<height>539</height>
<width>784</width>
<height>525</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_logarithmic">
<property name="text">
<string>scale logarithmic</string>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="4" column="0">
<widget class="QComboBox" name="comboBox_data">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
Expand Down Expand Up @@ -75,6 +68,38 @@
</property>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="radioButton_scale_linear">
<property name="text">
<string>Linear Scale</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_scale_log_x">
<property name="text">
<string>log(x)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_scale_log_y">
<property name="text">
<string>log(y)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_scale_log_xy">
<property name="text">
<string>log(x), log(y)</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
Expand All @@ -87,7 +112,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>21</height>
<height>32</height>
</rect>
</property>
</widget>
Expand Down
36 changes: 26 additions & 10 deletions transistordatabase/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -5573,7 +5573,10 @@ def __init__(self):
self.checkBox_second_y_to_0.stateChanged.connect(self.update_curve)
self.checkBox_first_x_to_0.stateChanged.connect(self.update_curve)
self.checkBox_mirror_xy_data.stateChanged.connect(self.update_curve)
self.checkBox_logarithmic.stateChanged.connect(self.update_curve)
self.radioButton_scale_linear.toggled.connect(self.update_curve)
self.radioButton_scale_log_x.toggled.connect(self.update_curve)
self.radioButton_scale_log_y.toggled.connect(self.update_curve)
self.radioButton_scale_log_xy.toggled.connect(self.update_curve)

self.button_save_curve.clicked.connect(self.save_curve)

Expand Down Expand Up @@ -5659,11 +5662,14 @@ def update_curve(self):
curve_label = self.comboBox_data.currentText()
self.matplotlibwidget.axis.clear()


if self.checkBox_logarithmic.isChecked() == True:
if self.radioButton_scale_log_xy.isChecked() == True:
self.matplotlibwidget.axis.loglog(graph[0], graph[1], label=curve_label)
elif self.checkBox_logarithmic.isChecked() == False:
elif self.radioButton_scale_linear.isChecked() == True:
self.matplotlibwidget.axis.plot(graph[0], graph[1], label=curve_label)
elif self.radioButton_scale_log_x.isChecked() == True:
self.matplotlibwidget.axis.semilogx(graph[0], graph[1], label=curve_label)
elif self.radioButton_scale_log_y.isChecked() == True:
self.matplotlibwidget.axis.semilogy(graph[0], graph[1], label=curve_label)

self.matplotlibwidget.axis.grid()
self.matplotlibwidget.axis.set(xlabel=xlabel,
Expand Down Expand Up @@ -5700,6 +5706,9 @@ def run_curve_checker(self, comboBox, xlabel, ylabel, curve_title):
self.matplotlibwidget.axis.set(xlabel=xlabel,
ylabel=ylabel,
title=curve_title)

self.radioButton_scale_linear.setChecked(True)

self.update_curve()

self.show()
Expand Down Expand Up @@ -5780,12 +5789,14 @@ def __init__(self):
self.matplotlibwidget = MatplotlibWidget()
self.matplotlibwidget.axis_cm.remove()

self.checkBox_logarithmic.stateChanged.connect(self.update_curve)

self.radioButton_scale_linear.toggled.connect(self.update_curve)
self.radioButton_scale_log_x.toggled.connect(self.update_curve)
self.radioButton_scale_log_y.toggled.connect(self.update_curve)
self.radioButton_scale_log_xy.toggled.connect(self.update_curve)

def update_curve(self):
"""
Updates the scaling of the curve when the checkBox to scale logarithmic is pressed
Updates the scaling of the curve when the radio buttons to scale linear/log(x)/log(y)/log(x,y) is pressed
:return: None
"""
Expand All @@ -5797,11 +5808,14 @@ def update_curve(self):
curve_label = self.comboBox_data.currentText()
self.matplotlibwidget.axis.clear()

if self.checkBox_logarithmic.isChecked() == True:
if self.radioButton_scale_log_xy.isChecked() == True:
self.matplotlibwidget.axis.loglog(graph[0], graph[1], label=curve_label)
elif self.checkBox_logarithmic.isChecked() == False:
elif self.radioButton_scale_linear.isChecked() == True:
self.matplotlibwidget.axis.plot(graph[0], graph[1], label=curve_label)

elif self.radioButton_scale_log_x.isChecked() == True:
self.matplotlibwidget.axis.semilogx(graph[0], graph[1], label=curve_label)
elif self.radioButton_scale_log_y.isChecked() == True:
self.matplotlibwidget.axis.semilogy(graph[0], graph[1], label=curve_label)

self.matplotlibwidget.axis.set(xlabel=xlabel,
ylabel=ylabel,
Expand Down Expand Up @@ -5841,6 +5855,8 @@ def view_curve(self, comboBox, curve_title, xlabel, ylabel):
self.matplotlibwidget.axis.set(xlabel=xlabel,
ylabel=ylabel,
title=curve_title)
# set linear scale as default
self.radioButton_scale_linear.setChecked(True)
self.update_curve()

self.show()
Expand Down

0 comments on commit ffb1a7b

Please sign in to comment.