Changed the format of the data arg to write_xy_data().
This is a huge simplification and makes the function more usable for any type of data thrown at it.
The structure is now expected to be a 4D list/array corresponding to Gx, Sx, data point, data point
info.