updated function flexibility to analyse data with 2D (pos_time) or 3D (pos_freq_time) data