Physics-Ellipsometry-VASE
view release on metacpan or search on metacpan
# Physics::Ellipsometry::VASE
Variable Angle Spectroscopic Ellipsometry data fitting for Perl / PDL.
## Description
Physics::Ellipsometry::VASE provides a framework for fitting optical thin-film
models to VASE data using the Levenberg-Marquardt algorithm. It handles:
- **Data loading** â simple whitespace-delimited files and native J.A. Woollam
VASE instrument format (auto-detected)
- **Weighted fitting** â uses measured uncertainties (sigma) from Woollam files
- **Numerical Jacobian** â automatic relative-step finite differences
- **Plotting** â multi-angle color-coded overlays via PDL::Graphics::Gnuplot
## Installation
From CPAN:
```bash
cpanm Physics::Ellipsometry::VASE
```
From source:
```bash
perl Makefile.PL
make
make test
make install
```
## Synopsis
```perl
use PDL;
use PDL::NiceSlice;
use Physics::Ellipsometry::VASE;
my $vase = Physics::Ellipsometry::VASE->new(layers => 1);
$vase->load_data('measurement.dat');
sub my_model {
my ($params, $x) = @_;
my $wavelength = $x->(:,0); # nm
my $angle = $x->(:,1); # degrees
my $psi = $params->(0) + $params->(1) / $wavelength**2;
my $delta = $params->(2) + $params->(3) * $wavelength;
return cat($psi, $delta)->flat;
}
$vase->set_model(\&my_model);
my $fitted = $vase->fit(pdl [45, 1e4, 120, 0.01]);
# Optional: plot results (requires PDL::Graphics::Gnuplot)
$vase->plot($fitted, output => 'fit.png');
```
## Data Formats
### Simple format
```
# Wavelength(nm) Angle(deg) Psi(deg) Delta(deg)
400 70 45.0 120.0
410 70 44.5 121.0
```
### Woollam VASE format
Recognised automatically when line 2 begins with `VASEmethod[`. Header
metadata is stored as object attributes; sigma columns are extracted and used
( run in 1.365 second using v1.01-cache-2.11-cpan-39bf76dae61 )