Miloš Vlainić

My GitHub blog: things you might be interested, and probably not...

Academic experience (2013-2020)

Before I called myself a Data Scientist, most of my serious coding lived in fusion experiments and in a plasma spectroscopy lab. This page is the DS-relevant half of that story: Python and MATLAB against live data, project leading on a shared machine, science communication, and my first WordPress site plus my first real ML interpolation tool.


PhD - COMPASS tokamak (2013-2017)

Joint PhD in Fusion Science and Engineering (Ghent University, IPP Prague, CTU Prague) - Python, MATLAB

From November 2013 through November 2017 I ran an experimental program on the COMPASS tokamak at the Institute of Plasma Physics in Prague, inside the Fusion-DC doctoral track. The physics topic was runaway electrons. What stayed with me for later data work was the operating loop: decide what to measure, book the machine, keep the shot lists, turn discharges into figures, and close each year in writing.

Python against a live shot database

I wrote about 60 Python scripts (2015-2016) on NumPy, SciPy, Matplotlib, and pyCDB - the client for the COMPASS discharge database. The pattern was almost always the same:

That is batch thinking in practice: one interesting discharge is a check; a campaign of 150 shots with holes in the channels is the real job. I added small defensive habits because a long loop should not die on shot 40: division-by-zero guards, safe logarithms, Savitzky-Golay smoothing before an integral. Campaign boundaries showed up as commented shot ranges in the files, so I could rerun last year’s scan without digging through email.

Scripts covered 1-D export for fast revision checks, IR camera frame batches, hard X-ray overlays with plasma current and normalized beta (each channel in its own try), detector debugging scripts, magnetics integrals against coil signals, equilibrium scalars copied into MATLAB, and list-mode reads from a helium-3 neutron counter. I also started HDF5 with h5py as a sketch; production paths stayed on pyCDB.

Tools other people could click

The step past “a script on my machine” was two MATLAB GUIDE apps, REcheck and REcompare, each with dozens of callbacks.

The lesson for later DS work: validate input, group related signals, keep database access in one place, and separate “which plot” from “how to draw it.”

Driving code I did not write

Large upstream solvers stayed upstream. I learned integration:

Leading the experimental program

Coding decided how a shot was read. Planning decided which shots existed.

Communication and closing the loop

A result was not done when the figure existed. It was done when the discharge summary, a talk, and a thesis chapter agreed on which shots were in.

What carried over to data science

Data plumbing (one database, many signal names, two client languages). Loops that survive missing data. Two speeds of tool (my script this week vs a GUI for the lab). Scoping work on a shared resource (calendar blocks, shot lists, collaborator folders). Writing for a specific reader (operator, funder, supervisor, referee).


Institute of Physics Belgrade (2017-2019)

Associate Research Scientist, Laboratory for Plasma Spectroscopy and Lasers (PSL) - WordPress, Python

Roughly 2017-2019 at the Institute of Physics Belgrade, in parallel with wrapping up the PhD archive and the freelance work that followed. The lab needed a public face and a numerical pipeline for spectral line work. I owned both, plus smaller batch Python (convolution, peak landmarks, VUV ingestion) that the overviews in my private archive describe in more detail.

Lab website (WordPress)

PSL needed a site that could hold people, publications, equipment, news, and collaborations for years - a content database with a public interface, not a one-off brochure.

What I did:

DS translation: a small catalog product end to end - entities, ETL from export, presentation layer, operability doc. No passwords or personal credentials belong on a portfolio page; the real runbook stayed local.

Line-profile interpolation (Python, ML)

A colleague needed theoretical spectral line profiles at plasma conditions between simulation grid points, then convolved with the real spectrometer response so curves could be compared to measurements. Simulations existed on a coarse grid: 13 electron densities × 4 temperatures, for five emission lines (roughly Jan-Aug 2019).

Stage 0 - convolution batch job

First deliverable: read theory and Instrumental.txt, resample both onto the finer wavelength step, pad ranges, align peaks, convolve (full mode, then trim so peaks stay lined up), optional Doppler Gaussian left off in the final batch. One finished run covered on the order of 260 cases, each with a PNG and a TSV (lambda, theory, instrumental, convolved columns).

Stage 1 - one big model (did not work)

I tried a single regressor over wavelength, temperature, and density: Gaussian Process Regression, SVR, even a Keras deep MLP with a custom RBF layer, plus inverse-CDF resampling to place sample points where the line actually sits. It did not generalize across the huge dynamic range. The lesson: decompose before you stack more layers.

Stage 2 - GPs done properly

In parallel I worked through the Coursera Bayesian Methods for ML track (GPy, sparse GPs, GPyOpt for hyperparameter search). That fed directly into the next stage; more context in my 2019 education blogs.

Stage 3 - per-line model zoo

Split each profile into shape, wavelength window, and area:

Stage 4 - hybrid GP + spline (final class)

The mature version worked from raw simulation files instead of only the saved GPR shapes:

I refactored exploratory notebooks into a reusable InterpolateLine class with plotting and export. I kept named hard cases in the notebooks (“three-bumps”, “weird”) as regression stories.

Honest limits: no test suite, no extrapolation guard outside the grid, hardcoded machine paths in the 2019 tree, and a stack that would need retuning on modern NumPy/SciPy/sklearn before it runs unchanged today.

What carried over to data science

Own a small data product (the website). Finish a batch pipeline (260 tables). Iterate ML architecture when the monolith fails (decompose, then hybrid classical + GP). Deliver negatives and diagnostics, not only a happy-path demo. Notebook → class when a collaborator needs to call the same thing twice.


If something is wrong in this summary or you want a subsection expanded, please let me know.