Python Libraries with functions and constants related to electrical engineering.

Overview

logo

ElectricPy

Electrical-Engineering-for-Python

sphinx Tox Import Test pytest pydocstyle

Python Libraries with functions and constants related to electrical engineering.

The functions and constants that make up these modules represent a library of material compiled with the intent of being used primarily for research, development, education, and exploration in the realm of electrical engineering.

Check out our full documentation: https://engineerjoe440.github.io/ElectricPy/

Special thanks to:

  • Lakshmikanth Ayyadevara | Student - NIT Warangal (National Institute of Technology Warangal)
  • Stephen Weeks | Student - University of Idaho
  • Jeremy Perhac | Student - University of Idaho
  • Daniel Allen | Student - Universtiy of Idaho
  • Dr. Dennis Sullivan | Proffessor - University of Idaho
  • Dr. Brian Johnson | Proffessor - University of Idaho
  • Dr. Joe Law | Proffessor - University of Idaho
  • StackOverflow user gg349
  • Shaurya Uppal | Online Code Contributor
  • Paul Ortman | Power Quality Engineer - Idaho Power | Instructor - University of Idaho

Dependencies:

  • NUMPY
  • MATPLOTLIB
  • SCIPY
  • SYMPY
  • NUMDIFFTOOLS

INSTALLATION:

1) (option a) Install ElectricPy with Python's Own pip

Install electricpy

  • pip install electricpy

1) (option b) Install ElectricPy from Source

Python Documentation

Collect Repository and Install

  1. Clone/Download Source Code from GitHub Repository
  2. Open Terminal and Navigate to Folder with cd Commands:
  • cd \electricpy
  1. Use Python to Install Module from setup.py:
  • python setup.py install

2) Verify Installation

Check installation success in Python environment

import electricpy
electricpy._version_

To Do List:

  • Add Heat Sink Solver
  • DC/DC Converters
  • DC/AC Converters
  • Stationary and Synchronous Reference Frame conversion Matrices/Constants
  • Add arc-flash calculators suggested
  • Add Simple decibel Formulas
  • Add Simple Battery Discharge Rate Formula
  • Add Simple Air Core Inductor Formula(s)
  • Add Simple Zener Diode Formulas
  • Develop Testing for All Functions

Get Involved / Contribute

If you're interested in contributing, we'd love to see your support in a number of ways!

  1. Write Tests - We're really lacking in this area. We've recently added simple GitHub actions to test installation, but that's about it. We hope that someday we can test all functions in this module for verification.
  2. Contribute New Electrical Engineering Functions - If you've got a new function related to electrical engineering that you'd like to see added, we'd love to throw it into this module. Our goal is that this module can become the comprehensive electrical engineering toolkit in Python. Drop us a note, or create a pull request!
  3. Report Issues - We don't want issues to go unnoticed. Please help us track bugs and resolve them!
  4. Get the Word Out - This project is still in its infancy, so please share it with your friends and colleagues. We want to make sure that everyone has the opportunity to take advantage of this project.

Check out the contribution guide

Contact:

For more information regarding this resource, please contact Joe Stanley

License and Usage:

ElectricPy is licensed under the standard MIT license, and as such, you are permitted to use this resource as you see fit. Please feel free to ask questions, suggest edits and report bugs or other issues.

