Skip to content
Snippets Groups Projects
Commit 92ba074b authored by Sean Leavey's avatar Sean Leavey
Browse files

Merge branch 'release/0.6.6'

parents 00f14f2a b8d9abca
No related branches found
Tags 0.6.6
1 merge request!2Feature/plot enhancement Added plot_dB argument
Pipeline #66497 passed
......@@ -16,15 +16,33 @@ Documentation style
Use `NumPy docstring format`_. Language and grammar should follow `Google style`_.
Development environment
~~~~~~~~~~~~~~~~~~~~~~~
A Visual Studio Code configuration file is provided in the project root when checked out via
``git``, which sets some code format settings which should be followed. This configuration file is
used automatically if the project is opened in Visual Studio Code from its root directory.
It may be useful to run |Zero| within a ``conda`` or ``pipenv`` environment to allow for separation
of dependencies from your system and from other projects. In both cases it is still recommended to
install |Zero| via ``pip``. For rapid development, it is highly recommended to make the project
`editable` so changes to project files reflect immediately in the library and CLI, and to install
the extra `dev` dependencies to allow you to build the documentation and run code linting tools:
.. code-block:: bash
pip install -e .[dev]
Merge requests
~~~~~~~~~~~~~~
Please open a `merge request`_ on GitLab, targeting |Zero|'s `develop` branch. To keep the git
repository's merge graph clean, ideally you should make your changes on a branch with one of the
following conventions depending on what kind of change you make:
If you have code to submit for inclusion in |Zero|, please open a `merge request`_ on GitLab
targeting the ``develop`` branch. To keep the git repository's merge graph clean, ideally you should
make your changes on a branch with one of the following conventions depending on what kind of change
you make:
- ``feature/my-feature`` for new features
- ``fix/my-fix`` for bug fixes
- ``hotfix/my-fix`` for bug fixes
Replace ``my-feature`` or ``my-fix`` with an appropriate short description. This naming scheme
roughly follows that presented in `A successful Git branching model`_.
......@@ -49,6 +67,36 @@ The steps below should be followed when creating a new release:
#. Delete the release branch: ``git branch -d release/x.x.x``.
#. Push all changes to ``master`` and ``develop`` and the new tag to origin.
Updating PyPI (pip) package
---------------------------
This requires `twine <https://packaging.python.org/key_projects/#twine>`__ and the credentials for
the |Zero| PyPI project.
#. Go to the source root directory.
#. Checkout the ``master`` branch (so the release uses the correct tag).
#. Remove previously generated distribution files:
``rm -rf build dist``
#. Create new distribution files:
``python setup.py sdist bdist_wheel``
#. (Optional) Upload distribution files to PyPI test server, entering the required credentials when
prompted:
``python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*``
You can then check the package is uploaded properly by viewing the `Zero project on the PyPI test server`_.
You can also check that it installs correctly with:
``pip install --index-url https://test.pypi.org/simple/ --no-deps zero``
Note: even if everything installs correctly, the test package will not work correctly due to lack
of dependencies (forced by the ``--no-deps`` flag, since they are not all available on the PyPI
test server).
#. Upload distribution files to PyPI, entering the required credentials when prompted:
``python -m twine upload dist/*``
#. Verify everything is up-to-date on `PyPI <https://pypi.org/project/zero/>`__.
API documentation
~~~~~~~~~~~~~~~~~
......@@ -57,9 +105,9 @@ API documentation
api/modules
.. _PEP 8: https://www.python.org/dev/peps/pep-0008/
.. _NumPy docstring format: https://numpydoc.readthedocs.io/en/latest/example.html
.. _Google style: https://developers.google.com/style/
.. _merge request: https://git.ligo.org/sean-leavey/zero/merge_requests
.. _A successful Git branching model: https://nvie.com/posts/a-successful-git-branching-model/
.. _Zero project on the PyPI test server: https://test.pypi.org/project/zero/
......@@ -27,20 +27,20 @@ or :class:`nodes <.Node>` or names, while the source in :meth:`~.Solution.get_no
>>> import numpy as np
>>> from zero import Circuit
>>> from zero.analysis import AcNoiesAnalysis
>>> from zero.analysis import AcNoiseAnalysis
>>> circuit = Circuit()
>>> circuit.add_opamp(name="op1", model="OP27", node1="gnd", node2="nin", node3="nout")
>>> circuit.add_resistor(name="r1", value="1k", node1="nin", node2="nout")
>>> op1 = circuit["op1"]
# Perform noise analysis.
>>> noise_analysis = AcNoiseAnalysis(circuit)
>>> solution = analysis.calculate(frequencies=frequencies, input_type="voltage", node="nin", sink="nout")
>>> solution = noise_analysis.calculate(frequencies=np.logspace(0, 4, 1001), input_type="voltage", node="nin", sink="nout")
# Get voltage noise from op-amp at the output node.
>>> str(solution.get_noise(op1.voltage_noise, "nout"))
'V(op1) to nout'
>>> print(solution.get_noise(op1.voltage_noise, "nout"))
V(op1) to nout
# Alternatively retrieve using string.
>>> str(solution.get_noise("V(op1)", "nout"))
'V(op1) to nout'
>>> print(solution.get_noise("V(op1)", "nout"))
V(op1) to nout
Combining solutions
......
"""Circuit node graph display.
Sean Leavey
"""
import numpy as np
from zero import Circuit
from zero.display import NodeGraph
if __name__ == "__main__":
# Create circuit object.
circuit = Circuit()
# Add components.
circuit.add_capacitor(value="10u", node1="gnd", node2="n1")
circuit.add_resistor(value="430", node1="n1", node2="nm")
circuit.add_resistor(value="43k", node1="nm", node2="nout")
circuit.add_capacitor(value="47p", node1="nm", node2="nout")
circuit.add_library_opamp(model="LT1124", node1="gnd", node2="nm", node3="nout")
# Show.
graph = NodeGraph(circuit)
def in_notebook():
"""Detect if we're inside an IPython/Jupyter notebook."""
try:
from IPython import get_ipython
if 'IPKernelApp' not in get_ipython().config:
return False
except (ImportError, AttributeError):
return False
return True
if in_notebook():
from IPython.display import display
display(graph)
else:
graph.view_pdf()
......@@ -31,9 +31,6 @@ from .circuit import Circuit
# suppress warnings when the user code does not include a handler
logging.getLogger().addHandler(logging.NullHandler())
# use default locale (required for number formatting in log warnings)
locale.setlocale(locale.LC_ALL, "")
def add_log_handler(logger, handler=None, format_str="%(name)-25s - %(levelname)-8s - %(message)s"):
if handler is None:
handler = logging.StreamHandler()
......
......@@ -86,7 +86,7 @@ def cli():
@click.pass_context
def liso(ctx, file, liso, liso_path, compare, diff, plot, save_figure, print_equations,
print_matrix):
"""Parse and simulate LISO input or output file"""
"""Parse and simulate LISO input or output file."""
state = ctx.ensure_object(State)
# check which solutions must be computed
......
......@@ -42,7 +42,7 @@
# Strings starting with '#' are comments.
schema: 1
distributed_with: 0.6.5
distributed_with: 0.6.6
op-amps:
......
......@@ -31,19 +31,21 @@ class NodeGraph:
graph = self.graphviz.Digraph(engine=CONF["graphviz"]["engine"])
graph.attr("node", style=CONF["graphviz"]["node_style"],
fontname=CONF["graphviz"]["node_font_name"],
fontsize=CONF["graphviz"]["node_font_size"])
# For some reason, font size must be suppied as string.
fontsize=str(CONF["graphviz"]["node_font_size"]))
graph.attr("edge", arrowhead=CONF["graphviz"]["edge_arrowhead"])
graph.attr("graph", splines=CONF["graphviz"]["graph_splines"],
label="Made with graphviz and Zero",
fontname=CONF["graphviz"]["graph_font_name"],
fontsize=CONF["graphviz"]["graph_font_size"])
# For some reason, font size must be suppied as string.
fontsize=str(CONF["graphviz"]["graph_font_size"]))
node_map = {}
def add_connection(component, conn, node):
if node == 'gnd':
graph.node("%s_%s" % (component, node), shape='point', style='invis')
graph.edge('%s_%s' % (component, node), component+conn, dir='both', arrowtail='tee',
len='0.0', weight='10')
len='0.0', weight='10')
else:
if not node in node_map:
graph.node(node, shape='point', xlabel=node, width='0.1', fillcolor='Red')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment