LTspice.jl: Julia interface to LTspice

LTspice.jl

LTspice.jl provides a julia interface to LTspiceTM. Several interfaces are provided.

  1. A dictionary like interface to access parameters and measurements by name.
  2. An array interface, which is primarily for measurements of stepped simulations.
  3. Simulations can be called like functions.

Installation

LTspice.jl is currently unregistered. It can be installed using Pkg.clone.

Pkg.clone("https://github.com/cstook/LTspice.jl.git")

The julia documentation section on installing unregistered packages provides more information.

LTspice.jl is compatible with julia 1.0

Example 1

Import the module.

using LTspice

Create an instance of LTspiceSimulation.

example1 = LTspiceSimulation("example1.asc",tempdir=true)

Access parameters and measurements using their name as the key.

Set a parameter to a new value.

example1["Rload"] = 20.0  # set parameter Rload to 20.0

Read the resulting measurement.

loadpower = example1["Pload"] # run simulation, return Pload

Circuit can be called like a function

loadpower = example1(100.0)  # pass Rload, return Pload

Use Optim.jl to perform an optimization on a LTspice simulation

using Optim
result = optimize(rload -> -example1(rload)[1],10.0,100.0)
rload_for_maximum_power = example1["Rload"]

Supported Platforms

LTspice.jl works on windows and linux with LTspice under wine. Osx is not supported.

Download Details:

Author: cstook
Source Code: https://github.com/cstook/LTspice.jl 
License: View license

#julia #interface 

What is GEEK

Buddha Community

LTspice.jl: Julia interface to LTspice

LTspice.jl: Julia interface to LTspice

LTspice.jl

LTspice.jl provides a julia interface to LTspiceTM. Several interfaces are provided.

  1. A dictionary like interface to access parameters and measurements by name.
  2. An array interface, which is primarily for measurements of stepped simulations.
  3. Simulations can be called like functions.

Installation

LTspice.jl is currently unregistered. It can be installed using Pkg.clone.

Pkg.clone("https://github.com/cstook/LTspice.jl.git")

The julia documentation section on installing unregistered packages provides more information.

LTspice.jl is compatible with julia 1.0

Example 1

Import the module.

using LTspice

Create an instance of LTspiceSimulation.

example1 = LTspiceSimulation("example1.asc",tempdir=true)

Access parameters and measurements using their name as the key.

Set a parameter to a new value.

example1["Rload"] = 20.0  # set parameter Rload to 20.0

Read the resulting measurement.

loadpower = example1["Pload"] # run simulation, return Pload

Circuit can be called like a function

loadpower = example1(100.0)  # pass Rload, return Pload

Use Optim.jl to perform an optimization on a LTspice simulation

using Optim
result = optimize(rload -> -example1(rload)[1],10.0,100.0)
rload_for_maximum_power = example1["Rload"]

Supported Platforms

LTspice.jl works on windows and linux with LTspice under wine. Osx is not supported.

Download Details:

Author: cstook
Source Code: https://github.com/cstook/LTspice.jl 
License: View license

#julia #interface 

LibSndFile.jl: Julia interface to Libsndfile

LibSndFile.jl

LibSndFile.jl is a wrapper for libsndfile, and supports a wide variety of file and sample formats. The package uses the FileIO load and save interface to automatically figure out the file type of the file to be opened, and the file contents are represented as a SampleBuf. For streaming I/O we support FileIO's loadstreaming and savestreaming functions as well. The results are represented as SampleSource (for reading), or SampleSink (for writing) subtypes. These buffer and stream types are defined in the SampledSignals package.

Note that the load/save/etc. interface is exported from FileIO, and LibSndFile registers itself when the loaded, so you should bring in both packages. LibSndFile doesn't export any of its own names.

julia> using FileIO: load, save, loadstreaming, savestreaming
julia> import LibSndFile
julia> load("audiofile.wav")
2938384-frame, 1-channel SampleBuf{FixedPointNumbers.Fixed{Int16,15}, 2}
66.63002267573697s sampled at 44100.0Hz
▆▅▆▆▆▆▆▅▆▆▆▇▇▇▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▇▆▆▆▆▆▇▆▇▆▇▆▆▆▅▆▆▆▆▆▆▅▆▆▅▆▅▆▆▇▇▇▇▆▆▆▆▆▆▇▆▆▆▆▆▆▆▇▆▇▂

