Skip to content

Commit

Permalink
update docu, ignore F401 for ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
gituser789 committed Feb 6, 2024
1 parent 6cfb112 commit a475748
Show file tree
Hide file tree
Showing 18 changed files with 183 additions and 175 deletions.
3 changes: 2 additions & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ target-version = "py39"
select = ["E4", "E7", "E9", "F", "B", "D417"]
# extend-select = ["D417"] deactivated by default in case of pep257 codestyle.
# see also: https://docs.astral.sh/ruff/rules/undocumented-param/
ignore = ["B008", "D107", "D203", "D212", "D213", "D402", "D413", "D415", "D416", "E722", "E731", "F403", "F405", "F841", "B904"]
ignore = ["B008", "D107", "D203", "D212", "D213", "D402", "D413", "D415", "D416", "E722", "E731", "F403", "F405", "F841", "B904", "F401"]
fixable = ["ALL"]
unfixable = []
# ignore list in docstring according to numpy codestyles for Dxxx.
# http://www.pydocstyle.org/en/5.0.1/error_codes.html#default-conventions
# B904: Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
# F401: xxx imported but unused

[lint.pydocstyle]
convention = "pep257"
Expand Down
7 changes: 0 additions & 7 deletions template_example/template_example.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
# imports
import numpy as np
import datetime
import sys
import os
from pymongo import MongoClient
from matplotlib import pyplot as plt
import json
import transistordatabase as tdb


Expand Down
8 changes: 4 additions & 4 deletions tests/test_tdb_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,12 @@ def data_setup_for_gecko_exporter(request):

def test_export_geckocircuits(data_setup_for_gecko_exporter):
"""
Test case for the transistor method to check if the gecko exporter handles the 4 possible cases while exporting a transistor to .scl files
Test case for the transistor method to check if the gecko exporter handles the 4 possible cases while exporting a transistor to .scl files
:param data_setup_for_gecko_exporter: a fixture to arrange the required transistor object and recording the results that obtained during act operation.
The recorded results are used for assertion
:param data_setup_for_gecko_exporter: a fixture to arrange the required transistor object and recording the results that obtained during act operation.
The recorded results are used for assertion
:return: assertion based result
:return: assertion based result
"""
actual_data = data_setup_for_gecko_exporter
expected = {}
Expand Down
2 changes: 1 addition & 1 deletion transistordatabase/checker_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def check_keys(keys_to_check: Dict, req_type: str, switch_type: str):

def check_duplicates(current_items: List[Dict], item_to_append: Dict) -> bool:
"""
A helper method to check if the item being added already exists in the list
Helper method to check if the item being added already exists in the list.
:param current_items: list of particular class object converted to dictionaries using which the checks are conducted
:type current_items: list(dict)
Expand Down
2 changes: 1 addition & 1 deletion transistordatabase/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# On and Off gate voltages
"""IGBT Module Constants"""
"""IGBT Module Constants."""
IGBT_VG_ON = 15
IGBT_VG_OFF = -15
DIODE_VGS = 0
Expand Down
81 changes: 43 additions & 38 deletions transistordatabase/data_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from transistordatabase.helper_functions import isvalid_dict, get_img_raw_data

class GateChargeCurve:
""" A class to hold gate charge characteristics of switch which is added as a optional attribute inside switch class"""
"""A class to hold gate charge characteristics of switch which is added as a optional attribute inside switch class"""

v_supply: float #: same as drain-to-source (v_ds)/ collector-emitter (v_ce) voltages
t_j: float #: junction temperature
Expand All @@ -21,7 +21,7 @@ class GateChargeCurve:

def __init__(self, args):
"""
Initialization method for GateChargeCurve object
Initialize a GateChargeCurve object.
:param args: arguments to be passed for initialization
"""
Expand All @@ -35,7 +35,7 @@ def __init__(self, args):

def convert_to_dict(self) -> dict:
"""
The method converts GateChargeCurve object into dict datatype
Convert a GateChargeCurve object into dict datatype.
:return: GateChargeCurve object of dict type
:rtype: dict
Expand All @@ -48,7 +48,7 @@ def convert_to_dict(self) -> dict:

