Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B-ASIC - Better ASIC Toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computer Engineering
B-ASIC - Better ASIC Toolbox
Commits
f4cb6655
Commit
f4cb6655
authored
1 year ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Use jupyter-sphinx
parent
1489c7f2
No related branches found
No related tags found
1 merge request
!272
Use jupyter-sphinx
Pipeline
#93737
passed
1 year ago
Stage: test
Stage: deploy
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+1
-0
1 addition, 0 deletions
README.md
docs_sphinx/conf.py
+1
-0
1 addition, 0 deletions
docs_sphinx/conf.py
examples/connectmultiplesfgs.py
+43
-90
43 additions, 90 deletions
examples/connectmultiplesfgs.py
requirements_doc.txt
+1
-0
1 addition, 0 deletions
requirements_doc.txt
with
46 additions
and
90 deletions
README.md
+
1
−
0
View file @
f4cb6655
...
@@ -52,6 +52,7 @@ To generate the documentation, the following additional packages are required:
...
@@ -52,6 +52,7 @@ To generate the documentation, the following additional packages are required:
-
[
numpydoc
](
https://numpydoc.readthedocs.io/
)
-
[
numpydoc
](
https://numpydoc.readthedocs.io/
)
-
[
Sphinx-Gallery
](
https://sphinx-gallery.github.io/
)
-
[
Sphinx-Gallery
](
https://sphinx-gallery.github.io/
)
-
[
mplsignal
](
https://mplsignal.readthedocs.io/
)
-
[
mplsignal
](
https://mplsignal.readthedocs.io/
)
-
[
jupyters-sphinx
](
https://jupyter-sphinx.readthedocs.io/
)
### Using setuptools to create a package
### Using setuptools to create a package
...
...
This diff is collapsed.
Click to expand it.
docs_sphinx/conf.py
+
1
−
0
View file @
f4cb6655
...
@@ -24,6 +24,7 @@ extensions = [
...
@@ -24,6 +24,7 @@ extensions = [
'
sphinx.ext.intersphinx
'
,
'
sphinx.ext.intersphinx
'
,
'
sphinx_gallery.gen_gallery
'
,
'
sphinx_gallery.gen_gallery
'
,
'
numpydoc
'
,
# Needs to be loaded *after* autodoc.
'
numpydoc
'
,
# Needs to be loaded *after* autodoc.
'
jupyter_sphinx
'
,
]
]
templates_path
=
[
'
_templates
'
]
templates_path
=
[
'
_templates
'
]
...
...
This diff is collapsed.
Click to expand it.
examples/connectmultiplesfgs.py
+
43
−
90
View file @
f4cb6655
...
@@ -13,94 +13,47 @@ interest to "flatten" the SFGs, i.e., get a resulting SFG not containing other
...
@@ -13,94 +13,47 @@ interest to "flatten" the SFGs, i.e., get a resulting SFG not containing other
SFGs but the operations of these. To do this, one will have to use the
SFGs but the operations of these. To do this, one will have to use the
method :func:`~b_asic.signal_flow_graph.SFG.connect_external_signals_to_components`.
method :func:`~b_asic.signal_flow_graph.SFG.connect_external_signals_to_components`.
This example illustrates how this can be done.
This example illustrates how it can be done.
"""
.. jupyter-execute::
from b_asic.sfg_generators import wdf_allpass
from b_asic.signal_flow_graph import SFG
from b_asic.special_operations import Input, Output
# Generate allpass branches for fifth-ordet LWDF filter
allpass1 = wdf_allpass([0.2, 0.5])
allpass2 = wdf_allpass([-0.5, 0.2, 0.5])
in_lwdf = Input()
allpass1 << in_lwdf
allpass2 << in_lwdf
out_lwdf = Output((allpass1 + allpass2) * 0.5)
# Create SFG of LWDF with two internal SFGs
sfg_with_sfgs = SFG(
[in_lwdf], [out_lwdf], name=
"
LWDF with separate internals SFGs for allpass branches
"
)
The resulting SFG looks like:
.. jupyter-execute::
from
b_asic.sfg_generators
import
wdf_allpass
sfg_with_sfgs
from
b_asic.signal_flow_graph
import
SFG
from
b_asic.special_operations
import
Input
,
Output
Now, to create a LWDF where the SFGs are flattened. Note that the original SFGs
# Generate allpass branches for fifth-ordet LWDF filter
``allpass1`` and ``allpass2`` currently cannot be printed etc after this operation.
allpass1
=
wdf_allpass
([
0.2
,
0.5
])
allpass2
=
wdf_allpass
([
-
0.5
,
0.2
,
0.5
])
.. jupyter-execute::
in_lwdf
=
Input
()
allpass1.connect_external_signals_to_components()
allpass1
<<
in_lwdf
allpass2.connect_external_signals_to_components()
allpass2
<<
in_lwdf
flattened_sfg = SFG([in_lwdf], [out_lwdf], name=
"
Flattened LWDF
"
)
out_lwdf
=
Output
((
allpass1
+
allpass2
)
*
0.5
)
Resulting in:
# Create SFG of LWDF with two internal SFGs
sfg_with_sfgs
=
SFG
(
.. jupyter-execute::
[
in_lwdf
],
[
out_lwdf
],
name
=
"
LWDF with separate internals SFGs for allpass branches
"
)
flattened_sfg
"""
# %%
# Rendering the SFG will result in something like:
#
# .. graphviz::
#
# digraph {
# rankdir=LR
# in1 [shape=cds]
# in1 -> sfg1
# in1 -> sfg2
# out1 [shape=cds]
# cmul1 -> out1
# sfg1 [shape=ellipse]
# sfg1 -> add1
# add1 [shape=ellipse]
# sfg2 -> add1
# sfg2 [shape=ellipse]
# add1 -> cmul1
# cmul1 [shape=ellipse]
# }
#
# Now, to create a LWDF where the SFGs are flattened. Note that the original SFGs
# ``allpass1`` and ``allpass2`` currently cannot be printed etc after this operation.
allpass1
.
connect_external_signals_to_components
()
allpass2
.
connect_external_signals_to_components
()
flattened_sfg
=
SFG
([
in_lwdf
],
[
out_lwdf
],
name
=
"
Flattened LWDF
"
)
# %%
# Resulting in:
#
# .. graphviz::
#
# digraph {
# rankdir=LR
# in1 [shape=cds]
# in1 -> sym2p1
# in1 -> sym2p4
# out1 [shape=cds]
# cmul1 -> out1
# sym2p1 [shape=ellipse]
# sym2p2 -> sym2p1
# sym2p2 [shape=ellipse]
# sym2p1 -> add1
# add1 [shape=ellipse]
# sym2p1 -> t1
# t1 [shape=square]
# t1 -> sym2p2
# sym2p3 -> add1
# sym2p3 [shape=ellipse]
# add1 -> cmul1
# cmul1 [shape=ellipse]
# sym2p4 -> sym2p3
# sym2p4 [shape=ellipse]
# sym2p5 -> sym2p3
# sym2p5 [shape=ellipse]
# sym2p3 -> t2
# t2 [shape=square]
# t2 -> sym2p5
# t3 -> sym2p5
# t3 [shape=square]
# sym2p5 -> t3
# t4 -> sym2p4
# t4 [shape=square]
# sym2p4 -> t4
# t5 -> sym2p2
# t5 [shape=square]
# sym2p2 -> t5
# }
#
This diff is collapsed.
Click to expand it.
requirements_doc.txt
+
1
−
0
View file @
f4cb6655
...
@@ -3,3 +3,4 @@ furo
...
@@ -3,3 +3,4 @@ furo
numpydoc
numpydoc
sphinx-gallery
sphinx-gallery
mplsignal
mplsignal
jupyter-sphinx
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment