Skip to content

Instantly share code, notes, and snippets.

"""
Embedded Python Blocks:
Each time this file is saved, GRC will instantiate the first class it finds
to get ports and parameters of your block. The arguments to __init__ will
be the parameters. All of them are required to have default values!
"""
import numpy as np
from gnuradio import gr
@bistromath
bistromath / gist:bac29f46788dd35f4e90588228145987
Created December 12, 2018 22:27
Calculate closest series R pair (or parallel C pair) to a given value
#!/usr/bin/env python
import math
import numpy as np
#calc two series R or two parallel C that produce the closest result
target = int(float(raw_input("Target value: "))*100)
tolerance = float(raw_input("Tolerance (1 or 5): "))
if tolerance == 5:
stdvals = [10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 82]

Keybase proof

I hereby claim:

  • I am bistromath on github.
  • I am njf (https://keybase.io/njf) on keybase.
  • I have a public key whose fingerprint is 4BA3 A1D5 01DE EA0A 09D9 BB33 90A1 7F14 A9AD 1B71

To claim this, I am signing this object: