This repository holds codes and data related to the work "Direct evidence that twisted flux tube emergence creates solar active regions", published in Nature Communications. There are three files: 1. source_data.xlsx: this is a spreadsheet containing the necessary data for reproducing the accumulation figures in the paper. 2. winding_code.zip: this file contain the code for calculating the helicity and winding fluxes. The code is written in a mixture of C++ and Python and includes an instruction file. 3. simulation_code.zip: this file contains a version of the open source Lare3D code, set up to reproduce the flux emergence simulation descrbed in the paper. This code is written in Fortran and an instruction file is included.