Giter Club home page Giter Club logo

rsdeltasigmaport.jl's Introduction

RSDeltaSigmaPort.jl: Port of Richard Schreier's Delta Sigma Toolbox¹

Galleries: 🎨 Sample notebooks (w/outputs)

¹Richard Schreier (2021). Delta Sigma Toolbox (https://www.mathworks.com/matlabcentral/fileexchange/19-delta-sigma-toolbox), MATLAB Central File Exchange. Retrieved March 20, 2021.

Build Status

⚠️ Progress report

INTERMEDIATE STAGE OF PORT: A significant portion of the Delta Sigma toolbox has been ported.

The following high-level functionnality has (at least partially) been ported:

  • simulateDSM, simulateMS, simulateSNR, simulateHBF
  • synthesizeNTF, realizeNTF, realizeNTF_ct
  • calculateSNR, peakSNR, predictSNR
  • calculateTF, evalTF, evalTFP
  • stuffABCD, scaleABCD, mapABCD, partitionABCD
  • mapCtoD, mapQtoR
  • exampleHBF
  • pulse, impL1
  • lollipop, logsmooth
  • documentNTF, plotExampleSpectrum

And demos:

  • dsdemo1, ..., dsdemo6, dsexample1, dsexample2, demoLPandBP

Table of contents

  1. Description
  2. Sample usage
    1. IJupyter notebooks (notebook/)
    2. IJupyter notebooks (with output) ↪
    3. Sample directory w/plain .jl files (sample/)
  3. Plotting
  4. Installation
  5. Running sample scripts
  6. Function (API) help
  7. Julia tips
    1. Useful functions
    2. linspace() & logspace()
  8. Known limitations
    1. TODO

Description

As its name suggests, RSDeltaSigmaPort.jl is a Julia port of Richard Schreier's Delta Sigma Toolbox.

Module name

Note that this module is not named something like DeltaSigmaModulators.jl, thus allowing someone else to appropriate the package name later on. Hopefully, RSDeltaSigmaPort will eventually be superseded by a more generically named package that is better integrated with Julia's ecosystem than this simple port.

Design decisions

This module tries to remain true to the original Delta Sigma Toolbox while conforming to some Julia patterns, including:

  • Multiple dispatch (make function calls simpler to write).
  • Not writing each function definition in its own, separate file.
  • Using keyword arguments when deemed appropriate.
  • Returning NamedTuples instead of simple arrays when multiple values are returned.
  • ...

Progressively replacing modulator parameters in function calls with RealDSM and QuadratureDSM objects:

  • Simplifies function interface for user.
  • Centralizes defaults for parameter values on construction of RealDSM and QuadratureDSM.
  • Looking to keep "original" function interface (with individual modulator parameters) available for accustomed users.
  • Looking to remove default values from said interface to avoid unexpected bugs from inconsistent defaults.
  • Might change with time (not sure if certain parameters, like opt, should migrate to a NTF structure or something).

Plotting

RSDeltaSigmaPort.jl uses CMDimData.jl/EasyPlot to handle plotting. For examples on how to generate new/customized plots, see the built-in functions found in plot_*.jl files in the source directory:

Installation

The RSDeltaSigmaPort.jl toolbox is written using the Julia programming language. Unless you already have Julia installed, you will need to first install the base language. Simply download & install the most recent version of Julia from Julia's official "downloads" page.

Julia's official "downloads" page:

Step 2 is to install the RSDeltaSigmaPort.jl package itself. Since RSDeltaSigmaPort.jl is registered with Julia's General registry, you can automatically download & install it from Julia's built-in package manager. Simply launch Julia, and run the following from the command prompt:

julia> ]
pkg> add RSDeltaSigmaPort

Running sample scripts

Sample scripts in the sample/ subdirectory can be run using include().

For convenience, the @runsample macro automatically locates the script path and executes include() for you:

julia> using RSDeltaSigmaPort #Will take a while to load, compile, etc...
julia> import RSDeltaSigmaPort: @runsample

julia> @runsample("dsdemo1.jl")
julia> @runsample("dsdemo2.jl")
julia> @runsample("dsdemo3.jl")
julia> @runsample("dsdemo4_audio.jl")
julia> @runsample("dsdemo5.jl")
julia> @runsample("dsdemo6.jl")
julia> @runsample("dsexample1.jl")
julia> @runsample("dsexample2.jl")
julia> @runsample("demoLPandBP.jl")

Function (API) help

Typing ?RSDeltaSigmaPort in Julia's command line gives you a list of available functions:

