Skip to content

Instantly share code, notes, and snippets.

@tmoertel
Created April 29, 2012 04:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmoertel/2533071 to your computer and use it in GitHub Desktop.
Save tmoertel/2533071 to your computer and use it in GitHub Desktop.
Small R script to visualize bit differences between two disk images
library(ggplot2)
library(scales)
library(plyr)
library(reshape2)
disk_errors <- read.csv("disk_errors.csv", header=F)
names(disk_errors) <- c("byte_offset", "bit", "a", "b")
disk_errors <- mutate(disk_errors,
bit = factor(bit),
track = floor(byte_offset / 256 / 16),
track_byte = byte_offset - track * 256 * 16,
track_sector = track_byte / 256)
qplot(track, track_sector, data = disk_errors, color = bit,
shape = I("."), geom = "jitter", height = 0) +
scale_y_continuous(breaks = 0:16) +
opts(title = "Errors in round-trip image compared to original") +
xlab("Track in disk image") +
ylab("Logical position of byte error within track")
ggsave(file = "adtpro-round-trip-bit-errors.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment