LINGFENG WEI

POSTDOCTORAL SCHOLAR AT UCLA

About Me

I am a postdoctoral scholar in Prof. Tuan Do's group at the University of California, Los Angeles, and received my Ph.D. in Physics from the University of California, San Diego in 2025. I build scientific software, probabilistic models, and deep-learning inference tools for large astronomical datasets: computer vision on telescope images, Bayesian inference and MCMC, neural posterior estimation, and high-performance Python. Along the way I have turned slow research code into fast pipelines, including a 600× faster neural inference model, a 67× parallelized geometry algorithm, and a 500–1000× batched fitting engine in an open-source package.

I am interested in roles in scientific computing, software engineering, and machine learning engineering.

Download my CV

Profile Photo

Research

JWST NIRCam mosaic of the Galactic Center, showing three scans and the detector footprints of every exposure
JWST NIRCam mosaic of the Nuclear Star Cluster: three scans, with the detector footprint of each exposure that the astrometry pipeline registers.

UCLA · 2025–present · Advisor: Prof. Tuan Do

JWST NIRCam · Astrometry · PSF fitting · Image registration · KD-tree · ~2 TB of imaging data

The Nuclear Star Cluster at the center of the Milky Way is one of the most crowded fields in the sky: a single James Webb Space Telescope image contains more than 300,000 stars. I am building a precise astrometry pipeline that measures proper motions from JWST NIRCam images, fitting the point-spread function iteratively and registering images across pointings by KD-tree matching, over about 2 TB of imaging data. With it, I model the stellar density profile to separate the Nuclear Star Cluster from the nuclear stellar disk, and characterize the cluster's internal kinematics to test predictions of how it formed.


Model architecture: ResNet and GRU feature extractor followed by a normalizing flow that outputs the posterior
Model architecture: a ResNet-GRU feature extractor feeds a normalizing flow that outputs the posterior.

UCSD · 2024 · 5-person team

PyTorch · CUDA · ResNet · GRU · Normalizing flows · Simulation-based inference

Inferring a star's properties from its spectrum normally means running MCMC for every star. We trained a neural network once and then inferred posteriors directly. I generated 50,000 simulated spectra and trained a ResNet-GRU feature extractor with a normalizing flow on GPUs to infer five stellar parameters. Amortized inference brought the cost per star from about 30 minutes to 3 seconds, and the posteriors agreed with MCMC, including the correlations between parameters.


Stellar density maps of Westerlund 1 in three mass bins
Stellar density maps of Westerlund 1 for low-, mid-, and high-mass stars (Wei et al. 2025, Fig. 14).

UC San Diego & UC Berkeley · 2023–2025 · Advisors: Prof. Jessica Lu, Prof. Quinn Konopacky

Bayesian inference · MCMC · Forward modeling · Gaussian mixture models · Minimum spanning trees · Dask

Westerlund 1 is the most massive young star cluster in the Milky Way. Using multi-epoch Hubble Space Telescope data, I analyzed its structure and unusual initial mass function, separated cluster members from field stars with Gaussian mixture models and simulated stars, measured mass segregation with minimum spanning trees, and fit the cluster's structure and dynamics with Bayesian inference. Computing the density maps above was the main bottleneck. I rewrote it with image super-sampling, parallel point-in-polygon tests, and distributed Dask-GeoPandas, cutting the runtime from 45 minutes to 40 seconds (67×).


Three-dimensional kinematics of the Orion Nebula Cluster: proper-motion arrows colored by radial velocity
3D kinematics of the inner Orion Nebula Cluster: arrows show proper motions, colors show radial velocities (Wei et al. 2024).

UC San Diego · 2020–2023 · Advisors: Prof. Quinn Konopacky, Prof. Chris Theissen

SQL (ADQL) · Catalog cross-matching · MCMC (emcee) · Nested sampling · Forward modeling

The Orion Nebula Cluster is the nearest site of ongoing massive star formation. I built a pipeline that merges catalogs from Keck, Hubble, Gaia, and APOGEE through SQL (ADQL) queries and cross-matching. I then forward-modeled high-resolution Keck spectra with MCMC and nested sampling to measure each star's velocity and properties with uncertainties. The resulting 3D velocity map shows that lower-mass stars move faster relative to their neighbors, which I compared with hydrodynamical simulations of cluster formation.


Stability map of simulated planetary systems compared with the relativistic and non-relativistic criteria
Each point is an N-body simulation; the red curve is the relativistic stability criterion (Wei et al. 2021).

UCLA · 2018–2021 · Advisor: Prof. Smadar Naoz

C · N-body simulation · Analytical modeling · Parameter sweeps

Planets close to their star can be destabilized by a distant companion, while general relativity can protect them. I derived an analytical criterion that predicts whether such a system stays stable, and validated it against N-body simulations integrated for up to 170 million years, run with Rings-GR, a C simulator I extended with general relativity. The criterion replaces costly simulations and can rule out where undiscovered companions may hide.


Open-Source Software

Astrometric alignment toolkit · Prof. Jessica Lu's group

FlyStar originally fit each star's motion one at a time with an iterative optimizer. Every motion model in it is linear in its parameters, so I replaced the per-star loop with closed-form weighted least squares solved for all stars at once. The fits run 500–1000× faster on catalogs of 10,000+ stars, and the speed-up grows with catalog size. I also cut alignment memory use by about half, and added unit tests, documentation, and PyPI packaging.

Per-star versus batched fit time and speed-up as a function of the number of stars
Per-star vs. batched fit time (left) and speed-up (right) against the number of stars.
  • SPISEA: stellar population synthesis (Astropy-affiliated). Optimized data structures for a 2× speed-up.
  • SMART: spectral modeling and radial-velocity tool. Developed the MCMC spectral-fitting pipeline.
  • Rings-GR: secular orbital evolution simulator in C, extended with general relativity.

Publications

From ORCID 0000-0002-2612-2933. Full list on Google Scholar.

  1. Wei, L., Lu, J. R., Boyle, P. C., et al. 2025, Structure and Dynamics of the Young Massive Star Cluster Westerlund 1, ApJ, 992, 213. [DOI] [arXiv]
  2. Wei, L., Theissen, C. A., Konopacky, Q. M., Lu, J. R., Hsu, C.-C., & Kim, D. 2024, The 3D Kinematics of the Orion Nebula Cluster. II. Mass-dependent Kinematics of the Inner Cluster, ApJ, 962, 174. [DOI] [arXiv]
  3. Faridani, T. H., Naoz, S., Wei, L., & Farr, W. M. 2022, Hiding Planets Near and Far: The Parameter Space of Hidden Companions for Known Planetary Systems, ApJ, 932, 78. [DOI] [arXiv]
  4. Theissen, C. A., Konopacky, Q. M., Lu, J. R., Kim, D., Zhang, S. Y., Hsu, C.-C., Chu, L., & Wei, L. 2022, The 3D Kinematics of the Orion Nebula Cluster: NIRSPEC-AO Radial Velocities of the Core Population, ApJ, 926, 141. [DOI] [arXiv]
  5. Wei, L., Naoz, S., Faridani, T., & Farr, W. M. 2021, Relativistic Dynamical Stability Criterion of Multiplanet Systems with a Distant Companion, ApJ, 923, 118. [DOI] [arXiv]

Contact

Department of Physics and Astronomy
University of California, Los Angeles
Los Angeles, CA 90095

Email: lwei@astro.ucla.edu

GitHub · LinkedIn · Google Scholar · ORCID · CV