Giter Club home page Giter Club logo

electricpy's Introduction

Joe Stanley

I'm a young engineer focusing in embedded programming and Linux systems. I program in Python and IEC 61131-3 quite often, but I dabble in a fair amount of other languates too! Not to mention I lend my hand to some hardware design on ocasion.

For more information about me and what I do, visit my website ๐ŸŒ.


๐Ÿ“• Latest Blog Posts


Open Source Projects that I Maintain logo

My GitHub Stats:

engineerjoe440 AlfredDagenais's Github Top languages

Visitor count

electricpy's People

Contributors

ankush-0x90 avatar engineerjoe440 avatar iwayankurniawan avatar joestanleysel avatar khan-asfi-reza avatar lakshmikanth2001 avatar miguelzaqui avatar mrtuckie avatar neidermeyer avatar sohamratnaparkhi avatar tanvir-riyad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

electricpy's Issues

Add Decibel Functions

We should look at adding a few small functions, or perhaps a single "solver" that will use the appropriate one internally.

  1. dBW_to_watts: Convert dBW to power (in watts)
  2. watts_to_dBW: Convert power (in watts) to dBW
  3. dBW_to_dBmW: Convert dBW to dBmW
  4. dBmW_to_dBW: Convert dBmW to dBW
  5. dBmW_to_watts: Convert dBmW to power (in watts)
  6. watts_to_dBmW: Convert power (in watts) to dBmW

These can all be referred back to a tool like this one: https://www.basictables.com/electronics/decibel-dbw

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

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

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.

Move towards `visu` Submodule

Many visualization functions can be grouped into the visu submodule, which, in itself should be structured to have submodules (I think bode should move there, eventually).
A few of the functions that should be moved there include:

  • Power Triangle plotter
  • convbar convolution plot generator
  • phasorplot Phasor diagram plotter
  • bode plotting tools

Create Examples Documentation for `electricpy.acpiv`

Right now, the general solver electricpy.acpiv is a little lack-luster, and could really benefit from some examples to help inform users how it can be used to solve for the various quantities.

Should just be a matter of adding an Examples section to the acpiv docstring; for e.g.,

Examples
--------
>>> import electricpy as ep
>>> S = ep.acpiv(VLL=<something>, I=<something-else>)
>>> ep.cprint(S)
<quantity>
>>> VLL = ep.acpiv(S=<something>, I=<something-else>)
>>> ep.cprint(VLL)
<quantity>
>>> VLN = ep.acpiv(S=<something>, I=<something-else>)
>>> ep.cprint(VLN)
<quantity>

image

Unify Module-Level Docstring Descriptions

Each of the various modules have a "module-level" docstring that should reflect a brief synopsis of what the module is intended for. These should really be unified so that they're more consistent and helpful. Here's some examples of how they appear inconsistent in documentation, with what looks "good" and what looks "less good."

image

Add Examples to `electricpy.tcycles`

The tcycles function is a relatively simple one, but could benefit from having examples right in the code.

It could, quite simply, be:

Examples
--------
>>> import electricpy as ep
>>> ep.tcycles(1, freq=60)
0.01666667
>>> ep.tcycles(1, freq=50)
0.02

At the same time, it would also be worth clarifying the units in which the time is returned. I seem to recall it as seconds, but may need some clarification there.

image