julia> ?
help?> RSDeltaSigmaPort

Information on individual functions can be obtained in a similar fashion. Example:

julia> ?
help?> simulateDSM

Original documentation

Richard Schreier's original documentation is available here:

Known limitations

Functions that are not supported:

  • printmif()

Compatibility

Extensive compatibility testing of RSDeltaSigmaPort.jl has not been performed. The module has been tested using the following environment(s):

  • Linux / Julia-1.6.0

⚠️ Disclaimer

  • INTERMEDIATE STAGE OF PORT: A significant portion of the Delta Sigma toolbox has been ported.
  • Jupyter notebooks might be slightly broken/out of date. If so, see their counterparts in the sample/ directory for a more regularly maintained example.
  • The RSDeltaSigmaPort.jl module is not yet mature. Expect significant changes.

rsdeltasigmaport.jl's People

Contributors

ma-laforge avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

chappie19

rsdeltasigmaport.jl's Issues

`array_round()`

Much of the initial code would implicitly round array indices (or similar Int-only values) in from floating point representations.

@ma-laforge was not 100% sure what happened in the original execution, so the rounding was wrapped into a call to
array_round(i) = round(Int, i). It is not certain if this function correctly reproduces the original behaviour.

Either way, these calls should be replaced with explicit rounding functions, for example:

  • x[1:div(n,2)] instead of x[1:(n/2)] - Well, unless the original code expected rounding up.
  • x[1:round(Int, float_idx)]
  • x[1:floor(Int, float_idx)]
  • x[1:ceil(Int, float_idx)]

Unfortunately, the original author's intent for rounding is not always easy to decipher.

Floating-point order

There were other cases where order was passed around as a floating point value (potentially having a 0.5 fractional value after dividing by 2).

Goal

The original intent should be resolved so that floating point representations are eliminated. As a side benefit, this should also reduce accidental errors introduced when modifying code in the future.

Does `mapCtoD()` need a delay?

The original mapCtoD() code called set(sys_c,'InputDelay',0) - depending on the software version.

This needs to be investigated.

Installation issue in JULIA v1.4.2

Unable to install this toolbox. It says
"Unsatisfiable requirements detected for package RSDeltaSigmaPort [82f5f448]".

The entire Stack trace is given below:

`julia> using Pkg

julia> Pkg.add("RSDeltaSigmaPort")
Updating registry at C:\Users\name\.julia\registries\General
Updating git-repo https://github.com/JuliaRegistries/General.git
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package RSDeltaSigmaPort [82f5f448]:
RSDeltaSigmaPort [82f5f448] log:
├─possible versions are: [0.1.0, 0.2.0, 0.3.0, 0.4.0-0.4.1] or uninstalled
├─restricted to versions * by an explicit requirement, leaving only versions [0.1.0, 0.2.0, 0.3.0, 0.4.0-0.4.1]
└─restricted by julia compatibility requirements to versions: uninstalled — no versions left
Stacktrace:
[1] propagate_constraints!(::Pkg.Resolve.Graph, ::Set{Int64}; log_events::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Resolve\graphtype.jl:1010
[2] propagate_constraints! at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Resolve\graphtype.jl:951 [inlined] (repeats 2 times)
[3] simplify_graph!(::Pkg.Resolve.Graph, ::Set{Int64}; clean_graph::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Resolve\graphtype.jl:1465
[4] simplify_graph! at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Resolve\graphtype.jl:1465 [inlined] (repeats 2 times)
[5] resolve_versions!(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Operations.jl:348
[6] targeted_resolve(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}, ::Pkg.Types.PreserveLevel) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Operations.jl:1064
[7] tiered_resolve(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Operations.jl:1050
[8] _resolve at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Operations.jl:1070 [inlined]
[9] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}, ::Array{Base.UUID,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Windows) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\Operations.jl:1085
[10] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Windows, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:159
[11] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:112
[12] #add#27 at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:109 [inlined]
[13] add at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:109 [inlined]
[14] #add#24 at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:107 [inlined]
[15] add at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:107 [inlined]
[16] add(::String; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:106
[17] add(::String) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Pkg\src\API.jl:106
[18] top-level scope at REPL[4]:1

May I know the workaround for this please ?

Bug with `calculateTF`

I couldn't quite figure out what gets returned by minreal() in the original calculateTF.m file or how it gets split into STF and NTF.

In addition to this, ControlSystems.jl's implementation of ss->tf->minreal() generates an error:
-->see: JuliaControl/ControlSystems.jl#479

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.