R, Julia, SQL, Octave and others: Personal notes on data analysis, computation, data access most especially for querying voter history, Census, PDC, and other election data. Reader is advised to just paste the code text into Notepad++.
Monday, May 19, 2014
Radiation Sampling with Visual Comparisons : Part I
options(graphics.record=TRUE)
# RMF Media/ RMF Network Security 7:00 PM 3/20/2014. Tested on R 3.03
# Takes four CSV samples (One Control and Two Samples) from Aware Electronics RM-80 GM Counter.
# Configured to read data from "n TBU per line" for any Time Base Unit . I use TBU = 2.
# Samples must have headers with "Time" and "MicroRads_HR" (separated by tab) like this:
# Time MicroRads_HR
# 37264.91529 8.47
# 37264.91531 8.47
# 37264.91534 16.95
# Four Samples
# From Aware-Electronics Manual:
# "MicroRads_HR = microroentgens/hr"
# "One roentgen equals one thousand milliroentgens (1R = 1000mR), and one milliroentgen equals one thousand microroentgens
# (1mR = 1000uR)."
# These files can be found at ftp://rmfmedia.com/web-root/CSV
print("Four samples:")
print("Control is Room Air.")
print("Sample1 is a high (MERV rating) rated blank filter with metal grate still in sealed plastic.")
print("Sample2 Tests high (MERV rating) air filter located outside 8 inch external air intake for approximately one month.")
print("Sample2 RM80 stationary against center of filter while covered in plastic sack.")
print("Sample3 Tests high (MERV rating) air filter located outside 8 inch external air intake for approximately one month.")
print("Sample3 : RM80 stationary against center of filter without barrier.")
s <- read.delim("roomair.csv",header=TRUE,sep="\t")
b <- read.delim("blankfilter.csv",header=TRUE,sep="\t")
c <- read.delim("05.24.2014_ExtFilter.csv",header=TRUE,sep="\t")
d <- read.delim("05.24.2014_ExtFilter_np.csv",header=TRUE,sep="\t")
print("Time Base Unit is 2 seconds. MicroRads_HR = microroentgens/hr")
# Select equal amounts of data
s <- s[1:718,]
b <- b[1:718,]
c <- c[1:718,]
d <- d[1:718,]
e <- cbind("s1"=s,"s2"=b,"s3"=c,"s4"=d)
e <- e[,c(2,4,6,8)]
par(mfrow=c(2,4))
plot(1:nrow(e) ~ sort(e[,1]),col=rgb(.075,.075,.075,0.25),type="p",cex=3,xlab="MicroRoentgens/HR",ylab="Samples")
title(main="Control")
plot(1:nrow(e) ~ sort(e[,2]), col=rgb(.6,.4,.9,0.4), type="p",cex=4,xlab="MicroRoentgens/HR",ylab="Samples")
title(main="Sample1")
plot(1:nrow(e) ~ sort(e[,3]),col=rgb(.4,.6,.1,0.3),type="p",cex=4,xlab="MicroRoentgens/HR",ylab="Samples")
title(main="Sample2")
plot(1:nrow(e) ~ sort(e[,4]),col=rgb(.2,.8,.9,0.2),type="p",cex=4,xlab="MicroRoentgens/HR",ylab="Samples")
title(main="Sample3")
plot(1:nrow(e) ~ sort(e[,3]),col=rgb(.4,.6,.1,0.3),type="p",cex=4,xlab="MicroRoentgens/HR",ylab="Samples")
points(1:nrow(e) ~ sort(e[,1]), col=rgb(.075,.075,.075,0.25),cex=3)
points(1:nrow(e) ~ sort(e[,2]),col=rgb(.6,.4,.9,0.4),cex=4)
points(1:nrow(e) ~ sort(e[,4]),col=rgb(.2,.8,.9,0.2),cex=4)
title(main="All Samples")
plot(1:nrow(e) ~ sort(e[,2]),col=rgb(.6,.4,.9,0.4),,type="p",cex=4,xlab="MicroRoentgens/HR",ylab="Samples")
points(1:nrow(e) ~ sort(e[,1]), col=rgb(.075,.075,.075,0.25),cex=3)
title(main="Control and Sample 1")
plot(1:nrow(e) ~ sort(e[,3]),col=rgb(.4,.6,.1,0.3),type="p",cex=4,xlab="MicroRoentgens/HR",ylab="Samples")
points(1:nrow(e) ~ sort(e[,1]), col=rgb(.075,.075,.075,0.25),cex=3)
title(main="Control and Sample 2")
plot(1:nrow(e) ~ sort(e[,4]),col=rgb(.2,.8,.9,0.2),type="p",cex=4,xlab="MicroRoentgens/HR",ylab="Samples")
points(1:nrow(e) ~ sort(e[,1]), col=rgb(.075,.075,.075,0.25),cex=3)
title(main="Control and Sample 3")
mtext("X axis = MicroRoentgens/HR Y axis = 718 Samples",side=1, outer=TRUE,line=-1)
No comments:
Post a Comment