`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

Remove Use of `exec` function in `electricpy.sim` Module

Request:

Remove use of the exec function in the electricpy.sim module:

        tempQstr += ")"
        if any(P_strgs[ii:i]):
            if verbose: print("Full P-Func Str:",tempPstr)
            exec(tempPstr)
        if any(Q_strgs[ii:i]):
            if verbose: print("Full Q-Func Str:",tempQstr)
            exec(tempQstr)
        ii = i # Increase Lower Index
    retset = (P_funcs,Q_funcs)

Reason:

Python's exec function is invariably a bit risky, and introduces the opportunity for malicious misuse of code. Though unlikely, it's always possible for some cleverly crafted strings be used to execute arbitrary code. I can't think of a particular way this could be exploited today, but just because I can't think of a way it might be done doesn't mean someone else won't, either.

References:

Warning Symbol Not Correctly Rendering in Web Docs

Summary

Looks like the warning symbol (standard of Github-flavored markdown as :warning: == โš ๏ธ) is not rendering correctly in the ReadTheDocs pages:

image

We should look at fixing this with build scripts, or using an actual image to correct the problem.

Suggestion

The best course of action is likely to replace the :warning: with an actual image so that it can render right along with everything else.

Adding My university

image

Can you Please add my university name NIT Warangal (National Institute of Technology Warangal)

Add Zener Diode Functions

It would be super helpful to have a few of the simple Zener diode functions that are defined here.

We'll want to craft two new functions (resistive power is nothing special, per-say):

  • zener_diode_required_resistor (R as it appears in BasicTables)
  • zener_diode_power (PR as it appears in BasicTables)

Add Support for Installing Arc Flash Package

Describe the solution you'd like
ElectricPy could pull in support from the arcflash package and provide all of its core functionality as an extension of this "superset." Might make ElectricPy more of a "clearinghouse" than a package fully in its own right, but it could be helpful for electrical engineers to have one "thing" to install.

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

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).

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' -----

Duplicate code in `bode.py`

From Line 121-129

_plt.title(magTitle)
if degrees: # Plot in degrees
_plt.plot(w / (2 * _np.pi), mag)
_plt.xlabel("Frequency (Hz)")
else: # Plot in radians
_plt.plot(w, mag)
_plt.xlabel("Frequency (rad/sec)")
_plt.xscale("log")
_plt.grid(which="both")

From Line 146-154

_plt.title(angTitle)
if degrees: # Plot in degrees
_plt.plot(w / (2 * _np.pi), ang)
_plt.xlabel("Frequency (Hz)")
else: # Plot in radians
_plt.plot(w, ang)
_plt.xlabel("Frequency (rad/sec)")
_plt.xscale("log")
_plt.grid(which="both")

Duplicate Lines

Improving Code Coverage and Adding Coverage Badge in `README.MD`

Name                              Stmts   Miss  Cover
-----------------------------------------------------
electricpy\__init__.py             1734   1430    18%
electricpy\bode.py                  169    156     8%
electricpy\constants.py              41      0   100%
electricpy\fault.py                 404    358    11%
electricpy\geometry\__init__.py     162     52    68%
electricpy\geometry\circle.py        89     52    42%
electricpy\geometry\triangle.py      47      6    87%
electricpy\sim.py                   520    504     3%
electricpy\visu.py                  265    107    60%
-----------------------------------------------------
TOTAL                              3431   2665    22%

We need to improve our tests so that we can cover more amount of code

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.

Separate Packet/Encoding Functions into new `compsci` module.

We should start looking at creating network-focused educational functions, and a selection of binary-centric functions (like what's the maximum number that a 32-, 64-, or n-bit variable can contain when it's signed, vs unsigned, etc.

For now, it makes sense that all of this can be brought into a single compsci submodule.

`ElectricPy` website bug

Describe the bug
A clear and concise description of what the bug is.

Reproduction Code
docsource/index.rst

# Setup
-------------------------
Contents:
-------------------------

.. toctree::
   :maxdepth: 1
   
   electricpyapi
   constants
   additionalresources
   changes
   Github <https://github.com/engineerjoe440/ElectricPy>
   PyPI <https://pypi.org/project/electricpy>


# Code which causes failure
   Github <https://github.com/engineerjoe440/ElectricPy>
   PyPI <https://pypi.org/project/electricpy>

Expected behavior

proper logo rendering

image

Screenshots

Acutal web site

image

Additional context
ElectricPy { URL from google top search )

Our documentation html page is not rendered properly try to correct docsource/index.rst

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

Kudos & Structure Suggestion

First off, kudos, this project is way cool - I'm not sure there is even anything quite like this out there for Python...

Just a few random unsolicited thoughts:

  • Consider grouping calculations into a module/file/class that are related (e.g. AC-related vs DC-related); That way, you could reuse function names if needed
  • Consider using less abbreviations (I know this one is tough):
    • Think about packages like pandas or even matplotlib - the names are rarely abbreviated - it might be long, but it's much easier to use without having to read through lots of documentation. The metpy.calc module is a really good example of this, I think.
    • This applies to function parameters too - Someone who is an EE probably knows the abbreviations for inputs to formulae by heart, but someone who doesn't will definitely have to read the docs. But a big kudos on the docs - they're very descriptive and complete!
  • The use case of metpy is obviously different (and it's designed for tight integration with xarray for manipulating meteorological data), but one thing that's really nice is the integration with pint for units. (See https://github.com/Unidata/MetPy/blob/master/src/metpy/units.py) It works with numpy arrays too - so you can pass numpy-unit aware arrays into calculation functions and it just handles it.
    • Luckily, EE doesn't have too much unit befuddlement (unlike meteorology or other physical sciences where you have a mishmash of feet/meters/inches/etc.) - Amps are Amps, etc. But Pint does have some nice features like being able to add/deal with metric prefixes (e.g. it already has support for Volts, Amps, Henries, Ohms, Farads, etc. and it will handle prefix conversion automatically:
import pint
u = pint.UnitRegistry()

cap1=20*u.nF
cap2=0.67*u.uF
ctotal=cap1+cap2 
ctotal
>690 <Unit('nanofarad')>
ctotal.to(u.uF)
>0.690000[...] <Unit('microfarad')>

Example of a function:

def highzmini(N,Ie,Irly=None,Vset=None,Rrly=2000,Imov=0,CTR=1):

Just some thoughts :)

Create Examples Documentation for `electricpy.vipf`

Right now, the general solver electricpy.vipf is a little lack-luster, and could really benefit from some examples to help inform users how it can be used to solve for the various quantities.

Should just be a matter of adding an Examples section to the acpiv docstring; for e.g.,

Examples
--------
>>> import electricpy as ep
>>> V, I, PF = ep.vipf(V=<something>, I=<something-else>)
>>> print(PF)
<quantity>
>>> V, I, PF = ep.vipf(I=<something>, PF=<something-else>)
>>> ep.cprint(V)
<quantity>
>>> V = ep.vipf(I=<something>, PF=<something-else>, find="V")
>>> ep.cprint(V)
<quantity>

Also worth noting is that there's a typo that could easily be corrected: "poer" should be "power" ๐Ÿ˜œ :

image

Issues with release.yml github actions

Traceback (most recent call last):
File "/home/runner/work/ElectricPy/ElectricPy/release-version.py", line 29, in
raise ValueError(
ValueError: Module version (v0.2.1) is not newer than previous release (v0.2.1)!

Every time when I pushed my local changes to GitHub release.yml is giving this error

Introduce automated docstring test verification.

There are Python modules available that can slurp the examples out of docstrings, and can run them through tests to verify expectations. This would be an excellent verification stage to add since it's likely the primary use-case for the ElectricPy package.

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())

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

Sphinx not Building Correctly in ReadTheDocs

Running Sphinx v5.3.0
Matplotlib is building the font cache; this may take a moment.
Build with: 3.7.9 (default, Oct 19 2020, 15:13:17) 
[GCC 7.5.0]
/home/docs/checkouts/readthedocs.org/user_builds/electricpy/checkouts/develop
Sphinx HTML Build For: electricpy    Version: 0.3.0
/home/docs/checkouts/readthedocs.org/user_builds/electricpy/envs/develop/lib/python3.7/site-packages/matplotlib/cbook/__init__.py:1298: ComplexWarning: Casting complex values to real discards the imaginary part
  return np.asarray(x, float)

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/electricpy/envs/develop/lib/python3.7/site-packages/sphinx/registry.py", line 459, in load_extension
    mod = import_module(extname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/electricpy/envs/develop/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/docs/checkouts/readthedocs.org/user_builds/electricpy/envs/develop/lib/python3.7/site-packages/sphinx/builders/linkcheck.py", line 18, in <module>
    from requests import Response
  File "/home/docs/checkouts/readthedocs.org/user_builds/electricpy/envs/develop/lib/python3.7/site-packages/requests/__init__.py", line 43, in <module>
    import urllib3
  File "/home/docs/checkouts/readthedocs.org/user_builds/electricpy/envs/develop/lib/python3.7/site-packages/urllib3/__init__.py", line 39, in <module>
    "urllib3 v2.0 only supports OpenSSL 1.1.1+, currently "
ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with OpenSSL 1.0.2n  7 Dec 2017. See: https://github.com/urllib3/urllib3/issues/2168

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/electricpy/envs/develop/lib/python3.7/site-packages/sphinx/cmd/build.py", line 280, in build_main
    args.pdb)
  File "/home/docs/checkouts/readthedocs.org/user_builds/electricpy/envs/develop/lib/python3.7/site-packages/sphinx/application.py", line 219, in __init__
    self.setup_extension(extension)
  File "/home/docs/checkouts/readthedocs.org/user_builds/electricpy/envs/develop/lib/python3.7/site-packages/sphinx/application.py", line 398, in setup_extension
    self.registry.load_extension(self, extname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/electricpy/envs/develop/lib/python3.7/site-packages/sphinx/registry.py", line 463, in load_extension
    err) from err
sphinx.errors.ExtensionError: Could not import extension sphinx.builders.linkcheck (exception: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with OpenSSL 1.0.2n  7 Dec 2017. See: https://github.com/urllib3/urllib3/issues/2168)

Extension error:
Could not import extension sphinx.builders.linkcheck (exception: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with OpenSSL 1.0.2n  7 Dec 2017. See: https://github.com/urllib3/urllib3/issues/2168)

https://docs.readthedocs.io/en/stable/config-file/v2.html

Duplicate code in `fault.py`

# Compute Dot Product
M = A012.dot(M012)
# Condition Reference:
reference = reference.upper()
if reference == 'A':
pass
elif reference == 'B':
M = _np.roll(M, 1, 0)
elif reference == 'C':
M = _np.roll(M, 2, 0)
else:
raise ValueError("Invalid Phase Reference.")
return M

Already this function exists in conversions.py

Add Voltage Decibel Functions

I forgot that in a previous issue #66, there's still a few voltage decibel functions that would be valuable to have.

  • voltage_db (calculate the voltage in dB - first formula here )
  • vref_db (calculate the Vref from the dB value - second formula from link above)
  • v_from_db (calculate the voltage from the dB value - third formula from link above)

Pydocstyle error

./__init__.py:18[9](https://github.com/engineerjoe440/ElectricPy/runs/6358230744?check_suite_focus=true#step:5:9)7 in public function `crcsender`:
        D202: No blank lines allowed after function docstring (found 1)
./__init__.py:1991 in public function `crcremainder`:
        D202: No blank lines allowed after function docstring (found 1)
./__init__.py:5[13](https://github.com/engineerjoe440/ElectricPy/runs/6358230744?check_suite_focus=true#step:5:13)8 in public function `zener_diode_power`:
        D202: No blank lines allowed after function docstring (found 1)
Error: Process completed with exit code 1.

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.

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.