Examples

Read ogg file, write first 1024 samples of the first channel to new wav file

x = load("myfile.ogg")
save("myfile_short.wav", x[1:1024])

Read file, write the first second of all channels to a new file

x = load("myfile.ogg")
save("myfile_short.wav", x[0s..1s, :])

Read stereo file, write mono mix

x = load("myfile.wav")
save("myfile_mono.wav", x[:, 1] + x[:, 2])

Plot the left channel

x = load("myfile.wav")
plot(x[:, 1]) # plots with samples on the x axis
plot(domain(x), x[:, 1]) # plots with time on the x axis

Plot the spectrum of the left channel

x = load("myfile.wav")
f = fft(x) # returns a FrequencySampleBuf
fmin = 0Hz
fmax = 10000Hz
fs = Float32[float(f_i) for f_i in domain(f[fmin..fmax])]
plot(fs, abs.(f[fmin..fmax]).data, xlim=(fs[1],fs[end]), ylim=(0,20000))

Load a long file as a stream and plot the left channel from 2s to 3s

stream = loadstreaming("myfile.ogg")
x = read(stream, 4s)[2s..3s, 1]
close(stream)
plot(domain(x), x)

To handle closing the file automatically (including in the case of unexpected exceptions), we support the do block syntax

data = loadstreaming("data/never_gonna_give_you_up.ogg") do f
    read(f)
end

Supported Formats

See the libsndfile homepage for details, but in summary it supports reading and writing:

  • Microsoft WAV
  • Ogg/Vorbis
  • FLAC
  • SGI / Apple AIFF / AIFC
  • RAW
  • Sound Designer II SD2
  • Sun / DEC / NeXT AU / SND
  • Paris Audio File (PAF)
  • Commodore Amiga IFF / SVX
  • Sphere Nist WAV
  • IRCAM SF
  • Creative VOC
  • Soundforge W64
  • GNU Octave 2.0 MAT4
  • GNU Octave 2.1 MAT5
  • Portable Voice Format PVF
  • Fasttracker 2 XI
  • HMM Tool Kit HTK
  • Apple CAF

Note not all file formats support all samplerates and bit depths. Currently LibSndFile.jl supports WAV, Ogg Vorbis, and FLAC files. Please file an issue if support for other formats would be useful.

Related Packages

  • SampledSignals.jl provides the basic stream and buffer types used by this package.
  • MP3.jl supports reading and writing MP3 files
  • WAV.jl is a pure-julia package supporting the WAV file format.
  • Opus.jl wraps libopus and allows you to read and write Opus audio.
  • PortAudio.jl can be used to interface with your sound card to record and play audio.

A Note on Licensing

libsndfile is licensed under the LGPL, which is very permissive providing that libsndfile is dynamically linked. LibSndFile.jl is licensed under the MIT license, allowing you to statically compile the wrapper into your Julia application. Remember that you must still abide by the terms of the libsndfile license when using this wrapper, in terms of whether libsndfile is statically or dynamically linked.

Note that this is to the best of my understanding, but I am not an attorney and this should not be considered legal advice.

Download Details:

Author: JuliaAudio
Source Code: https://github.com/JuliaAudio/LibSndFile.jl 
License: MIT license

#julia #audio #interface 

Monty  Boehm

Monty Boehm

1659641700

Tables.jl: An interface for Tables In Julia

Tables.jl

The Tables.jl package provides simple, yet powerful interface functions for working with all kinds tabular data.

Installation: at the Julia REPL, import Pkg; Pkg.add("Tables")

Maintenance: Tables is maintained collectively by the JuliaData collaborators. Responsiveness to pull requests and issues can vary, depending on the availability of key collaborators.

Documentation

List of packages which support Tables.jl interface can be found in INTEGRATIONS.md.

Additional Resources

Please refer to TableOperations.jl for common table operations (select, filter, transform, map, etc.)

Author: JuliaData
Source Code: https://github.com/JuliaData/Tables.jl 
License: MIT license

#julia #data #interfaces #table 

