Code and Data for 'Generalized Time-Series Analysis for In-Situ Spacecraft Observations: Anomaly Detection and Data Prioritization using Principal Components Analysis and Unsupervised Clustering' by M.G. Finley, M. Martinez-Ledesma, W.R. Paterson, M.R. Argall, D.M. Miles, J.C. Dorelli, and E. Zesta. Earth and Space Science, 2024. The scripts contained in this repository illustrate basic usage of the event detection algorithm described in the above manuscript. The scripts were written in Python 3.10 and require typical dependencies such as PySpedas and Scikit-Learn. File Descriptions: 1. 'sample_detection.py' -- This script downloads the appropriate MMS cdf file using PySpedas, detects anomalous samples within the time series data, and displays the result. 2. 'sample_detection_utilities.py' -- This utility file contains the necessary utilities (e.g., the anomaly detection algorithm) that are used in 'sample_detection.py.' 3. 'example_output.png' -- This is the result image output by 'sample_detection.py.' 4. 'pydata/mms1/fgm/srvy/l2/2015/12/mms1_fgm_srvy_l2_20151214_v4.18.0.cdf' -- This is the data file downloaded from MMS1 by 'sample_detection.py,' using PySpedas. Funding Information: This work was supported in part by the National Aeronautics and Space Administration HERMES mission and grants 80NSSC21M0180, 80NSSC23K1295. Additional support was provided by the Center for HelioAnalytics, funded through the NASA ISFM program. The computing resources utilized in the generation of the figures and analysis in the accompanying manuscript were in part provided by HelioCloud, a service managed by NASA's Heliophysics Digital Resource Library. Terms of Use: Please reference this repository and the accompanying manuscript when utilizing this technique or software. Contact: matthew.g.finley@nasa.gov mgfinley@umd.edu