Giter Site home page Giter Site logo

rowg / spectra_tools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oceanhackweek/ohw21-proj-radar-qc

0.0 1.0 0.0 5.78 MB

Tools to load SeaSonde spectra and test different filtering algorithms to remove interference

License: MIT License

Python 100.00%

spectra_tools's Introduction

radarqc

Python package for loading and processing HF radar spectra in Cross-Spectrum file format. See file specification here.

Python Package

This repository provides a python package with utilities for:

  • Loading Cross-Spectrum files as Python objects containing headers and antenna spectra.
  • Serializing Python object representation as Cross-Spectrum files.
  • Preprocessing antenna spectra to calculate gain and deal with outliers.
  • Filter spectra to reduce the effects of background noise on wave velocity calculation.

Installation

From within the repository:

pip3 install radarqc

Example Usage

The radar used to generate cross-spectrum data can sometimes detect outliers. This is indicated by negative signal values in the data. This example loads a file using the Abs method to ignore the outliers, computes the relative gain, then writes the result back into a file.

from radarqc import csfile
from radarqc.processing import Abs, CompositeProcessor, GainCalculator

def example():
    reference_dbm = 34.2
    path = "example.cs"
    preprocess = CompositeProcessor(
        Abs(), GainCalculator(reference=reference_dbm)
    )
    
    # Read binary file into 'CSFile' object.
    # Spectrum data will be processed to compute gain.
    with open(path, "rb") as f:
        cs = csfile.load(f, preprocess)
    
    # Write processed file back into original format on disk.
    with open(path, "wb") as f:
        csfile.dump(cs, f)

The loaded CSFile object can be used to access file metadata via the header attribute, as well as various attributes for accessing data from individual antenna and cross-antenna spectra with a numpy.ndarray data type.

spectra_tools's People

Contributors

jstanco avatar

Watchers

 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.