Comments
  • Format for test functions

    Format for test functions

    Can we organized all our test functions in this format

    def test_distance():
        
        def test_0():
            p1 = Point(1, 2)
            p2 = Point(3, 4)
            assert geometry.distance(p1, p2) == 2*(2**0.5)
    
            p1 = Point(4, -6)
            p2 = Point(-2, -5)
            assert geometry.distance(p2, p1) ==  (37**0.5)
    
            p1 = Point(1.3, 2.3)
            p2 = Point(1.4, 2.4)
    
            d_output = geometry.distance(p1, p2)
            d_actual = 0.1*(2**0.5)
    
            assert_array_almost_equal(d_output, d_actual, decimal=6)
    
        def test_1():
            p1 = Point(1, 2)
            p2 = Point(1, 3)
            assert geometry.distance(p1, p2) == 1
    
            p1 = Point(2.0, 1)
            p2 = Point(3.0, 1)
            assert geometry.distance(p1, p2) == 1
    
        for i in range(2):
            exec("test_{}()".format(i))
    
    

    Where all test function contain at least two test case with increasing level of complexity

    opened by Lakshmikanth2001 6
  • Source Code url in documentation

    Source Code url in documentation

    image

    Can we have a similar source pointing anchor tag in our https://engineerjoe440.github.io/ElectricPy/api/ documentation page

    I have written a python script to generate URL for each function

    function_url =  dict()
    REMOTE_URL = "https://github.com/engineerjoe440/ElectricPy/blob/master/electricpy/"
    
    #get only files electricpy directory
    SOURCES = [file for file in os.listdir('./electricpy') if os.path.isfile(file)]
    
    for source in SOURCES:
        with open(os.path.join(sys.path[0], f"electricpy\{source}"), "r") as code:
            # buid a regular expression for "def ()"
            RE = re.compile('def ()')
    
            # iterate over the lines in the file
            for line_number, line in enumerate(code):
                # find all the functions
                match = RE.findall(line)
                # if there are any matches
                if match:
                    #get text between def and (
                    
                    function_name = line[line.find("def")+4:line.find("(")]
    
                    function_url[function_name] = f"{REMOTE_URL}{source}#L{line_number+1}"
    
            with open("urls.json", 'w') as url_data:
                json.dump(function_url, url_data) 
    

    urls.json would look similar to this

     "phasorz": "https://github.com/engineerjoe440/ElectricPy/blob/master/electricpy/__init__.py#L844",
    

    https://github.com/engineerjoe440/ElectricPy/blob/master/electricpy/init.py#L844 will directly point to the actual function

    Can we include this feature

    opened by Lakshmikanth2001 5
  • added some function which are mentioned in todolist

    added some function which are mentioned in todolist

    refactored code using Pycharm (this is the reason which caused so changes i am sorry for that) and added some function

    '''bridge impedance'' using electric.dynetz '''propagation_constants''' for long transmission line '''tapchaning_transformer" for calculating turns ration

    I want to added method to find voltage across string capacitors https://circuitglobe.com/string-efficiency-of-suspension-insulator.html and many more I hope you like my work and please excuse me for making so many changes by refactoring

    documentation enhancement 
    opened by Lakshmikanth2001 5
  • Problem installing a package in Visual Studio 2019

    Problem installing a package in Visual Studio 2019

    Hello!

    I tried to install a package in Visual Studio 2019. All the necessary and listed packages were installed successfully. The installation of ElectricPy failed (see below).

    Thank you.

    ----- Installing 'electricpy==0.1.4' ----- Collecting electricpy==0.1.4 Using cached electricpy-0.1.4.tar.gz (71 kB) ERROR: Command errored out with exit status 1: command: 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\dmitr\AppData\Local\Temp\pip-install-enrxccjp\electricpy\setup.py'"'"'; file='"'"'C:\Users\dmitr\AppData\Local\Temp\pip-install-enrxccjp\electricpy\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\dmitr\AppData\Local\Temp\pip-install-enrxccjp\electricpy\pip-egg-info' cwd: C:\Users\dmitr\AppData\Local\Temp\pip-install-enrxccjp\electricpy
    Complete output (7 lines): Traceback (most recent call last): File "", line 1, in File "C:\Users\dmitr\AppData\Local\Temp\pip-install-enrxccjp\electricpy\setup.py", line 11, in file_str = fh.read() File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\encodings\cp1251.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 43488: character maps to ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. ----- Failed to install 'electricpy==0.1.4' -----

    opened by DmitryPetrichenko 5
  • `Bug` in `sphinx-build.yml`

    `Bug` in `sphinx-build.yml`

      remote: Permission to Lakshmikanth2001/ElectricPy.git denied to github-actions[bot].
      fatal: unable to access 'https://github.com/Lakshmikanth2001/ElectricPy.git/': The requested URL returned error: 403
      Error: Action failed with "The process '/usr/bin/git' failed with exit code 128"
    

    sphinx-build is failling in my forked repository

    bug documentation continuous-integration 
    opened by Lakshmikanth2001 4
  • Redundant parentheses and comparison to None should be 'if cond is not None':

    Redundant parentheses and comparison to None should be 'if cond is not None':

    According to PEP 8 guidance, there must be no redundant parentheses for example

    def foo():
      # return (2) # Bad
      return 2 # Good
    
    if (value == 2): # Bad
       pass
    
    if value == 2: # Good
      pass
    

    Comparison conditions According to PEP 8: E711 comparison to None should be if cond is not None

      if VLL != None: # Bad
          Vm = _np.sqrt(2 / 3) * VLL
    
      if VLL is not None: # Good
          Vm = _np.sqrt(2 / 3) * VLL
    
    enhancement 
    opened by khan-asfi-reza 4
  • Add Automatic Contributor List to README

    Add Automatic Contributor List to README

    There's GOT to be some way to show contributors automatically in the README. So that Github contributors can automatically be listed without needing to be added manually (would save me some time, and make sure people get some of the credit and thanks that they need).

    documentation enhancement help wanted 
    opened by engineerjoe440 4
  • Correct NumPy/SciPy/SymPy Casing in Documentation

    Correct NumPy/SciPy/SymPy Casing in Documentation

    In several places throughout the documentation, "NumPy" is not properly capitalized, the same is true for "SciPy" and "SymPy". All three names should be corrected throughout documentation wherever they appear.

    documentation enhancement good first issue 
    opened by engineerjoe440 4
  • Sphinx Build Warning

    Sphinx Build Warning

    WARNING: autodoc: failed to import function 'step' from module 'electricpy'; the following exception was raised:
    Traceback (most recent call last):
      File "D:\ElectricProject\ElectricPy\.venv\lib\site-packages\sphinx\util\inspect.py", line 448, in safe_getattr
        return getattr(obj, name, *defargs)
    AttributeError: module 'electricpy' has no attribute 'step'
    

    please check out the output of sphinx-build action

    opened by Lakshmikanth2001 4
  • Incorrect formula for resistance/reactance in powerimpedance function in __init__.py .

    Incorrect formula for resistance/reactance in powerimpedance function in __init__.py .

    According to Wikipedia, using R = (V ** 2 )/P is only valid when PF = 1 (purely resistive load). If you call the function powerimpedance(S=1111.11,PF=0.9,V=120), it'll return R=14.4 (120²/1000), instead of 11.66 (aprox).

    I am currently learning about Circuits and searching for python libraries that could help me during my tests. I'll be very happy to lend a hend if possible in this project.

    Best regards.

    bug documentation 
    opened by MrTuckie 4
  • Refactored Code 2

    Refactored Code 2

    sir I wish I was successful in making the changes which you have mentioned in previous pull request one thing which I was unable to add is the image of wheat stone bridge I am still finding methods to add images to python documentation I hope this pull requests covered all the changes which you have mentioned

    documentation enhancement 
    opened by Lakshmikanth2001 4
  • Adding `Frequency Response` for series and parallel `RLC` circuits to `electricpy.visu`

    Adding `Frequency Response` for series and parallel `RLC` circuits to `electricpy.visu`

    Describe the solution you'd like

    • A clear and concise description of what you want to happen.
    • Computing various parameters like bandwidth, quality factor, resonating frequency,and characteristic equation
    • Plotting the frequency response using matlplotlob

    Link to Formulas and Example References

    enhancement 
    opened by Lakshmikanth2001 3
  • Add Documentation for Development Practices and Improve Contributing Docs

    Add Documentation for Development Practices and Improve Contributing Docs

    There's a real lack of documentation regarding contribution best practices and suggestions for this project. We should document some of the following:

    • how Pull Requests (PRs) should be managed
    • what documentation styles are in place (NumPyDoc)
    • contributions getting started
    • what determinations should be used to decide where new functions should be added
    documentation enhancement 
    opened by engineerjoe440 0
  • Add Operational Amplifier (OpAmp) Module and Start with a Few Basic Formulas

    Add Operational Amplifier (OpAmp) Module and Start with a Few Basic Formulas

    It'll be good to add a submodule electricpy.opamp to contain a variety of op-amp related formulas. We can start with the formulas laid out in BasicTables. We should make a unique function for each formula and include an example and copy of the image for each.

    • non_inverting_vout - Image Link: https://www.basictables.com/media/non-inverting-opamp-circuit.png
    • inverting_vout - Image Link: https://www.basictables.com/media/inverting-opamp-circuit.png
    • differential_vout - Image Link: https://www.basictables.com/media/differential-opamp-circuit.png
    • inverting_summing_vout - Image Link: https://www.basictables.com/media/inverting-summing-opamp-circuit.png
    enhancement help wanted good first issue 
    opened by engineerjoe440 3
  • Create Air-Core Inductor Functions

    Create Air-Core Inductor Functions

    We've got one Air Core Inductor formula, but it would be beneficial to have a few others, namely we need to:

    • calculate required length
    • calculate desired diameter
    • calculate desired number of turns

    We should use the formulas called out here and make three formulas:

    • air_core_required_length
    • air_core_required_diameter
    • air_core_required_num_turns
    enhancement help wanted good first issue 
    opened by engineerjoe440 0
  • Phasor Class in `phasor.py`

    Phasor Class in `phasor.py`

    Can we replace all our functional code into objected-oriented fashion so that it will be really intuitive for users to just add, sub, mul, eq phasor

    >>> p1 = Phasor(3, 120)
    >>> p2 = Phasor(4, 120)
    >>> p1 + p2
    Phasor(7, 120)
    >> p1 - p2
    >> p1 * p2
    
    class Phasor:
        """
        Complex Phasor Generator.
    
        Generates the standard Pythonic complex representation
        of a phasor voltage or current when given the magnitude
        and angle of the specific voltage or current.
        """
    
        def __init__(self, mag: float, ang: float) -> None:
            """Initialize the phasor.
    
            Parameters
            ----------
            mag : float
                The magnitude of the phasor
            ang : float
                The angle of the phasor in degrees
            """
            self.mag = mag
            self.ang = _np.radians(ang)
    
        def __add__(self, other: 'Phasor') -> 'Phasor':
            """Return the sum of the phasors.
    
            Parameters
            ----------
            other : object
                The other phasor to add to the current phasor
    
            Returns
            -------
            object
                The sum of the two phasors
            """
            if isinstance(other, Phasor):
                a = _c.rect(self.mag, self.ang)
                b = _c.rect(other.mag, other.ang)
    
                return Phasor(_np.abs(a + b), _np.radians(_np.angle(a + b)))
    
            else:
                return ValueError("Phasor can only be added to another phasor")
    
        def __sub__(self, other: 'Phasor') -> 'Phasor':
            """Return the difference of the phasors.
    
            Parameters
            ----------
            other : object
                The other phasor to subtract from the current phasor
    
            Returns
            -------
            object
                The difference of the two phasors
            """
            if isinstance(other, Phasor):
                a = _c.rect(self.mag, self.ang)
                b = _c.rect(other.mag, other.ang)
    
                return Phasor(_np.abs(a - b), _np.radians(_np.angle(a + b)))
    
            else:
                return ValueError("Phasor can only be subtracted from another phasor")
    
        def __mul__(self, other: 'Phasor') -> 'Phasor':
            """Return the product of the phasors.
    
            Parameters
            ----------
            other: object
                The other phasor to subtract from the current phasor
    
            Returns
            -------
            object
                The difference of the two phasors
            """
            return Phasor(self.mag * other.mag, self.ang + other.ang)
    
        def __eq__(self, __o: 'Phasor') -> bool:
            """Return True if the phasors are equal.
    
            Parameters
            ----------
            __o : Phasor
                The other Phasor object to compare to the current phasor
    
            Returns
            -------
            bool
                True if the phasors are equal, False otherwise
            """
            if isinstance(__o, Phasor):
                return self.mag == __o.mag and self.ang == __o.ang
            else:
                return False
    
        def __str__(self) -> str:
            """Return the string representation of the phasor."""
            return _cprint(self())
    
    enhancement question 
    opened by Lakshmikanth2001 2
  • Enforcing `black` for python code formatting

    Enforcing `black` for python code formatting

    021cfe787fb3d9ac28167b73eafb1198c46dffc4 Sir as our code base is growing in size i want a uniform python code format across all our modules please review it and give your valuable feed bak

    enhancement help wanted 
    opened by Lakshmikanth2001 4
