Skip to content

Exploring results object

Eldar Rakhimberdiev edited this page Dec 3, 2015 · 3 revisions

These are short notes, that will (hopefully) develop into detailed description.

Let's imagine we have ran that analysis and want to think see what we have in the results.

str(Result, max.level=1)
List of 5
 $ Indices    :List of 2 # these contain indices for the matrices. Normally you do not need them
 $ Spatial    :List of 5 # Here you can find grid parameters and also the spatial likelihoods estimated before model runs.
 $ Calibration:List of 3 #these are calibration data, that you will not normally use
 $ Data       :List of 2 #original data
 $ Results    :List of 9 #yeah, this is what you are normally interested in

Plotting spatial likelihood for a specific twilight

t=10
my.golden.colors <- colorRampPalette(c("white","#FF7100"))

image.plot(as.image(Result$Spatial$Phys.Mat[,t], x=Result$Spatial$Grid[,1:2],nrow=60, ncol=60),
                   col=my.golden.colors(64), main=paste("twilight number:",t , 
				   " time:", format(Result$Indices$Matrix.Index.Table$Real.time[t], tz="GMT"), "GMT, ", ifelse(Result$Indices$Matrix.Index.Table$Dusk[t], "dusk", "dawn")))          
library(maps)
map('world', add=T)
map('state', add=T)
abline(v=Result$Spatial$Grid[Result$Spatial$start.point,][1])
abline(h=Result$Spatial$Grid[Result$Spatial$start.point,][2])  

Code above makes one plot. You can put it in a loop to plot all the twilights.

Plotting distribution of results for a specific twilight

Resulting particles are stored in the rle object.


t=361
Points2plot<-Result$Spatial$Phys.Mat[,1]*0
Points2plot[Result$Results$Points.rle[[t+1]][[2]]]<-Result$Results$Points.rle[[t+1]][[1]]/sum(Result$Results$Points.rle[[1]]$lengths)

image.plot(as.image(Points2plot, x= Result$Spatial$Grid, nrow=50, ncol=50), main=paste("points distribution at",  Result$Indices$Matrix.Index.Table$Real.time[t]), col=my.golden.colors(64))
library(maps)
map('world', add=T)
abline(v=Result$Spatial$Grid[Result$Spatial$start.point,][1])
abline(h=Result$Spatial$Grid[Result$Spatial$start.point,][2]) 
box()

Let me know what else you would like to plot..