Skip to content

Latest commit

 

History

History
100 lines (59 loc) · 4.01 KB

README.md

File metadata and controls

100 lines (59 loc) · 4.01 KB

VSM Analyser

A quick and portable way to analyze VSM data

This Python script creates a graphical user interface (GUI) using the Tkinter library. The GUI allows the user to select a text file containing magnetic data from a Vibrating Sample Magnetometer (VSM) measurement. The script reads the data, converts the units to SI units, calculates key magnetic parameters (saturation moment, coercivity, remanence, magnetic moment, anisotropy constants, and differential magnetic susceptibility), and then displays the key parameters on both a plot and a text label in the GUI.

Features: 🌟

  • Open VSM measurement data in .txt format

  • Convert units to SI units

  • Calculate key parameters such as:

    • Saturation moment
    • Coercivity
    • Remanence
    • Magnetic moment
    • Anisotropy constants
    • Differential magnetic susceptibility
  • Fit the data to a model to extract anisotropy constants

  • Plot the data and key parameters

  • Save analysis parameters for later use

  • Portable, no installation required


Installation 🖥

Download main python file

To run the script, you need to install the following Python packages:

pip install numpy
pip install matplotlib
pip install scipy
pip install tk

Windows Download ⬇

Latest stable release

Releases and prereleases contain links to standalone packages (and installers for full releases) for Windows.

Your computer must be running Windows 10 or newer.


Working ⚙

The script uses NumPy and SciPy libraries for numerical operations and curve fitting, and the Matplotlib library for plotting. The GUI contains a single button that, when clicked, opens a file dialogue to select a text file containing magnetic data. Once the user selects a file, the script reads the data, calculates the key parameters, and displays them on the plot and a text label in the GUI.

image


The key parameters displayed in the text label include the saturation moment, coercivity, remanence, magnetic moment, anisotropy constants, and differential magnetic susceptibility. The plot shows the magnetic moment as a function of the magnetic field and also displays the saturation moment, coercivity, and remanence as horizontal and vertical lines.

The code is organized into several functions, each performing a specific task:

  • read_raw_data(file_path) - Reads the raw VSM data from the file and converts the units to SI units.
  • calculate_saturation_moment(moment) - Calculates the saturation moment.
  • calculate_coercivity(field, moment) - Calculates the coercivity.
  • calculate_remanence(moment) - Calculates the remanence.
  • calculate_magnetic_moment(field, moment) - Calculates the magnetic moment using numerical integration.
  • fit_anisotropy_constants(field, moment) - Fits the data to an anisotropy model to extract anisotropy constants.
  • calculate_differential_susceptibility(moment, field) - Calculates the differential magnetic susceptibility.
  • plot_data(field, moment, saturation_moment, coercivity, remanence) - Plots the magnetic moment as a function of the magnetic field and marks key parameters.
  • display_parameters(saturation_moment, coercivity, remanence, magnetic_moment, k1, k2, susceptibility) - Displays the calculated parameters in the Tkinter window.

VSM Analyser provides a simple but powerful tool for analyzing magnetic data from a VSM measurement.


VSM Data File Example

Descriptive text

License 📃

Licensed under the CC0-1.0 License.

© 2024 Abhijeet Kumar. All rights reserved.