popclass: A Python Package for Classifying Microlensing Events
popclass is a Python package that provides a flexible, probabilistic framework for classifying the lens of a gravitational microlensing event. Gravitational microlensing occurs when a massive foreground object (e.g., a star, white dwarf or black hole) passes in front of and lenses the light from a distant background source. This causes an apparent brightening, and shift in position, of the background source. In most cases, characteristics of the microlensing signal do not contain enough information to definitively identify the lens type. Different lens types lie in different but overlapping regions of the characteristics of the microlensing signal. For example, black holes tend to be more massive than stars and therefore cause microlensing signals that are longer. Current Galactic simulations enable us to predict where different lens types lie in the observational space and can therefore be used to classify events (e.g., Lam et al., 2020). popclass allows the user to match the characteristics of a microlensing signal with a simulation of the Galaxy to calculate lens type probabilities for the event (see Figure 1). Constraints on any microlensing signal properties and any Galactic model can be used. popclass comes with an interface to ArviZ (Kumar et al., 2019) and PyMultiNest (Buchner et al., 2014) for microlensing signal constraints, as well as pre-loaded Galactic models, plotting functionality, and methods to quantify the classification uncertainty. The probabilistic framework for popclass was developed in Perkins et al. (2024), used in Fardeen et al. (2024) and has been applied to classifying events in Kaczmarek et al. (2025).