OCCA.jl: Julia interface Into OCCA

OCCA.jl

OCCA is a cross platform single-instruction-multiple-data (SIMD) threading library that is retargetable to multiple backends such as pthreads, openmp, opencl, and cuda. OCCA.jl is a Julia interface into OCCA. The main OCCA repository can be found here.

Installation and testing.

Pkg.add("OCCA");
#This takes a minute because no precompiled OCCA binaries exist.
#OCCA will build with no parallel backends by default because 
#reliable backend detection is under development.
#To rebuild with e.g. opencl and cuda you would run
using OCCA;
OCCA.rebuildwith!(opencl=true,cuda=true);

#To run tests for all compiled backends, run:
Pkg.test("OCCA");

#If a backend is not compiled, that test will simply pass without doing anything.
#OCCA will default to serial mode if no backend is installed, so the tests
#still provide some information about correctness of the test kernels (ignoring
#parallel issues such as race conditions and deadlocks)

An example script.

addVectors.okl

kernel void addVectors(const int entries,
                       const float *a,
                       const float *b,
                       float *ab){
  for(int group = 0; group < ((entries + 15) / 16); ++group; outer0){
    for(int item = 0; item < 16; ++item; inner0){
      const int N = (item + (16 * group));

      if(N < entries)
        ab[N] = a[N] + b[N];
    }
  }
}

advectors.jl


    
    infostring   = "mode = OpenMP  , schedule = compact, chunk = 10";

    entries = 5

    device = OCCA.Device(infostring);

    a  = Float32[1 - i for i in 1:entries]
    b  = Float32[i     for i in 1:entries]
    ab = Array(Float32,(length(a),));

    correctvals = [1.0 for i in 1:entries];

    o_a  = OCCA.malloc(device, a);
    o_b  = OCCA.malloc(device, b);
    o_ab = OCCA.malloc(device, ab);

    addvectors = OCCA.buildkernel(device,"addVectors.okl","addVectors")

    OCCA.runkernel!(addvectors,entries,o_a,o_b,o_ab)

    OCCA.memcpy!(ab, o_ab)



Known issues

-The build script does not work for Windows, this is under development. -If OCCA kernel file uses shared memory and you target OpenCL+CPU, it will crash. This appears to be an OpenCL problem and not an OCCA problem.

Contributing

Contributing code Fork this repository on Github, make desired changes, and submit pull request.

Helping with tests and builds It would be enormously helpful if issues could be opened with any build or test failures, along with the specs of the machines on which the builds or tests failed.

Editor Issues .OKL files have a nearly-C grammar, and so most syntax highlighting modules designed for vanilla C will also do a decent job highlighting .OKL files.

Download Details:

Author: ReidAtcheson
Source Code: https://github.com/ReidAtcheson/OCCA.jl 
License: MIT license

#julia #interface 

ZMQ.jl: Julia interface to ZMQ

ZMQ.jl

A Julia interface to ZeroMQ

ZMQ.jl is a Julia interface to ZeroMQ, The Intelligent Transport Layer.

Installation

The package can be installed with the Julia package manager. From the Julia REPL, type ] to enter the Pkg REPL mode and run:

pkg> add ZMQ

Or, equivalently, via the Pkg API:

julia> import Pkg; Pkg.add("ZMQ")

(This installs its own copy of the ZMQ libraries from the ZMQBuilder repository.)

Documentation

  • STABLEdocumentation of the most recently tagged version.
  • DEVELdocumentation of the in-development version.

Troubleshooting

If you are using Windows and get an error Provider PackageManager failed to satisfy dependency zmq, you may need to restart Julia and run Pkg.build("ZMQ") again. See issue 69 for more details.

Questions and Contributions

Usage questions can be posted on the Julia Discourse forum under the zmq tag, in the #zmq channel of the Julia Slack and/or in the JuliaDocs Gitter chat room.

Contributions are very welcome, as are feature requests and suggestions. Please open an issue if you encounter any problems. The contributing page has a few guidelines that should be followed when opening pull requests and contributing code.

Download Details:

Author: JuliaInterop
Source Code: https://github.com/JuliaInterop/ZMQ.jl 
License: View license

#julia #interface