diff --git a/README.md b/README.md index 8cb5184..39e1a26 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,10 @@ -|Title | -|----------------------------------------------------------------------------------------------------------------| +|Jupyter Notebooks | +|-----------------------------------------------------------------------------------------------------------------------------------------------| |L-section_matching_calculations| |Calculations | -|Demo | - --- @@ -24,48 +22,12 @@ pip install matching_network ``` -Documentation +Usage ============= - -```python ->>> import matching_network as mn ->>> ->>> impedance_you_have = 90 + 32j # Ω ->>> impedance_you_want_to_have = 175 # Ω ->>> ->>> frequency = 900e6 # Hz ->>> ->>> mn.L_section_matching(impedance_you_have, impedance_you_want_to_have, frequency).match() -From (90+32j) Ω to 175 Ω - -normalized starting impedance = (90+32j)Ω/175Ω = 0.51429+0.18286j - -#solutions: 2 - -series-shunt - Series Inductor: - X = 55.464 Ω ⇔ B = -18.03 mS - L = 9.8082 nH (@ 900 MHz) - Shunt Capacitor: - X = -180.07 Ω ⇔ B = 5.5533 mS - C = 982.04 fF (@ 900 MHz) - -series-shunt - Series Capacitor: - X = -119.46 Ω ⇔ B = 8.3707 mS - C = 1.4803 pF (@ 900 MHz) - Shunt Inductor: - X = 180.07 Ω ⇔ B = -5.5533 mS - L = 31.844 nH (@ 900 MHz) - ->>> -``` - - -Or, straight from the CLI: +#### From the CLI ```bash -$ python -c "import matching_network as mn; print(mn.L_section_matching(100, 20+43j, 1e9).match());" +$ matching_network --from 100 --to 20+43j --freq 1e9 ``` ``` From 100 Ω to (20+43j) Ω @@ -103,3 +65,40 @@ series-shunt X = 44.929 Ω ⇔ B = -22.257 mS L = 7.1507 nH (@ 1 GHz) ``` + +#### Inside Python + +```python +>>> import matching_network as mn +>>> +>>> impedance_you_have = 90 + 32j # Ω +>>> impedance_you_want_to_have = 175 # Ω +>>> +>>> frequency = 900e6 # Hz +>>> +>>> mn.L_section_matching(impedance_you_have, impedance_you_want_to_have, frequency).match() +From (90+32j) Ω to 175 Ω + +normalized starting impedance = (90+32j)Ω/175Ω = 0.51429+0.18286j + +#solutions: 2 + +series-shunt + Series Inductor: + X = 55.464 Ω ⇔ B = -18.03 mS + L = 9.8082 nH (@ 900 MHz) + Shunt Capacitor: + X = -180.07 Ω ⇔ B = 5.5533 mS + C = 982.04 fF (@ 900 MHz) + +series-shunt + Series Capacitor: + X = -119.46 Ω ⇔ B = 8.3707 mS + C = 1.4803 pF (@ 900 MHz) + Shunt Inductor: + X = 180.07 Ω ⇔ B = -5.5533 mS + L = 31.844 nH (@ 900 MHz) + +>>> +``` + diff --git a/matching_network/__init__.py b/matching_network/__init__.py index f6c2ef5..51699d2 100644 --- a/matching_network/__init__.py +++ b/matching_network/__init__.py @@ -8,7 +8,7 @@ """Matching network module""" __title__ = 'matching_network' -__version__ = '0.1.0' +__version__ = '0.1.5' __author__ = u"Francesco Urbani" -from .main import L_section_matching +from .notmain import L_section_matching diff --git a/matching_network/__main__.py b/matching_network/__main__.py new file mode 100644 index 0000000..d7b38ef --- /dev/null +++ b/matching_network/__main__.py @@ -0,0 +1,35 @@ +# import sys +# import click + +# @click.group() +# @click.version_option("0.1.1") +# def main(): +# """A Lumped Parameters LC matching networks CLI solver. + +# urbanij.github.io/projects/matching_networks/ + +# urbanij.github.io/syRF +# """ +# print("Hye") +# pass + + +import click +import matching_network as mn + + +@click.command() +# @click.argument('keyword', required=False) +@click.option('--from', '-f', 'from_', required=True, type=complex) +@click.option('--to', '-t', 'to', required=True, type=complex) +@click.option('--frequency', '--freq', 'frequency', required=False, type=float) +def cli(from_, to, frequency): + print( + mn.L_section_matching( + input_impedance=from_, + output_impedance=to, + frequency=frequency + ).match() + ) + +cli() \ No newline at end of file diff --git a/matching_network/main.py b/matching_network/notmain.py similarity index 100% rename from matching_network/main.py rename to matching_network/notmain.py diff --git a/pyproject.toml b/pyproject.toml index c0f508f..dc0eaa1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,18 +1,19 @@ [tool.poetry] name = "matching_network" -version = "0.1.0" +version = "0.1.5" description = 'Design lumped-parameters matching networks (L-sections)' license = "MIT" readme = "README.md" homepage = "https://pypi.org/project/matching-network/" repository = "https://github.com/urbanij/matching-network" # documentation = "https://github.com/urbanij/matching-network" -keywords = ["matching networks", "l-section-matching", "lumped-parameters-matching"] +keywords = ["matching network", "matching networks", "l-section-matching", "lumped-parameters-matching"] authors = ["Francesco Urbani "] [tool.poetry.dependencies] python = "^3.6" quantiphy = "^2.13.0" +click = "^7.1.2" [tool.poetry.dev-dependencies] pytest = "^5.2" @@ -20,3 +21,6 @@ pytest = "^5.2" [build-system] requires = ["poetry>=0.12"] build-backend = "poetry.masonry.api" + +[tool.poetry.scripts] +matching_network = "matching_network.__main__:cli" \ No newline at end of file