Code Monkey home page Code Monkey logo

sonar's Introduction

sonar

An exercise environment to experiment with acoustic arrays using sonar as an example.

Installation

As the environment consists of a single Python class, no installation of sonar is required. Placing sonar.py in the working directory should suffice. A Python interpreter is, however, required. We recommend using Anaconda. The field simulations are implemented using the Python package pyfds, which can be installed using pip (comes with Anaconda) by the following command:

pip install pyfds

Usage

Here is a minimal working example (to be placed in the same directory as sonar.py):

from sonar import Shallows

if __name__ == '__main__':

    field = Shallows(scenario='2020')
    result = field.ping(
        positions=[0, 1],
        delays=[0, 0.1e-3],
        show=True
    )

The first line imports the class Shallows from the sonar module (the Python file sonar.py). The following statement (placement in if __name__ == '__main__':) is necessary for the animation of the field simulation to work. Next up, an object of the type Shallows called field is created, using the scenario for 2020. The last statement allows you to send a number of pings (acoustic impulses) at given positions and with delays. Note that all delays should be positive. The example sends pings at 0 m (center of the field) and 1 m with the first ping having no delay and the second one being delayed by 0.1 ms. The display of the field simulation can be disabled by setting show=False.

2020 scenario

This scenario constitutes a classic echolocation example and can be used to experiment with sonar imaging algorithms. Note that not all excitation positions are valid, as the field is spatially quantized with an increment of 0.05 m. After the simulation is finished, the return value of ping contains a list of echo signals recorded at the positions the pings where send at. The transmitted signals are also present in these signals.

2021 scenario

This scenario simulates medical ultrasound applications, e.g. lithotripsy. A small, high-density object is placed at a randomized position in the field. The field is spatially quantized with an increment of 0.5 mm, so excitation positions need to adhere to this quantization. The return value of ping is a tuple that contains the signal at the center of the high-density object and a list of echo signals recorded at the positions the pings where send at.

2024 scenario

This scenario simulates echo ranging disturbed by a step on the floor of the simulation regime. The aim is to test different transducers apertures for robustness to the interfering signals reflected by the step. The transducer's aperture is defined indirectly by the size in two dimensions. Note that in this case the class Step has to be used. The size of the step and the distance from the acoustic axis of the transducer can be set when crating the Step object. The size of the transducer is specified with the ping method, which returns the signal transmitted and received by the transducer, e.g.:

from sonar import Step

if __name__ == '__main__':

    field = Step('2024', height=10, distance=10)
    signal = field.ping(size=0.5, show=True)

sonar's People

Contributors

lndr avatar

Stargazers

eren okur avatar Henry Hamon avatar Dave Greenwood avatar  avatar

Watchers

James Cloos avatar Manuel Webersen avatar  avatar

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.