GetSpaInfo.m 992 B

1234567891011121314151617181920212223242526272829
  1. function SpatialInformation = GetSpaInfo(OCCMat, SkaggsrateMat)
  2. %Calculate spatial information [Skaggs']
  3. %SpatialInformation = GetSpaInfo(OCCMat, SkaggsrateMat)
  4. %
  5. %Related function(s)
  6. %jkABM.m
  7. %outputs from jkABM.m are needed to calculate spatial information scores.
  8. %
  9. %Input format
  10. % OCCMat [nROW x nCOL matrix] raw occupancy amp
  11. % SkaggsrateMat [nROW x nCOL matrix] Skaggs' ABM firing rate map
  12. %
  13. %Output format
  14. % SpatialInformation [1 x 1] bit/spike spatial information scores
  15. %
  16. %Originally from VB codes which Inah Lee has.
  17. %Translate VB codes to matlab was done by [Jangjin Kim, July-13-2008]
  18. %Verification was done
  19. criteria = .0001;
  20. SumRate = nansum(nansum(SkaggsrateMat));
  21. SumOcc = sum(sum(~isnan(OCCMat)));
  22. MeanRate = SumRate / SumOcc;
  23. H1 = sum(SkaggsrateMat(SkaggsrateMat > criteria) * -1 .* log2(SkaggsrateMat(SkaggsrateMat > criteria)) / SumOcc);
  24. H0 = MeanRate * -1 * log2(MeanRate);
  25. SpatialInformation = (H0 - H1) / MeanRate;