├── Constellations ├── BaseConstellation.py ├── MPSKConstellation.py ├── QAMConstellation.py ├── ReshapedQAMConstellation.py └── __init__.py ├── Data └── gainprofile_40steps.mat ├── Documentation ├── Makefile ├── _static │ ├── Simple Demo.webm │ └── Ubuntu 1804 Install.webm ├── code_doc.rst ├── conf.py ├── constellations.rst ├── examples.rst ├── filters.rst ├── getting_started.rst ├── helpers.rst ├── index.rst ├── installation.rst ├── links.rst ├── modulators.rst ├── normalization.rst ├── qualityassessment.rst └── videos.rst ├── Examples ├── BaseExample.py ├── BuelowArefIdler2016.py ├── GuiEtAl2018.py ├── LeArefBuelow2017.py └── __init__.py ├── Filters ├── BaseFilter.py ├── FFTLowPass.py ├── PassThrough.py └── __init__.py ├── Helpers ├── NFSpectrum.py ├── __init__.py ├── plot.py └── widgets.py ├── LICENSE ├── Links ├── BaseLink.py ├── SMFSplitStep.py ├── __init__.py └── _ssprop.py ├── Modulators ├── BaseModulator.py ├── CarrierWaveforms.py ├── ContSpecModulator.py ├── DiscSpecModulator.py └── __init__.py ├── Normalization └── __init__.py ├── Notebooks ├── BuelowArefIdler2016.ipynb ├── GuiEtAl2018.ipynb └── LeArefBuelow2017.ipynb ├── QualityAssessment ├── BitErrorRatio.py ├── ConstellationDiagram.py ├── ErrorVectorMagnitude.py ├── ModulationEfficiency.py └── __init__.py ├── README.md └── ubuntu_1804_install.sh /Constellations/BaseConstellation.py: -------------------------------------------------------------------------------- 1 | # This file is part of NFDMLab. 2 | # 3 | # NFDMLab is free software; you can redistribute it and/or 4 | # modify it under the terms of the version 2 of the GNU General 5 | # Public License as published by the Free Software Foundation. 6 | # 7 | # NFDMLab is distributed in the hope that it will be useful, but 8 | # WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | # GNU General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU General Public 13 | # License along with NFDMLab; if not, write to the Free Software 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 15 | # 02111-1307 USA 16 | # 17 | # Contributors: 18 | # Sander Wahls (TU Delft) 2018 19 | 20 | from abc import ABC, abstractmethod 21 | import numpy as np 22 | from QualityAssessment import ConstellationDiagram 23 | from Helpers import checked_get 24 | 25 | class BaseConstellation(ABC): 26 | """Base class for constellations such as QAM or PSK. 27 | 28 | Notes 29 | ----- 30 | 31 | * Other constellations should be derived from this class. They need to initialize self._alphabet, which is returned by the alphabet property, self._bit_matrix, which is returned by the bit_matrix property, and self._str, which is returned by the str property. 32 | 33 | * Bits are represented by the numbers zero and one. 34 | """ 35 | 36 | @property 37 | def alphabet(self): 38 | """numpy.array (complex) : Vector of constellation points. The number of 39 | points has to be a power of two.""" 40 | 41 | return checked_get(self, "_alphabet", np.ndarray) 42 | 43 | @property 44 | def bit_matrix(self): 45 | """numpy.array(int) : Matrix of bit patterns. 46 | 47 | The size of the matrix should be N x M, where N is the size of the 48 | alphabet and M is the number of bits per symbol. The n-th row of the 49 | matrix contains the bit pattern of the n-th symbol in the alphabet. The 50 | allowed values in the matrix are zero and one.""" 51 | 52 | return checked_get(self, "_bit_matrix", np.ndarray) 53 | 54 | @property 55 | def name(self): 56 | """str : Identifcation string for the constellation, should also specify parameters.""" 57 | 58 | return checked_get(self, "_name", str) 59 | 60 | def size(self): 61 | """int : Number of elements in the alphabet.""" 62 | 63 | return np.size(self.alphabet) 64 | 65 | def idx2symbol(self, idx): 66 | """Translates a vector of indices into a vector of symbols. 67 | 68 | Parameters 69 | ---------- 70 | idx : numpy.array(integer) 71 | Vector of indices. 72 | 73 | Returns 74 | ------- 75 | numpy.array(complex) 76 | A array with the same length as idx whose n-th element is 77 | self.alphabet[idx[n]]. 78 | """ 79 | 80 | ni = np.size(idx) 81 | symbols = np.zeros(ni, dtype=complex) 82 | for i in range(0, ni): 83 | symbols[i] = self.alphabet[idx[i]] 84 | return symbols 85 | 86 | def symbol2idx(self, symbols): 87 | """Translates a vector of symbols into a vector of indices. 88 | 89 | Parameters 90 | ---------- 91 | symbols : numpy.array(complex) 92 | Vector of symbols. 93 | 94 | Returns 95 | ------- 96 | numpy.array(integer) 97 | A vector with the same length as symbols whose n-th element is the 98 | integer number i=i(n) in 0,...,numpy.size(symbols)-1 that minimizes 99 | the Eucledian distance \|symbols[n] - self.alphabet[i]\|. 100 | """ 101 | 102 | ns = np.size(symbols) 103 | idx = np.zeros(ns, dtype=int) 104 | for i in range(0, ns): 105 | dists = np.abs(symbols[i] - self.alphabet) 106 | idx[i] = np.argmin(dists) 107 | return idx 108 | 109 | def idx2bits(self, idx): 110 | """Translates a vector of indices into a bit pattern. 111 | 112 | Parameters 113 | ---------- 114 | idx : numpy.array(complex) 115 | Vector of indices 116 | 117 | Returns 118 | ------- 119 | numpy.array(complex) 120 | Vector of bits 121 | """ 122 | if np.size(idx)==1: 123 | return self.bit_matrix[idx, :] 124 | bits = np.zeros((np.size(idx), np.size(self.bit_matrix, 1)), dtype=int) 125 | for i in range(0, np.size(idx)): 126 | bits[i,:] = self.bit_matrix[idx[i], :] 127 | return bits 128 | 129 | def show(self, new_fig=False): 130 | """Shows the constellation alphabet together with the bit patterns. 131 | 132 | Parameters 133 | ---------- 134 | 135 | new_fig : bool 136 | Always creates a new figure if True, reuses existing figures if False. 137 | 138 | Returns 139 | ------- 140 | 141 | Figure 142 | matplotlib figure handle (only if new_fig=True) 143 | """ 144 | constellation_diagram = ConstellationDiagram(self) 145 | return constellation_diagram.plot(np.array([]), 146 | show_bits=True, 147 | title=self.name, 148 | new_fig=new_fig) 149 | 150 | def gray_code(self, m, n): 151 | """Gray code bit matrix. 152 | 153 | Parameters 154 | ---------- 155 | 156 | m : int 157 | n : int 158 | 159 | Returns 160 | ------- 161 | 162 | numpy.array(int) 163 | Matrix as described in the bit_matrix property. The number of bit patterns (rows) is m*n. The number of bits per pattern (columns) is ceil(log2(m*n)). 164 | """ 165 | bit_matrix = np.array([[0], [1]], dtype=int) 166 | for i in range(0, int(np.ceil(np.log2(m*n)))-1): 167 | r = np.size(bit_matrix, 0) 168 | tmp1 = np.hstack((np.zeros((r, 1), dtype=int), bit_matrix)) 169 | tmp2 = np.hstack((np.ones((r, 1), dtype=int), np.flipud(bit_matrix))) 170 | bit_matrix = np.vstack((tmp1, tmp2)) 171 | for i in range(1, m+1, 2): 172 | bit_matrix[i*n:(i+1)*n, :] = np.flipud(bit_matrix[i*n:(i+1)*n, :]) 173 | return bit_matrix 174 | -------------------------------------------------------------------------------- /Constellations/MPSKConstellation.py: -------------------------------------------------------------------------------- 1 | # This file is part of NFDMLab. 2 | # 3 | # NFDMLab is free software; you can redistribute it and/or 4 | # modify it under the terms of the version 2 of the GNU General 5 | # Public License as published by the Free Software Foundation. 6 | # 7 | # NFDMLab is distributed in the hope that it will be useful, but 8 | # WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | # GNU General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU General Public 13 | # License along with NFDMLab; if not, write to the Free Software 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 15 | # 02111-1307 USA 16 | # 17 | # Contributors: 18 | # Sander Wahls (TU Delft) 2018 19 | # Shrinivas Chimmalgi (TU Delft) 2018 20 | 21 | import numpy as np 22 | from Constellations import BaseConstellation 23 | from QualityAssessment import ConstellationDiagram 24 | 25 | class MPSKConstellation(BaseConstellation): 26 | """Phase shift keying (PSK) modulation. Implements BaseConstellation.""" 27 | 28 | def __init__(self, m, rotate_by_delta_half=False): 29 | """Contructor for a PSK constellation. 30 | 31 | Parameters 32 | ---------- 33 | 34 | m : int 35 | Number of constellation points 36 | rotate_by_delta_half : Boolean 37 | Rotate constellation by 2pi/m 38 | """ 39 | del_theta = 2*np.pi/m; 40 | if not rotate_by_delta_half: 41 | self._alphabet = np.exp(np.arange(0,m)*1j*del_theta) 42 | else: 43 | self._alphabet = np.exp((np.arange(0,m)*del_theta + del_theta/2)*1j) 44 | nbits = int(np.ceil(np.log2(m))) 45 | vals = np.arange(0,m,dtype=int) 46 | gray_code = np.bitwise_xor(vals,(np.floor(vals/2)).astype(int)) 47 | self._bit_matrix = np.zeros((m, nbits), dtype=int) 48 | for i in range(0,m): 49 | tmp_str = np.binary_repr(gray_code[i],width=nbits) 50 | self._bit_matrix[i,:] = [int(j) for element in tmp_str for j in element] 51 | self._name = "%d-PSK Constellation" % self.size() 52 | -------------------------------------------------------------------------------- /Constellations/QAMConstellation.py: -------------------------------------------------------------------------------- 1 | # This file is part of NFDMLab. 2 | # 3 | # NFDMLab is free software; you can redistribute it and/or 4 | # modify it under the terms of the version 2 of the GNU General 5 | # Public License as published by the Free Software Foundation. 6 | # 7 | # NFDMLab is distributed in the hope that it will be useful, but 8 | # WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | # GNU General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU General Public 13 | # License along with NFDMLab; if not, write to the Free Software 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 15 | # 02111-1307 USA 16 | # 17 | # Contributors: 18 | # Sander Wahls (TU Delft) 2018-2019 19 | 20 | import numpy as np 21 | from Constellations import BaseConstellation 22 | 23 | class QAMConstellation(BaseConstellation): 24 | """Quadrature amplitude modulation (QAM) constellation (implements BaseConstellation).""" 25 | 26 | def __init__(self, m, n): 27 | """Constructor for a m x n QAM constellation. 28 | 29 | Parameters 30 | ---------- 31 | 32 | m : int 33 | Number of rows in the constellation. 34 | n : int 35 | Number of columns in the constellation. 36 | """ 37 | self._alphabet = np.zeros(m*n, dtype=complex) 38 | for i in range(0, m): 39 | for j in range(0, n): 40 | self.alphabet[i*n+j] = (i - (m-1)/2.0) + 1.0j*(j - (n-1)/2.0) 41 | self._alphabet = self.alphabet / np.max(np.abs(self.alphabet)) 42 | self._bit_matrix = self.gray_code(m, n) 43 | self._name = "%d-QAM Constellation" % self.size() 44 | -------------------------------------------------------------------------------- /Constellations/ReshapedQAMConstellation.py: -------------------------------------------------------------------------------- 1 | # This file is part of NFDMLab. 2 | # 3 | # NFDMLab is free software; you can redistribute it and/or 4 | # modify it under the terms of the version 2 of the GNU General 5 | # Public License as published by the Free Software Foundation. 6 | # 7 | # NFDMLab is distributed in the hope that it will be useful, but 8 | # WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | # GNU General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU General Public 13 | # License along with NFDMLab; if not, write to the Free Software 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 15 | # 02111-1307 USA 16 | # 17 | # Contributors: 18 | # Sander Wahls (TU Delft) 2018 19 | # Shrinivas Chimmalgi (TU Delft) 2018 20 | 21 | import numpy as np 22 | import scipy.integrate as integrate 23 | import warnings 24 | 25 | from Constellations import QAMConstellation 26 | 27 | class ReshapedQAMConstellation(QAMConstellation): 28 | """Reshaped quadrature amplitude modulation (QAM) constellation (implements 29 | BaseConstellation). 30 | 31 | The goal of the reshaping procedure is to fit the average (normalized) 32 | energy of the generated pulses to a desired value Ed. For details, see 33 | Gui et al., Opt. Express 26(21), 2018. 34 | """ 35 | 36 | def __init__(self, m, n, b0_fun, Ed, bnds): 37 | """Constructor for a reshaped m x n QAM constellation. 38 | 39 | Parameters 40 | ---------- 41 | m : int 42 | n : int 43 | b0_fun : function 44 | Carrier waveform. The function should maps any input vector of the 45 | type numpy.array(float), which represents a vector of nonlinear 46 | frequencies xi, to a output vector of the type numpy.array(complex), 47 | which represents the values of the carrier waveform at these xi. 48 | Ed : float 49 | Desired average energy of the generated pulses (with respect to 50 | normalized units). Should be positive. 51 | bnds : numpy.array(float) 52 | Vector with two entries [a,b], which are used as initial bounds in 53 | the bisection produdure based on which the constellation is 54 | reshaped. It should be 0`_. 5 | 6 | .. toctree:: 7 | :maxdepth: 3 8 | :caption: Contents: 9 | 10 | constellations 11 | filters 12 | helpers 13 | normalization 14 | links 15 | modulators 16 | qualityassessment 17 | examples 18 | -------------------------------------------------------------------------------- /Documentation/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Configuration file for the Sphinx documentation builder. 4 | # 5 | # This file does only contain a selection of the most common options. For a 6 | # full list see the documentation: 7 | # http://www.sphinx-doc.org/en/master/config 8 | 9 | # https://stackoverflow.com/questions/9153473/sphinx-values-for-attributes-reported-as-none 10 | from sphinx.ext.autodoc import ( 11 | ClassLevelDocumenter, InstanceAttributeDocumenter) 12 | def iad_add_directive_header(self, sig): 13 | ClassLevelDocumenter.add_directive_header(self, sig) 14 | InstanceAttributeDocumenter.add_directive_header = iad_add_directive_header 15 | 16 | # -- Path setup -------------------------------------------------------------- 17 | 18 | # If extensions (or modules to document with autodoc) are in another directory, 19 | # add these directories to sys.path here. If the directory is relative to the 20 | # documentation root, use os.path.abspath to make it absolute, like shown here. 21 | # 22 | import os 23 | import sys 24 | sys.path.insert(0, os.path.abspath('..')) 25 | 26 | # -- General configuration --------------------------------------------------- 27 | 28 | # If your documentation needs a minimal Sphinx version, state it here. 29 | # 30 | # needs_sphinx = '1.0' 31 | 32 | # Add any Sphinx extension module names here, as strings. They can be 33 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 34 | # ones. 35 | extensions = [ 36 | 'sphinx.ext.autodoc', 37 | 'sphinx.ext.coverage', 38 | 'sphinx.ext.viewcode', 39 | 'sphinx.ext.githubpages', 40 | 'sphinx.ext.napoleon', 41 | 'sphinx.ext.extlinks', 42 | 'sphinx.ext.intersphinx', 43 | 'sphinx.ext.todo', 44 | 'alabaster', 45 | 'recommonmark', 46 | ] 47 | 48 | # Add any paths that contain templates here, relative to this directory. 49 | #templates_path = ['_templates'] 50 | 51 | # The suffix(es) of source filenames. 52 | # You can specify multiple suffix as a list of string: 53 | # 54 | #source_suffix = ['.rst', '.md'] 55 | #source_suffix = '.rst' 56 | source_suffix = { 57 | '.rst': 'restructuredtext', 58 | '.txt': 'markdown', 59 | '.md': 'markdown', 60 | } 61 | 62 | # The master toctree document. 63 | master_doc = 'index' 64 | 65 | # General information about the project. 66 | project = u'NFDMLab' 67 | #copyright = u' %s, Red Hat Inc.' % datetime.date.today().year 68 | #author = u'AUTHORS.rst' 69 | project = 'NFDMLab' 70 | #copyright = '2019, Marius Brehler , Christoph Mahnke, Shrinivas Chimmalgi and Sander Wahls' 71 | author = 'Marius Brehler , Christoph Mahnke, Shrinivas Chimmalgi and Sander Wahls' 72 | 73 | github_url = 'https://github.com' 74 | github_repo_org = 'FastNFT' 75 | github_repo_name = 'NFDMLab' 76 | #github_repo_slug = f'{github_repo_org}/{github_repo_name}' 77 | #github_repo_url = f'{github_url}/{github_repo_slug}' 78 | 79 | extlinks = {'issue': ('https://github.com/sphinx-doc/sphinx/issues/%s', 80 | 'issue ')} 81 | 82 | intersphinx_mapping = { 83 | 'ansible': ('https://docs.ansible.com/ansible/devel/', None), 84 | 'pip': ('https://pip.pypa.io/en/latest/', None), 85 | 'python': ('https://docs.python.org/3', None), 86 | 'python2': ('https://docs.python.org/2', None), 87 | } 88 | 89 | # The short X.Y version 90 | version = '' 91 | # The full version, including alpha/beta/rc tags 92 | #release = '0.1' 93 | 94 | 95 | # The language for content autogenerated by Sphinx. Refer to documentation 96 | # for a list of supported languages. 97 | # 98 | # This is also used if you do content translation via gettext catalogs. 99 | # Usually you set "language" from the command line for these cases. 100 | language = None 101 | 102 | # List of patterns, relative to source directory, that match files and 103 | # directories to ignore when looking for source files. 104 | # This pattern also affects html_static_path and html_extra_path. 105 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] 106 | 107 | # The name of the Pygments (syntax highlighting) style to use. 108 | pygments_style = None 109 | 110 | 111 | # -- Options for HTML output ------------------------------------------------- 112 | 113 | # The theme to use for HTML and HTML Help pages. See the documentation for 114 | # a list of builtin themes. 115 | # 116 | html_theme = 'alabaster' 117 | 118 | # Theme options are theme-specific and customize the look and feel of a theme 119 | # further. For a list of options available for each theme, see the 120 | # documentation. 121 | # 122 | # html_theme_options = {} 123 | 124 | # Add any paths that contain custom static files (such as style sheets) here, 125 | # relative to this directory. They are copied after the builtin static files, 126 | # so a file named "default.css" will overwrite the builtin "default.css". 127 | html_static_path = ['_static'] 128 | 129 | # Custom sidebar templates, must be a dictionary that maps document names 130 | # to template names. 131 | # 132 | # The default sidebars (for documents that don't match any pattern) are 133 | # defined by theme itself. Builtin themes are using these templates by 134 | # default: ``['localtoc.html', 'relations.html', 'sourcelink.html', 135 | # 'searchbox.html']``. 136 | # 137 | html_sidebars = {} 138 | #html_sidebars = { 139 | # '**': [ 140 | # 'about.html', 141 | # 'navigation.html', 142 | # 'searchbox.html', 143 | # 'localtoc.html', 144 | # 'relations.html', 145 | # ], 146 | #} 147 | 148 | # -- Options for HTMLHelp output --------------------------------------------- 149 | 150 | # Output file base name for HTML help builder. 151 | htmlhelp_basename = 'NFDMLabdoc' 152 | 153 | 154 | # -- Options for LaTeX output ------------------------------------------------ 155 | 156 | latex_elements = { 157 | # The paper size ('letterpaper' or 'a4paper'). 158 | # 159 | # 'papersize': 'letterpaper', 160 | 161 | # The font size ('10pt', '11pt' or '12pt'). 162 | # 163 | # 'pointsize': '10pt', 164 | 165 | # Additional stuff for the LaTeX preamble. 166 | # 167 | # 'preamble': '', 168 | 169 | # Latex figure (float) alignment 170 | # 171 | # 'figure_align': 'htbp', 172 | } 173 | 174 | # Grouping the document tree into LaTeX files. List of tuples 175 | # (source start file, target name, title, 176 | # author, documentclass [howto, manual, or own class]). 177 | latex_documents = [ 178 | (master_doc, 'NFDMLab.tex', 'NFDMLab Documentation', 179 | 'Marius Brehler , Christoph Mahnke, Shrinivas Chimmalgi and Sander Wahls', 'manual'), 180 | ] 181 | 182 | 183 | # -- Options for manual page output ------------------------------------------ 184 | 185 | # One entry per manual page. List of tuples 186 | # (source start file, name, description, authors, manual section). 187 | man_pages = [ 188 | (master_doc, 'nfdmlab', 'NFDMLab Documentation', 189 | [author], 1) 190 | ] 191 | 192 | 193 | # -- Options for Texinfo output ---------------------------------------------- 194 | 195 | # Grouping the document tree into Texinfo files. List of tuples 196 | # (source start file, target name, title, author, 197 | # dir menu entry, description, category) 198 | texinfo_documents = [ 199 | (master_doc, 'NFDMLab', 'NFDMLab Documentation', 200 | author, 'NFDMLab', 'One line description of project.', 201 | 'Miscellaneous'), 202 | ] 203 | 204 | 205 | # -- Options for Epub output ------------------------------------------------- 206 | 207 | # Bibliographic Dublin Core info. 208 | epub_title = project 209 | 210 | # The unique identifier of the text. This can be a ISBN number 211 | # or the project homepage. 212 | # 213 | # epub_identifier = '' 214 | 215 | # A unique identification for the text. 216 | # 217 | # epub_uid = '' 218 | 219 | # A list of files that should not be packed into the epub file. 220 | epub_exclude_files = ['search.html'] 221 | 222 | 223 | # -- Extension configuration ------------------------------------------------- 224 | -------------------------------------------------------------------------------- /Documentation/constellations.rst: -------------------------------------------------------------------------------- 1 | Constellations 2 | ============== 3 | 4 | .. autoclass:: Constellations.BaseConstellation 5 | :members: 6 | 7 | .. autoclass:: Constellations.MPSKConstellation 8 | :members: 9 | :special-members: 10 | 11 | .. autoclass:: Constellations.QAMConstellation 12 | :members: 13 | :special-members: 14 | 15 | .. autoclass:: Constellations.ReshapedQAMConstellation 16 | :members: 17 | :special-members: 18 | -------------------------------------------------------------------------------- /Documentation/examples.rst: -------------------------------------------------------------------------------- 1 | Examples 2 | ======== 3 | 4 | .. autoclass:: Examples.BaseExample 5 | :members: 6 | 7 | .. autoclass:: Examples.BuelowArefIdler2016 8 | :members: 9 | 10 | .. autoclass:: Examples.LeArefBuelow2017 11 | :members: 12 | 13 | .. autoclass:: Examples.GuiEtAl2018 14 | :members: 15 | -------------------------------------------------------------------------------- /Documentation/filters.rst: -------------------------------------------------------------------------------- 1 | Filters 2 | ======= 3 | 4 | .. autoclass:: Filters.BaseFilter 5 | :members: 6 | 7 | .. autoclass:: Filters.PassThrough 8 | :members: 9 | :special-members: 10 | 11 | .. autoclass:: Filters.FFTLowPass 12 | :members: 13 | :special-members: 14 | -------------------------------------------------------------------------------- /Documentation/getting_started.rst: -------------------------------------------------------------------------------- 1 | Getting Started 2 | =============== 3 | 4 | NFDMLab is organized around `Example` classes. Each example bundles the details of a fiber-optic transmission simulation. We now discuss how examples are loaded and run, how the generated data can be analyzed, and how examples can be modified. 5 | 6 | Loading Existing Examples 7 | ------------------------- 8 | 9 | Users can create a instance of an existing example class in order to perform simulations. For example: 10 | 11 | .. code-block:: python 12 | 13 | import Examples 14 | ex = Example.BuelowArefIdler2016() 15 | 16 | A list of existing examples is provided under :doc:`examples`. 17 | 18 | Running an Example 19 | ------------------ 20 | 21 | Any example class is derived from :class:`Examples.BaseExample`. Simulations can be performed using the method :func:`Examples.BaseExample.run`, which every example class inherits from BaseExample. For example: 22 | 23 | .. code-block:: python 24 | 25 | tx_data, rx_data = ex.run(5) # 5 is the number of bursts 26 | 27 | The dictionaries `tx_data` and `rx_data` contain time- and nonlinear frequency domain descriptions of the fiber inputs and fiber outputs together with the transmitted and received symbols. See the documentation of the run method for more information. 28 | 29 | Evaluating Simulation Results 30 | ----------------------------- 31 | 32 | The method :func:`Examples.BaseExample.evaluate_results` can be used for a quick analysis of the simulation results stored in `tx_data` and `rx_data`. For example: 33 | 34 | .. code-block:: python 35 | 36 | ex.evaluate_results(tx_data, rx_data) 37 | 38 | This will generate some plots and print some information about the transmission. 39 | 40 | The classes in :doc:`qualityassessment` can be used for custom analyses. For example: 41 | 42 | .. code-block:: python 43 | 44 | from QualityAssessment import BitErrorRatio 45 | ber = BitErrorRate(ex.constellation) 46 | ber_value, n_err, n_bits = ber.compute(tx_data["symbols"], rx_data["symbols"]) 47 | print("The bit error ratio is", ber_value) 48 | 49 | Changing Examples 50 | ----------------- 51 | 52 | Examples can be reconfigured by changing their public attributes and calling the reconfigure method. For example: 53 | 54 | .. code-block:: python 55 | 56 | ex.constellation = "PSK" 57 | ex.constellation_level = 8 58 | ex.reconfigure() 59 | 60 | We could now rerun the simulation as described above. The :doc:`examples` page provides information about the public attributes provided by each example class. 61 | 62 | Writing Own Examples 63 | -------------------- 64 | 65 | You can write own examples by defining a new example class that is derived from :class:`Examples.BaseExample`. Please read the documentation of BaseExample and its methods to learn what your example class should implement. 66 | -------------------------------------------------------------------------------- /Documentation/helpers.rst: -------------------------------------------------------------------------------- 1 | Helpers 2 | ======= 3 | 4 | .. automodule:: Helpers 5 | 6 | .. autoclass:: Helpers.NFSpectrum 7 | :members: 8 | :special-members: 9 | 10 | .. automodule:: Helpers.plot 11 | :members: 12 | 13 | .. automodule:: Helpers.widgets 14 | :members: 15 | -------------------------------------------------------------------------------- /Documentation/index.rst: -------------------------------------------------------------------------------- 1 | NFDMLAB: Simulating Nonlinear Frequency Division Multiplexing in Python 2 | ======================================================================= 3 | 4 | NFDMLab is an open source software environment that simulates 5 | fiber-optic data transmissions using nonlinear Fourier transforms. The goals 6 | and architecture of NFDMLab are described in the accompanying software 7 | paper: 8 | 9 | M. Brehler, C. Mahnke, S. Chimmalgi and S. Wahls, `"NFDMLab: 10 | Simulating Nonlinear Frequency Division Multiplexing in Python," 11 | `_ Optical Networking and 12 | Communication Conference & Exhibition (OFC), paper M3Z.13, Mar. 2019. 13 | 14 | First Steps 15 | ----------- 16 | 17 | To get a first impression of NFDMLab, please check out the :doc:`videos`. 18 | 19 | To get started, follow the :doc:`installation` instructions and read the :doc:`getting_started` document. Later, you might want to work through the :doc:`code_doc`. 20 | 21 | Reporting Bugs and Getting Help 22 | ------------------------------- 23 | 24 | Please use the `issue tracker `_ to report any problems with NFDMLab. Emails might be ignored. 25 | 26 | Contributing 27 | ------------ 28 | 29 | If you wrote a new example, component, fixed a bug or improved the documentation, and would like to see it included in NFDMLab, please get in touch! 30 | 31 | License 32 | ------- 33 | 34 | NFDMLab is provided under the terms of the `GNU General Public License, version 2 `_. 35 | 36 | Acknowledgements 37 | ---------------- 38 | 39 | - This project has received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement No 716669). 40 | - Fiber-topic transmissions are simulated using a slightly modified port of `SSPROP `_. 41 | - Alexander Geisler has contributed a Raman gain profile. 42 | 43 | Further reading 44 | --------------- 45 | 46 | .. toctree:: 47 | :maxdepth: 3 48 | 49 | installation 50 | getting_started 51 | code_doc 52 | videos 53 | 54 | 55 | Indices and tables 56 | ------------------ 57 | 58 | * :ref:`genindex` 59 | * :ref:`modindex` 60 | * :ref:`search` 61 | -------------------------------------------------------------------------------- /Documentation/installation.rst: -------------------------------------------------------------------------------- 1 | Installation 2 | ============ 3 | 4 | Automatic Installation under Ubuntu 18.04 5 | --------------------------------------------------- 6 | 7 | Users of `Ubuntu Linux 18.04 `_ may use an automatic installation script. 8 | 9 | Open a terminal and execute the commands 10 | 11 | .. code-block:: bash 12 | 13 | wget -nc https://github.com/FastNFT/NFDMLab/raw/master/ubuntu_1804_install.sh 14 | bash ./ubuntu_1804_install.sh 15 | source ~/.bashrc 16 | 17 | This script will install NFDMLab in the folder ``~/git/nfdmlab``. Proceed to the section :ref:`testing` below after installation. 18 | 19 | Manual Installation 20 | ------------------- 21 | 22 | NFDMLab is developed under Linux and written in `Python `_. Please make sure that a recent version of Python 3 is available on your computer. It should be possible to install NFDMLab under other operating systems, but we have no experience with such setups. Before NFDMLab can be run, the following dependencies have to be installed. 23 | 24 | 1. `Matplotlib `_, `NumPy `_ and `SciPy `_ 25 | 2. `Jupyter Notebooks `_ (optional, only for interactive examples) 26 | 3. `FNFT `_ 27 | 4. `FNFTpy `_ 28 | 29 | Please see the documentations of these packages for details on how to install them. After installation of the dependencies, download a recent `release of NFDMLab `_, extract the files into some directory and proceed to the section :ref:`testing`. 30 | 31 | .. _testing: 32 | 33 | Testing the Installation 34 | ------------------------ 35 | 36 | Once all required components are installed, change into the directory that contains NFDMLab and start Python. For example, if you used the installation script: 37 | 38 | .. code-block:: bash 39 | 40 | cd ~/git/nfdmlab 41 | python3 42 | 43 | Then, in Python, try the following: 44 | 45 | .. code-block:: python 46 | 47 | import Examples 48 | ex = Examples.BuelowArefIdler2016() 49 | [tx_data, rx_data] = ex.run(5) 50 | ex.evaluate_results(tx_data, rx_data) 51 | 52 | or load one of the files in Notebook directory in Jupyter for the interactive version: 53 | 54 | .. code-block:: bash 55 | 56 | jupyter notebook Notebooks/BuelowArefIdler2016.ipynb 57 | -------------------------------------------------------------------------------- /Documentation/links.rst: -------------------------------------------------------------------------------- 1 | Links 2 | ===== 3 | 4 | .. autoclass:: Links.BaseLink 5 | :members: 6 | 7 | .. autoclass:: Links.SMFSplitStep 8 | :members: 9 | :special-members: 10 | -------------------------------------------------------------------------------- /Documentation/modulators.rst: -------------------------------------------------------------------------------- 1 | Modulators 2 | ========== 3 | 4 | .. autoclass:: Modulators.BaseModulator 5 | :members: 6 | 7 | .. automodule:: Modulators.CarrierWaveforms 8 | :members: 9 | 10 | .. autoclass:: Modulators.ContSpecModulator 11 | :members: 12 | :special-members: 13 | 14 | .. autoclass:: Modulators.DiscSpecModulator 15 | :members: 16 | :special-members: -------------------------------------------------------------------------------- /Documentation/normalization.rst: -------------------------------------------------------------------------------- 1 | Normalization 2 | ============= 3 | 4 | .. autoclass:: Normalization.BaseNormalization 5 | :members: 6 | 7 | .. autoclass:: Normalization.Lossless 8 | :members: 9 | :special-members: 10 | 11 | .. autoclass:: Normalization.Lumped 12 | :members: 13 | :special-members: 14 | -------------------------------------------------------------------------------- /Documentation/qualityassessment.rst: -------------------------------------------------------------------------------- 1 | Quality Assessment 2 | ================== 3 | 4 | .. autoclass:: QualityAssessment.BitErrorRatio 5 | :members: 6 | 7 | .. autoclass:: QualityAssessment.ConstellationDiagram 8 | :members: 9 | 10 | .. autoclass:: QualityAssessment.ErrorVectorMagnitude 11 | :members: 12 | 13 | .. autoclass:: QualityAssessment.ModulationEfficiency 14 | :members: 15 | -------------------------------------------------------------------------------- /Documentation/videos.rst: -------------------------------------------------------------------------------- 1 | Videos 2 | ====== 3 | 4 | A Simple Demo of NFDMLab 5 | ------------------------ 6 | 7 | .. raw:: html 8 | 9 |