The binning in PyMS. The function "build_intensity_matrix()" performs binning on raw GC-MS data, and produces an object of the type "IntensityMatrix" from the object "GCMS_data" by binning. The object "GCMS_data" (holds the raw GC-MS data) consists of a list of mass spectral scans taken at equidistant time points along the retention time axis t, t + Δt, t + 2Δt , where each scan is a vector of (m/z, intensity) pairs. Binning creates a two-dimensional table whose cells are filled with sums of intensities that fall within each m/z bin. The "IntensityMatrix" object contains the binned data table, the vector of retention times that corresponds to the rows of the binned table (t = [t, t + Δt, t + 2Δt,…]), the vector of m/z which corresponds to the columns of the binned table (v = [ m1, m2, m3, … ]), and also defines a number of methods that operate specifically on the "IntensityMatrix" object. Empty cells of the binned table are filled with zeros (zeros not shown).