GithubHelp home page GithubHelp logo

tutelectromechanics / denoise-py Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 23 KB

Preprocessor to denoise galfenol data

License: BSD 2-Clause "Simplified" License

Python 100.00%
python python3 python34 preprocessing measurements magnetostriction

denoise-py's Introduction

Denoise-py

Preprocessor to denoise measured field strength H, flux density B, magnetic polarization J = B - µ0 H, and magnetostriction λ for galfenol data.

This is needed especially for the magnetostriction, for which the raw data can be very noisy.

Howto

With the MATLAB .mat data files in the current directory, run python3 main.py in the terminal.

Note that currently only the code is hosted here - you will need to obtain the data files separately.

Several files can be processed as a batch. For input file foo.mat, the output is foo_denoised.mat.

The individual filters, such as filter_magnetostriction.py, also have their own command-line interfaces. When run individually, they will display the filter result, along with a plot of the power spectral density that can be used to judge the quality of both the input and the output.

singlevaluize.py is meant as the next preprocessing step, to generate a reasonable single-valued BH curve (collapsing the hysteresis loop), but at the moment this does not work properly for the data it is meant for. Currently this part is done in MATLAB.

Converting the data

Load the original raw data into Origin Viewer. The first four columns must be (H, B, J, λ), in that order.

Then: Select all, Edit ⊳ Copy full precision, paste into a text editor. Search-and-replace all , by ., to have a decimal separator that Python natively understands. Save.

This produces a suitably formatted text file that can be converted to be read by the filters. convert_txt_to_mat.py is a small standalone utility that performs the conversion.

For interoperability with MATLAB, the file format used by the filters is a MATLAB .mat file, containing the data in a 2D array called A, with the columns in the same order as in the original data.

The filters only use the first four columns; any excess columns are discarded by the filters.

Text file format

convert_txt_to_mat.py expects a text file containing numbers. Columns must be separated by tabs (exactly one real tab, U+0009; not just any whitespace), and rows by newlines. Example:

17.0    -1.0    42.0    23.0
3.14    2.718    299792458.0    7.777

where the whitespace on each line represents a single tab character between each pair of columns.

The row index is simply the index of the sample in the discrete time signal.

In the output, any missing data (indicated by two or more consecutive tab characters) will be replaced by NaN.

Dependencies

License

BSD

denoise-py's People

Contributors

technologicat avatar

Watchers

 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.