Open issylarken28 opened 5 years ago
Hi @alhenry, do you have the code for this we worked out during code club the other day?
Hi @issylarken28 here's the code and the output (I removed some parts to make it more concise). Hope this helps
#import text file
my_data <- read.csv("https://github.com/ucl-ihi/CodeClub/files/3579119/pixel.intensity.data.tab.txt", header = TRUE, sep='\t')
#now do the fft on whole dataframe
fourierd <- apply(my_data,2,function(x) fft(as.numeric(x))) #it's now a matrix
#turn it into a data frame
fourierdat <- as.data.frame(fourierd)
#step 3 - get the absolute value of the complex numbers resulting from the fft
absTestAll <- abs(fourierdat)
# histogram
histData <- sapply(absTestAll[2:nrow(absTestAll),], which.max) * 0.94
hist(histData[2:length(histData)], breaks = 1000, xlim = c(0,20), ylim=c(0,150))
Created on 2019-09-10 by the reprex package (v0.3.0)
Data: pixel intensity data tab.txt