Owner
Joe Stanley
Pythonista and automation enthusiast. Inherently lazy.... I'll spend 6 days automating a 6 minute task so I'll never do it again.
Joe Stanley
Check username

Checker-Oukee Check username It checks the available usernames and creates a new account for them Doesn't need proxies Create a file with usernames an

4 Jun 05, 2022
Run async workflows using pytest-fixtures-style dependency injection

Run async workflows using pytest-fixtures-style dependency injection

Simon Willison 26 Jun 26, 2022
Dice Rolling Simulator using Python-random

Dice Rolling Simulator As the name of the program suggests, we will be imitating a rolling dice. This is one of the interesting python projects and wi

PyLaboratory 1 Feb 02, 2022
Customized python validations.

A customized python validations.

Wilfred V. Pine 2 Apr 20, 2022
kawadi is a versatile tool that used as a form of weapon and is used to cut, shape and split wood.

kawadi kawadi (કવાડિ in Gujarati) (Axe in English) is a versatile tool that used as a form of weapon and is used to cut, shape and split wood. kawadi

Jay Vala 2 Jan 10, 2022
A color library based on pokemons colors!

pokepalette A simple pokemon color chooser " This repo is based on CDWimmer/PokePalette and was originated from this tweet. If you don't remember your

Thomas Capelle 5 Aug 30, 2021
An okayish python script to generate a random Euler circuit with given number of vertices and edges.

Euler-Circuit-Test-Case-Generator An okayish python script to generate a random Euler circuit with given number of vertices and edges. Executing the S

Alen Antony 1 Nov 13, 2021
A tool for testing improper put method vulnerability

Putter-CUP A tool for testing improper put method vulnerability Usage :- python3 put.py -f live-subs.txt Result :- The result in txt file "result.txt"

Zahir Tariq 6 Aug 06, 2021
Standard implementations of FedLab and its provided benchmarks.

FedLab-benchmarks This repo contains standard implementations of FedLab and its provided benchmarks. Currently, following algorithms or benchrmarks ar

SMILELab-FL 104 Dec 05, 2022
python-codicefiscale: a tiny library for encode/decode Italian fiscal code - codifica/decodifica del Codice Fiscale.

python-codicefiscale python-codicefiscale is a tiny library for encode/decode Italian fiscal code - codifica/decodifica del Codice Fiscale. Features T

Fabio Caccamo 53 Dec 14, 2022
A simple, console based nHentai Code Generator

nHentai Code Generator A simple, console based nHentai Code Generator. How to run? Windows Android Windows Make sure you have python and git installed

5 Jun 02, 2022
A toolkit for writing and executing automation scripts for Final Fantasy XIV

XIV Scripter This is a tool for scripting out series of actions in FFXIV. It allows for custom actions to be defined in config.yaml as well as custom

