Skip to content

Commit

Permalink
DOC: spelling and consistency fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ggventurini committed Aug 9, 2015
1 parent 10e9e70 commit 15f8466
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 46 deletions.
10 changes: 5 additions & 5 deletions deltasigma/_logsmooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


def logsmooth(X, inBin, nbin=8, n=3):
"""Smooth the fft, and convert it to dB.
"""Smooth the FFT and convert it to dB.
**Parameters:**
Expand All @@ -43,8 +43,8 @@ def logsmooth(X, inBin, nbin=8, n=3):
Around the location of the input signal and its harmonics (up to the
third harmonic), don't average for n bins.
The logsmooth algorithm uses nbin bins from 0 to 3*inBin,
thereafter the bin sizes is increased by a factor of 1.1,
The ``logsmooth`` algorithm uses ``nbin`` bins from 0 to 3*inBin,
thereafter the bin sizes are increased by a factor 1.1,
staying less than 2^10.
For the :math:`n` sets of bins:
Expand All @@ -59,14 +59,14 @@ def logsmooth(X, inBin, nbin=8, n=3):
**Returns:**
f, p : tuple of 1d- ndarrays
f, p : tuple of 1d-arrays
The bins and smoothed FFT, expressed in dB.
.. seealso::
* :func:`plotSpectrum`, convenience function to first call
:func:`logsmooth` and then plot on a logarithmic x-axis its return
value.
values.
* :func:`circ_smooth`, smoothing algorithm suitable for linear
x-axis plotting.
Expand Down
8 changes: 4 additions & 4 deletions deltasigma/_scaleABCD.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def scaleABCD(ABCD, nlev=2, f=0, xlim=1, ymax=None, umax=None, N_sim=1e5, N0=10)
A vector or scalar specifying the limit for each state variable.
ymax : scalar, optional
The stability threshold. Inputs that yield quantizer inputs above ymax
are considered to be beyond the stable range of the modulator.
The stability threshold. Inputs that yield quantizer inputs above
``ymax`` are considered to be beyond the stable range of the modulator.
If not provided, it will be set to :math:`n_{lev} + 5`
umax : scalar, optional
Expand All @@ -68,9 +68,9 @@ def scaleABCD(ABCD, nlev=2, f=0, xlim=1, ymax=None, umax=None, N_sim=1e5, N0=10)
specified limits.
S : ndarray
The diagonal scaling matrix S.
The diagonal scaling matrix.
`S` is defined such that::
:math:`S` is defined such that::
ABCDs = [[S*A*Sinv, S*B], [C*Sinv, D]]
xs = S*x
Expand Down
4 changes: 2 additions & 2 deletions deltasigma/_simulateDSM.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
'CPython':True}

def simulateDSM(u, arg2, nlev=2, x0=0.):
"""Simulate a Delta Sigma modulator
"""Simulate a delta-sigma modulator.
Compute the output of a general delta-sigma modulator with input ``u``,
a structure described by ``ABCD``, an initial state ``x0`` (default zero) and
Expand All @@ -98,7 +98,7 @@ def simulateDSM(u, arg2, nlev=2, x0=0.):
nlev : int or sequence or ndarray
Number of levels in the quantizers. Set ``nlev`` to a scalar for a
single quantizer modulator. Multiple quantizers are implied by
making nlev an array.
making ``nlev`` an array.
x0 : float or sequence or ndarray
The initial status of the modulator. If ``x0`` is set to float, its
value will be used for all the states. If it is set to a sequence of
Expand Down
2 changes: 1 addition & 1 deletion deltasigma/_simulateQDSM.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@


