Machine Learning for Plasma State Classification in ECR Ion Sources

Context & Motivation

This project explores a real-world engineering problem in the field of applied physics: the automatic detection and classification of hydrogen plasma states inside an Electron Cyclotron Resonance (ECR) ion source. These sources are critical components in particle accelerators, where precise control over plasma conditions directly impacts beam quality.

The work was carried out using the PIT30 ion source developed at IZPILab (UPV/EHU). Rather than relying on traditional, manual signal interpretation, the project introduces a machine learning approach to classify plasma transitions based on real experimental data — even in the absence of direct observables such as luminosity.

The goal was to build a robust, non-intrusive, and reproducible method that could eventually be extended to other ion sources and real-time monitoring environments.

Ion Sources in Particle Accelerators

Particle accelerators rely on a two-stage architecture:

  • Ion Source: generates the plasma that contains charged particles (e.g., protons, molecular ions).
  • Acceleration Stage: extracts and accelerates those particles to high energy levels.

In this project, the ion source is of the Electron Cyclotron Resonance (ECR) type. These devices ionize gas (in this case hydrogen) by injecting microwave power into a magnetic confinement chamber. The electrons in the plasma resonate when the magnetic field matches the Larmor condition:

f=eB2πmef = \frac{eB}{2\pi m_e}

where:

  • ee is the elementary charge,
  • BB is the magnetic field strength,
  • mem_e is the electron mass.

When resonance is achieved, electrons absorb energy and ionize gas particles via collisions, creating a dense and magnetically confined plasma. From there, ions can be extracted by applying electric fields.

The Problem: Classifying Plasma States

In the PIT30 source, the plasma exhibits transitions between three dominant ion configurations: H+\mathrm{H}^+, H2+\mathrm{H}_2^+, and H3+\mathrm{H}_3^+. Each corresponds to a distinct plasma state, observable via system parameters such as luminosity, RF power, and impedance.

Traditionally, experts identify these transitions manually by visually inspecting signal plots — a subjective and non-scalable process.

The core challenge was to develop an automatic pipeline capable of:

  • Detecting transition points in system signals.
  • Classifying the new plasma state accurately and non-intrusively.
  • Generalizing across changes in hardware configuration and signal quality.

Why Machine Learning?

The project applies both unsupervised and supervised machine learning methods to achieve its goals:

  • Unsupervised clustering (e.g. K-Means, DBSCAN) to identify state groupings without labels.
  • Supervised classifiers (Random Forest, sequential neural networks, RNNs) to predict states from labeled jumps.

These tools allow us to replace heuristic, hand-crafted methods with reproducible algorithms that scale to larger datasets, and remain robust even when key sensors (like plasma luminosity) are unavailable.

Experimental Setup & Data Pipeline

The experiments were conducted using the PIT30 ECR ion source, a device designed for applied research at IZPILab. The source operates under vacuum and uses a combination of magnetic confinement and microwave radiation to sustain hydrogen plasmas. Experimental campaigns consisted of controlled parameter sweeps while monitoring electrical and physical signals.

Hardware Configuration

The plasma chamber is enclosed by two magnetic coils creating an axial magnetic field, and a set of hexapole magnets providing radial confinement. A microwave generator at 2.45 GHz injects power into the chamber through a coaxial line and a directional coupler.

Key system parameters monitored during operation include:

  • Forward and Reflected RF Power — to track power coupling efficiency.
  • DC Current in the extraction system — to infer plasma density and stability.
  • Impedance matching — a key signal correlated with plasma transitions.
  • Plasma Luminosity — monitored with a camera when available.

Each discharge lasted around 90 seconds, with RF power being ramped up or down gradually. During these ramps, the plasma spontaneously transitioned between ion configurations — providing natural training examples for classification.

Data Acquisition Pipeline

A Python-based acquisition system was developed to record data from National Instruments (NI) analog sensors at high frequency (500–1000 samples per second). Each measurement was stored as a time series of synchronized signals:

  • forward_power
  • reflected_power
  • impedance
  • plasma_luminosity (when available)
  • ion_current (DC component)

The raw time series were saved in .csv format with timestamps and signal metadata, and later pre-processed using pandas and numpy for cleaning, filtering and normalization.

Signal Preprocessing

Before feeding the data into machine learning algorithms, several preprocessing steps were applied:

  • Signal filtering using moving average and Savitzky–Golay filters to reduce high-frequency noise.
  • Normalization to remove absolute scale differences between experiments.
  • Dimensionality reduction via principal component analysis (PCA), when used for unsupervised learning.
  • Manual annotation of transition zones on a subset of signals to generate labeled training data.

All code was developed in Python using Jupyter notebooks and saved as reproducible scripts for future integration into a real-time system. The modular architecture allows flexible swapping of feature extraction or classifier components.

Modeling Plasma Transitions

The core objective of this project was to develop a model capable of classifying plasma states in real time based on physical signals, without relying on invasive measurements like spectroscopy or imaging. This section outlines the dual strategy adopted: unsupervised clustering to identify natural state groupings, and supervised classification to predict transitions on unseen data.

Unsupervised Clustering

In the absence of labeled ground truth across the full dataset, initial modeling began with unsupervised methodsto uncover underlying structure in the signal space. The idea was to discover regions in feature space corresponding to dominant ion configurations: H+\mathrm{H}^+, H2+\mathrm{H}_2^+, and H3+\mathrm{H}_3^+.