def get_plots(self, ax=None):
"""
Plots gate charge vs gate source/ gate emitter voltage of switch type mosfet and igbt respectively
Plot the gate charge vs. gate source/ gate emitter voltage of switch type mosfet and igbt respectively.
:param ax: figure axes to append the curves
Expand All @@ -68,7 +68,7 @@ def get_plots(self, ax=None):
plt.show()

class SOA:
""" A class to hold safe operating area characteristics of transistor type which is added as a optional attribute inside transistor class"""
"""A class to hold safe operating area characteristics of transistor type which is added as a optional attribute inside transistor class"""

t_c: float | None #: case temperature
time_pulse: float | None #: applied pulse duration
Expand Down Expand Up @@ -101,7 +101,7 @@ def convert_to_dict(self) -> dict:

def get_plots(self, ax=None):
"""
Plots drain current/reverse diode current vs drain-to-source voltage/diode applied reverse voltage of switch type mosfet/igbt
Plot drain current/reverse diode current vs drain-to-source voltage/diode applied reverse voltage of switch type mosfet/igbt.
:param ax: figure axes to append the curves
Expand All @@ -122,8 +122,9 @@ def get_plots(self, ax=None):

class TemperatureDependResistance:
"""
class to store temperature dependant resistance curve
Store temperature dependant resistance curve.
"""

i_channel: float #: channel current at which the graph is recorded
v_g: float #: gate voltage
dataset_type: str #: curve datatype, can be either 't_r' or 't_factor'. 't_factor' is used to denote normalized gate curves
Expand All @@ -146,7 +147,7 @@ def __init__(self, args):

def convert_to_dict(self) -> dict:
"""
The method converts TemperatureDependResistance object into dict datatype
Convert a TemperatureDependResistance object into dict datatype.
:return: TemperatureDependResistance object of dict type
:rtype: dict
Expand All @@ -159,7 +160,7 @@ def convert_to_dict(self) -> dict:

def get_plots(self, ax=None):
"""
Plots On resistance vs Junction temperature
Plot the on-resistance vs. Junction temperature.
:param ax: figure axes to append the curves
Expand All @@ -181,8 +182,9 @@ def get_plots(self, ax=None):

class EffectiveOutputCapacitance:
"""
The class EffectiveOutputCapacitance is used to record energy related or time related output capacitance of the switch.
Record energy related or time related output capacitance of the switch.
"""

c_o: float #: Value of the fixed output capacitance. Units in F
v_gs: float #: Gate to source voltage of the switch. Units in V
v_ds: float #: Drain to source voltage of the switch ex: V_DS = (0-400V) i.e v_ds=400 (max value, min assumed a 0). Units in V
Expand All @@ -201,7 +203,7 @@ def __init__(self, args):

def convert_to_dict(self) -> dict:
"""
The method converts EffectiveOutputCapacitance object into dict datatype
Convert a EffectiveOutputCapacitance object into dict datatype.
:return: EffectiveOutputCapacitance object of dict type
:rtype: dict
Expand Down Expand Up @@ -309,11 +311,11 @@ def __init__(self, args):

def convert_to_dict(self) -> dict:
"""
The method converts SwitchEnergyData object into dict datatype
Convert a SwitchEnergyData object into dict datatype.
:return: SwitchEnergyData object of dict type
:rtype: dict
"""
:return: SwitchEnergyData object of dict type
:rtype: dict
"""
d = dict(vars(self))
for att_key in d:
if isinstance(d[att_key], np.ndarray):
Expand All @@ -322,7 +324,7 @@ def convert_to_dict(self) -> dict:

def plot_graph(self) -> None:
"""
Plots switch / diode energy curve characteristics (either from graph_i_e or graph_r_e dataset)
Plot switch / diode energy curve characteristics (either from graph_i_e or graph_r_e dataset).
:return: Respective plots are displayed
:rtype: None
Expand Down Expand Up @@ -370,7 +372,8 @@ class ChannelData:
"""Contains channel V-I data for either switch or diode. Data is given for only one junction temperature t_j.
For different temperatures: Create additional ChannelData-objects and store them as a list in the respective
Diode- or Switch-object.
This data can be used to linearize the transistor at a specific operating point """
This data can be used to linearize the transistor at a specific operating point
"""

# # Test condition: Must be given as scalar. Create additional objects for different temperatures.
t_j: float #: Junction temperature of switch\diode. (Mandatory key)
Expand All @@ -381,7 +384,7 @@ class ChannelData:

def __init__(self, args):
"""
Initialization method for ChannelData object
Initialize a ChannelData object.
:param args: arguments to be passed for initialization
"""
Expand All @@ -393,7 +396,7 @@ def __init__(self, args):

def convert_to_dict(self) -> dict:
"""
The method converts ChannelData object into dict datatype
Convert a ChannelData object into dict datatype.
:return: ChannelData object of dict type
:rtype: dict
Expand Down Expand Up @@ -422,7 +425,9 @@ def plot_graph(self) -> None:

class LinearizedModel:
"""Contains data for a linearized Switch/Diode depending on given operating point. Operating point specified by
t_j, i_channel and (not for all diode types) v_g."""
t_j, i_channel and (not for all diode types) v_g.
"""

t_j: float #: Junction temperature of diode\switch. Units in K (Mandatory key)
v_g: float | None #: Gate voltage of switch or diode. Units in V (Mandatory for Switch, Optional for some Diode types)
i_channel: float #: Channel current of diode\switch. Units in A (Mandatory key)
Expand All @@ -431,7 +436,7 @@ class LinearizedModel:

def __init__(self, args):
"""
Initialization method for linearizedmodel object
Initialize a linearizedmodel object.
:param args: arguments to passed for initialization
"""
Expand All @@ -455,6 +460,7 @@ class VoltageDependentCapacitance:
"""Contains graph_v_c data for transistor class. Data is given for only one junction temperature t_j.
For different temperatures: Create additional VoltageDependentCapacitance-objects and store them as a list in the transistor-object.
"""

# # Test condition: Must be given as scalar. Create additional objects for different temperatures.
t_j: float #: Junction temperature (Mandatory key)
# Dataset: Represented as a 2xm Matrix where row 1 is the voltage and row 2 the capacitance.
Expand All @@ -474,7 +480,7 @@ def __init__(self, args):

def convert_to_dict(self) -> dict:
"""
The method converts VoltageDependentCapacitance object into dict datatype
Convert a VoltageDependentCapacitance object into dict datatype.
:return: VoltageDependentCapacitance object of dict type
:rtype: dict
Expand All @@ -487,7 +493,8 @@ def convert_to_dict(self) -> dict:

def get_plots(self, ax=None, label=None):
"""
Plots the voltage dependant capacitance graph_v_c of the VoltageDependentCapacitance object.
Plot the voltage dependant capacitance graph_v_c of the VoltageDependentCapacitance object.
Also attaches the plot to figure axes for the purpose virtual datasheet if ax argument is specified
:param ax: figure axes for making the graph_v_c plot in virtual datasheet
Expand Down Expand Up @@ -540,7 +547,7 @@ class FosterThermalModel:

def __init__(self, args):
"""
Initialization method of FosterThermalModel object
Initialize a FosterThermalModel object.
:param args: argument to be passed for initialization
:type args: dict
Expand All @@ -566,7 +573,7 @@ def __init__(self, args):

def convert_to_dict(self) -> dict:
"""
The method converts FosterThermalModel object into dict datatype
Convert a FosterThermalModel object into dict datatype.
:return: FosterThermalModel of dict type
:rtype: dict
Expand Down Expand Up @@ -655,11 +662,10 @@ class RawMeasurementData:

def __init__(self, args):
"""
Initialization method for RawMeasurementData object
Initialize a RawMeasurementData object.
:param args: arguments to be passed for initialization
"""

self.dataset_type = args.get('dataset_type')
self.comment = args.get('dataset_type')
if self.dataset_type == 'dpt_u_i' or self.dataset_type == 'dpt_u_i_r':
Expand Down Expand Up @@ -700,21 +706,20 @@ def convert_to_dict(self) -> dict:

def dpt_calculate_energies(self, integration_interval: str, dataset_type: str, energies: str, mode: str):
"""
Imports double pulse measurements and calculates switching losses to each given working point.
[1] options for the integration interval are based on following paper:
Link: https://ieeexplore.ieee.org/document/8515553
Import double pulse measurements and calculates switching losses to each given working point.
:param integration_interval: calculation standards for switching losses
:type integration_interval: str
:param dataset_type: defines what measurement set should should be calculated
:type dataset_type: str
:param energies: defines which switching energies should be calculated
:type energies: str
[1] options for the integration interval are based on following paper:
Link: https://ieeexplore.ieee.org/document/8515553
:param integration_interval: calculation standards for switching losses
:type integration_interval: str
:param dataset_type: defines what measurement set should should be calculated
:type dataset_type: str
:param energies: defines which switching energies should be calculated
:type energies: str
"""
"""
if integration_interval == 'IEC 60747-9':
off_vds_limit = 0.1
off_is_limit = 0.02
Expand Down
Loading

0 comments on commit a475748

Please sign in to comment.