def simulateQDSM(u, arg2, nlev=2, x0=None):
"""Simulate a quadrature Delta-Sigma modulator
"""Simulate a quadrature delta-sigma modulator.
This function computes the output of a quadrature delta-sigma modulator
corresponding to an input :math:`u`, with a description of the modulator, an
Expand Down
10 changes: 6 additions & 4 deletions deltasigma/_simulateSNR.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ def simulateSNR(arg1, osr, amp=None, f0=0, nlev=2, f=None, k=13,
f = \\frac{1}{4\ \mathrm{OSR}}
k : int, optional
The number of samples used to compute the FFT is set by the integer `k`
- default value 13 - through:
The number of samples used to compute the FFT is set by the integer
``k`` - default value 13 - through the relationship:
.. math::
N_{samples} = 2^k
quadrature : boolean, optional
Whether the delta sigma modulator is a quadrature modulator or not.
Whether the delta-sigma modulator is a quadrature modulator or not.
Defaults to ``False``.
**Returns:**
Expand All @@ -121,10 +121,12 @@ def simulateSNR(arg1, osr, amp=None, f0=0, nlev=2, f=None, k=13,
amp : ndarray
The amplitudes corresponding to the SNR values.
.. seealso:: :func:`predictSNR`.
.. rubric:: Example:
Compare the SNR vs input amplitude curve for a fifth-order modulator, as
determined by the describing function method (:func:`predictSNR`) with
computed by the describing function method (:func:`predictSNR`) with
that determined by simulation (:func:`simulateSNR`).::
import pylab as plt
Expand Down
53 changes: 28 additions & 25 deletions deltasigma/_synthesizeNTF.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ def synthesizeNTF(order=3, osr=64, opt=0, H_inf=1.5, f0=0.0):
**Parameters:**
order : int, optional
the order of the modulator, defaults to 3
the order of the modulator, defaults to 3.
osr : float, optional
the oversampling ratio, defaults to 64
the oversampling ratio, defaults to 64.
opt : int or list of floats, optional
flag for optimized zeros, defaults to 0
flag to select which algorithm is to be used to place the zeros,
defaults to 0.
* 0 -> not optimized,
* 1 -> optimized,
Expand All @@ -57,13 +58,14 @@ def synthesizeNTF(order=3, osr=64, opt=0, H_inf=1.5, f0=0.0):
* 4 -> same as 3, but with at least one zero at band-center
* [z] -> zero locations in complex form
H_inf : real, optional
max allowed peak value of the NTF. Defaults to 1.5
f0 : real, optional
center frequency for BP modulators, or 0 for LP modulators.
H_inf : float, optional
maximum allowed value of the absolute value of the NTF. Defaults to 1.5.
f0 : float, optional
center frequency for band-pass modulators, or 0 for low-pass modulators.
Defaults to 0.
1 corresponds to the sampling frequency, so that 0.5 is the
maximum value. Value 0 specifies an LP modulator.
The frequency is normalized throughout the ``deltasigma`` package. The
normalization is: 1 corresponds to the sampling frequency. Therefore 0.5
is the maximum value that can be assigned to ``f0``.
**Returns:**
Expand All @@ -73,35 +75,36 @@ def synthesizeNTF(order=3, osr=64, opt=0, H_inf=1.5, f0=0.0):
**Raises:**
ValueError
* 'Error. f0 must be less than 0.5' if f0 is out of range
* 'Error. ``f0`` must be less than 0.5', if ``f0`` is out of range.
* 'Order must be even for a bandpass modulator.' if the order is
incompatible with the modulator type.
odd and therefore incompatible with the modulator type.
* 'The opt vector must be of length xxx' if opt is used to explicitly
pass the NTF zeros and these are in the wrong number.
* 'The ``opt`` vector must be of length xxx' if ``opt`` is used to
explicitly pass the NTF zeros and these are in the wrong number.
**Warns:**
* 'Creating a lowpass ntf.' if the center frequency is different
from zero, but so low that a low pass modulator must be designed.
* 'Creating a low-pass NTF.', if the center frequency is different
from zero, but so close to 0 that a low-pass modulator must be
designed.
* 'Unable to achieve specified H_inf ...' if the desired H_inf
* 'Unable to achieve specified ``H_inf`` ...', if the desired ``H_inf``
cannot be achieved.
* 'Iteration limit exceeded' if the routine converges too slowly.
* 'Iteration limit exceeded', if the routine converges too slowly.
**Notes:**
This is actually a wrapper function which calls the appropriate version
of synthesizeNTF, based on the module control flag `optimize_NTF` which
This is actually a wrapper function which calls the appropriate version of
``synthesizeNTF``, based on the module control flag ``optimize_NTF`` which
determines whether to use optimization tools.
Parameter ``H_inf`` is used to enforce the Lee stability criterion.
The parameter ``H_inf`` is used to enforce the Lee stability criterion.
**Example:**
Fifth-order lowpass modulator; zeros optimized for an oversampling ratio of 32.::
Fifth-order low-pass modulator; zeros optimized for an oversampling ratio of 32.::
from deltasigma import *
H = synthesizeNTF(5, 32, 1)
Expand All @@ -122,12 +125,12 @@ def synthesizeNTF(order=3, osr=64, opt=0, H_inf=1.5, f0=0.0):
.. seealso::
:func:`clans` : Closed-Loop Analysis of Noise-Shaper.
An alternative method for selecting NTFs based on the 1-norm of the
impulse response of the NTF
An alternative method for selecting NTFs based on the 1-norm of the
impulse response of the NTF.
:func:`synthesizeChebyshevNTF()` : Select a type-2 highpass Chebyshev NTF.
This function does a better job than synthesizeNTF if osr
or H_inf is low.
This function does a better job than :func:`synthesizeNTF` if ``osr``
or ``H_inf`` is low.
"""
if f0 > 0.5:
Expand Down
2 changes: 1 addition & 1 deletion deltasigma/_synthesizeQNTF.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def synthesizeQNTF(order=4, OSR=64, f0=0., NG=-60, ING=-20, n_im=None):
.. note::
From the Matlab Delta-Sigma Toobox:
From the MATLAB Delta-Sigma Toolbox:
ALPHA VERSION:
This function uses an experimental ad-hoc method that is
neither optimal nor robust.
Expand Down
2 changes: 1 addition & 1 deletion deltasigma/_undbm.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def undbm(p, z=50):
**Returns:**
Vrms : scalar or sequence
The RMS voltage corresponding to p
The RMS voltage corresponding to ``p``.
.. seealso:: :func:`undbp`, :func:`undbv`, :func:`dbm`, :func:`db`
Expand Down
2 changes: 1 addition & 1 deletion deltasigma/_undbp.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def undbp(x):
**Returns:**
Prms : scalar or sequence
The RMS power corresponding to x.
The RMS power corresponding to ``x``.
.. seealso:: :func:`undbm`, :func:`undbv`, :func:`dbp`, :func:`db`
Expand Down
2 changes: 1 addition & 1 deletion deltasigma/_undbv.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def undbv(x):
**Returns:**
Vrms : scalar or sequence
The RMS voltage corresponding to x.
The RMS voltage corresponding to ``x``.
.. seealso:: :func:`undbm`, :func:`undbp`, :func:`dbv`, :func:`db`
Expand Down
2 changes: 1 addition & 1 deletion deltasigma/_zinc.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def zinc(f, m=64, n=1):
**Parameters:**
f : ndarray
The frequencies f at which the magnitude response is evaluated.
The frequencies at which the magnitude response is evaluated.
m : int, optional
The order of the comb filters.
Expand Down

0 comments on commit 15f8466

Please sign in to comment.