function ArrayOfLocalDensities = AllCoords_LocalDensity(ScriptVar, AllCoords, ...
    frame_of_interest)
    % Compute local density for the given frame
    % Output -
    %    N_Neighbours - 1 x k array where k denotes the number of particles
    %                   Each element = number of neighbours for particle
    %                   assigned that index
    %
    % Inputs - 
    %    ScriptVar - Parameters container map
    %    AllCoords - Array of particle coordinates 
    %    Frame_of_interest - Frame to be used for local density calculation
    % Example -
    %    LDs = AllCoords_LocalDensity(ScriptVar, AllCoords, 25)
    
    tic
    ScriptVar('rSense') = 0.02; % Set rSense even if sensing is not used, 
    % so that NumberOfNeighbours can be used to calculate the local density
    AllCoords = AllCoords(:,:,frame_of_interest);
    TotalParticles = sum(ScriptVar('N_Particles'));
    N_Neighbours = zeros(1, TotalParticles);
    parfor i = 1:TotalParticles
        N_Neighbours(i) = transpose(NumberOfNeighbours(ScriptVar, AllCoords(i,1),...
            AllCoords(i,2), AllCoords, i));
    end
    ArrayOfLocalDensities = N_Neighbours./(pi*ScriptVar('rSense')*ScriptVar('rSense'));
    % Calculate mean and SEM for reporting
end