You are not logged in. Log in
|
|
Processing Raw Data for Blips on TracksFrom $1Table of contentsYou have a blipmovie on which you have run the tracker. How do you go back to the raw data for all blips on all these tracks? Attached below are two R files which let you do this. Download and save each one like so:
Inputs Required
Running (as a script)
To see progress as the script runs, switch to the R terminal window. Running (as a function call)
source("utils/processTrackBlips.R") which defines the function processTrackBlips.R
processTrackBlips("/path/to/blipmovie.bm", "/path/to/tracks.csv", blipfun) Blip Processing FunctionsThe blip processing function is called for each blip in each track. The function should be defined like so: blipfun = function(sp, v, t, tn) { ## do something interesting } The parameters to the function (i.e. what the script supplies to your code) are:
For example, the default blipfun in process_track_blips.R is defined like this: #### print number of samples and area for each blip in a track
blipfun = function(sp, v, t, tn) {
#### e.g. this writes the timestamp, track number, number of samples
#### (which is the number of rows in the matrix sp) and the blip area
#### to a file.
cat(sprintf("%.3f,%d,%d,%.1f\n", t, tn, nrow(sp), RSS$patches$area[attr(sp, "index")[1]]), file=MYFILE)
}
This prints:
attr(sp, "index")[1] returns the patch number for the blip; that is, the index of its row in the RSS$patches data.frame for the current sweep. Here is an example which instead plots the 2-D shape of each blip in each track: #### plot the 2-d shape in space of each blip in a track
blipfun = function(sp, v, t, tn) {
## plot 2-d shape of blip in space
try (
plot( gui.tx.matrix.to.spatial(sp)[,1:2],
xlab="x",
ylab="y",
main=sprintf("At %s (track %d) blip has %d pixels\n",
strftime(as.POSIXlt(structure(t,class="POSIXct")), "%Y-%m-%d %H:%M:%OS3"),
tn,
nrow(sp)
))
)
}
Here's an explanation.
This plots a circle at the x, y coordinate of each pixel in a blip. This example outputs a record for each 'pixel' (sample, really) in every track blip: ## for each pixel in each blip in a track, dump a record with these fields:
## ts numeric timestamp
## trackNo track number from original track file
## blipID arbitrary but unique ID for each different blip (unites pixels from same blip)
## range range of this pixel (metres)
## azi compass angle of this pixel (degrees clockwise from true North)
## phi elevation angle of this pixel (degrees above horizon)
## int intensity of this pixel (0..4095 for Seascan and USRP data; 0..255 for XIR3000 data)
blipID <<- 0
blipfun = function(sp, v, t, tn) {
## bump up blip counter; serves only to unite records from pixels in the same blip
blipID <<- blipID + 1
## convert sample/pulse coordinates to spherical coordinates, given current radar scaninfo
sph = rss.sp.to.sph(sp)
cat(paste(sprintf("%.3f,%d,%d,%.1f,%.2f,%.1f,%.4f\n", t, tn, blipID, sph[,1], sph[,2], sph[,3], v), collapse=""), file=MYFILE)
}
Was this page helpful?
Tags: (Edit tags)
|
Powered by MindTouch Core |