Jacob Beel 1 Dec 09, 2021
Format Norminette Output!

Format Norminette Output!

7 Apr 19, 2022
Napari plugin for loading Bitplane Imaris files .ims

napari-imaris-loader Napari plugin for loading Bitplane Imaris files '.ims'. Notes: For this plugin to work "File/Preferences/Experimental/Render Imag

Alan Watson 4 Dec 01, 2022
A simple tool that updates your pubspec.yaml file, of a Flutter project, without altering the structure of your file.

A simple tool that updates your pubspec.yaml file, of a Flutter project, without altering the structure of your file.

3 Dec 10, 2021
A simple toolchain for moving Remarkable highlights to Readwise

A simple toolchain for moving Remarkable highlights to Readwise

zach wick 20 Dec 20, 2022
✨ Un DNS Resolver totalement fait en Python par moi, et en français

DNS Resolver ❗ Un DNS Resolver totalement fait en Python par moi, et en français. 🔮 Grâce a une adresse (url) vous pourrez avoir l'ip ainsi que le DN

MrGabin 3 Jun 06, 2021
A python package for your Kali Linux distro that find the fastest mirror and configure your apt to use that mirror

Kali Mirror Finder Using Single Python File A python package for your Kali Linux distro that find the fastest mirror and configure your apt to use tha

MrSingh 6 Dec 12, 2022
Python module and its web equivalent, to hide text within text by manipulating bits

cacherdutexte.github.io This project contains : Python modules (binary and decimal system 6) with a dedicated tkinter program to use it. A web version

2 Sep 04, 2022
Python humanize functions

humanize This modest package contains various common humanization utilities, like turning a number into a fuzzy human-readable duration ("3 minutes ag

Jason Moiron 1.6k Jan 01, 2023