I applied Principal Component Analysis (PCA) to reduce dimensionality and visualize latent structure, followed by clustering algorithms such as:

  • K-Means — assuming spherical clusters and fixed number of states.
  • DBSCAN — for density-based clusters, capable of detecting transition anomalies.

The results revealed three main regions in signal space consistent with expected transitions. These clusters were used to generate pseudo-labels for training supervised models and to segment transitions in long signal traces.

Feature Engineering

Feature extraction was critical to model success. From each raw signal segment, I computed a set of time-domain features including:

  • Mean, standard deviation, and higher-order moments.
  • Slope and trend of power curves during transitions.
  • Impedance variability and discontinuities.
  • Signal derivatives and zero-crossing rates.

These features were concatenated into a compact vector per segment, normalized across the dataset, and used as input for classifiers. Dimensionality was reduced via PCA or feature selection to improve generalization.

Supervised Classification

Once representative segments were labeled (via unsupervised clustering and manual inspection), I trained supervised learning models to recognize plasma states in real time. Several algorithms were evaluated:

  • Random Forest — robust to noise and interpretable via feature importance.
  • Gradient Boosting — for improved accuracy on imbalanced segments.
  • Multilayer Perceptrons (MLPs) — simple neural networks for feedforward classification.
  • Recurrent Neural Networks (RNNs) — for modeling temporal dependencies across signal windows.

Each model was trained and validated using k-fold cross-validation, with performance measured via accuracy, F1 score, and confusion matrices. The best performance was obtained by the MLP + PCA pipeline, achieving state classification accuracy above 93% on the test set.

Transition Detection

To make the model practical for online monitoring, a post-processing stage was added to detect sharp discontinuities in signal features that suggest transitions between plasma regimes. This was implemented with a sliding window and a statistical change point detection algorithm.

When a significant change was detected, a new feature vector was extracted and passed through the classifier, triggering an update in the displayed plasma state. This enables near real-time state tracking with minimal latency.

Summary

The modeling pipeline integrates unsupervised clustering, feature extraction, supervised classification, and transition detection into a single modular framework. It enables autonomous tracking of plasma dynamics, reduces reliance on manual interpretation, and opens the door to integration with feedback control systems.

Evaluation & Results

To assess the reliability and generalization ability of the classification pipeline, I performed a series of validation experiments across multiple acquisition sessions, hardware configurations, and signal qualities. The results confirm that the model can detect plasma transitions accurately and robustly, even under moderate noise and variation in operational conditions.

Classification Metrics

The main performance metrics evaluated were:

  • Accuracy: proportion of correctly classified state segments.
  • Precision / Recall / F1 Score: to handle class imbalance.
  • Confusion Matrix: for visualizing misclassification patterns.

The best-performing model (MLP + PCA) achieved:

  • Accuracy: 93.2%
  • Macro F1 Score: 0.91
  • Precision: >90% for all three ion states

Misclassifications mostly occurred in transition zones, where signal overlap is expected. These regions are naturally ambiguous and were correctly identified by the model as “changing state”.

Visual Results

The figures below (see thesis, section 5.3) show typical signal traces with model predictions overlaid. Color-coded classifications demonstrate smooth state detection across full discharge cycles. Transitions are marked by abrupt impedance shifts and changes in current slope.

The output is sufficiently stable to be displayed in real-time graphical user interfaces (GUIs) for operators, providing a trustworthy view of plasma conditions.

Robustness Tests

To evaluate robustness, I conducted simulations with:

  • Downsampled and noisy versions of signals.
  • Modified discharge ramps and altered microwave coupling.
  • Loss of luminosity input — the classifier still functioned based on impedance and current alone.

In all scenarios, the model retained classification accuracy above 85%, confirming its capacity for generalization and resilience to experimental variation.

Deployment Readiness

The full pipeline was packaged as a Python module with configuration options for:

  • Window size and overlap for feature extraction.
  • Choice of classifier and preprocessing method.
  • Thresholds for transition detection sensitivity.

It can be integrated with data acquisition systems and eventually linked to actuator controls for closed-loop plasma management — an avenue for future research.

Conclusions & Reflections

This project demonstrates how machine learning techniques can be successfully applied to experimental physics for real-world system monitoring. By combining signal processing, unsupervised clustering, supervised classification, and domain-specific knowledge, I was able to build a system that classifies hydrogen plasma states in an ECR ion source with high accuracy and robustness.

From an engineering standpoint, the pipeline addresses a genuine practical need: non-intrusive, real-time identification of plasma regimes, which traditionally relied on expert judgment and non-scalable heuristics. It replaces that approach with a modular and reproducible solution that can be adapted to future devices or research setups.

Technically, the work strengthened my ability to:

  • Design and execute experimental protocols in plasma physics and electrical diagnostics
  • Process and analyze high-frequency multichannel time-series data
  • Develop feature engineering pipelines tailored to physical signal behavior
  • Train, evaluate, and interpret machine learning models on real-world datasets
  • Communicate technical findings with clarity and precision across disciplines

Importantly, this project also reflects my capacity to learn and apply concepts outside my primary academic background. I had no prior experience with plasma science, ion sources, or industrial hardware systems. Yet, through independent research, lab work, and collaboration, I was able to engage deeply with the physical phenomena, understand the experimental constraints, and translate domain knowledge into computational models.

The ability to move across fields, structure complex problems, and deliver working solutions — both theoretically and in code — is what I consider the core of good engineering.

(This project originated as my undergraduate thesis in electronic engineering. If you'd like to read the full thesis or discuss the technical implementation in detail, feel free to contact me — I'd be happy to share it.)