Skip to content

Here we present an approach that uses Fourier domain analysis to measure the degree to which high-frequency components are retained

Notifications You must be signed in to change notification settings

pradosh-dash/Fourier_Domain_Metric

Repository files navigation

Acoustic Hologram Analysis

This package provides tools for analyzing acoustic hologram optimization results, with a focus on quantifying high-frequency detail preservation.

Overview

When optimizing acoustic holograms using phased arrays, it's important to evaluate how well the algorithm preserves high-frequency details in the target pattern. This package provides metrics and visualization tools specifically designed for this purpose.

Files

  • frequency_analysis.py - Core functions for frequency domain analysis
  • analyze_results.py - Functions to load and analyze result files
  • run_analysis.py - Simple command-line interface for running analysis

Installation

  1. Clone or download this repository
  2. Install required dependencies:
pip install numpy scipy matplotlib h5py

Usage

Analyzing Results Directory

To analyze all results in a directory:

python run_analysis.py /path/to/results/folder

This will:

  1. Find all result files (.mat or .npy) in the specified directory
  2. Load and analyze each file
  3. Generate frequency analysis plots
  4. Calculate metrics and scores
  5. Create a comparison report if multiple results are found

Analyzing a Single Result File

To analyze a specific result file:

python run_analysis.py /path/to/results/folder --single_file phased_array_hologram_20250413-123456.mat

Metrics Explained

The analysis calculates several metrics to quantify high-frequency detail preservation:

Frequency Band Analysis

The frequency spectrum is divided into three bands:

  • Low frequencies: 0-20% of maximum frequency
  • Mid frequencies: 20-60% of maximum frequency
  • High frequencies: 60-100% of maximum frequency

Key Metrics

  • High Frequency Retention: How much of the high-frequency power from the target is preserved in the achieved image
  • High Frequency Detail Preservation: Compares the high-to-low frequency ratios between target and achieved images
  • High Frequency Weighted Retention: Weighted sum that emphasizes higher frequencies
  • Spectral Norm Ratio: Another perspective on high-frequency content preservation
  • Hologram Detail Score: Composite score combining multiple metrics (0-1 scale, higher is better)

Visualization

The analysis generates several visualization plots:

  1. Spectrum Visualization: Shows the original images and their frequency spectrums
  2. Power Distribution: Shows how power is distributed across frequency bands
  3. Retention Ratio: Shows how well each frequency band is preserved
  4. Comparison Report: When analyzing multiple results, creates a bar chart for easy comparison

Working with MAT Files

The analysis supports both older (.mat v7.2 and earlier) and newer HDF5-based (.mat v7.3+) MATLAB file formats. For newer formats, the h5py package is required.

Integration with Hologram Optimization

This analysis package is designed to work with the results from the acoustic hologram optimization code. After running optimization with the main.py script, you can analyze the results using this package.

Example Workflow

  1. Run hologram optimization:
python main.py
  1. Analyze the results:
python run_analysis.py results/
  1. Review the metrics and visualizations to evaluate the quality of the optimization

About

Here we present an approach that uses Fourier domain analysis to measure the degree to which high-frequency components are retained

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages