Skip to content

Instantly share code, notes, and snippets.

View johncolby's full-sized avatar

John Colby johncolby

  • Marin Health
  • San Francisco, CA
View GitHub Profile
@johncolby
johncolby / fft_convolution.R
Created October 27, 2011 17:15
An example showing the benefits of FFT convolution vs. manual calculation
require(plyr)
set.seed(12345)
n = 10
n.sum = 2
# Simulate data
a = sample.int(10, n, replace=T)
df = data.frame(n=1:n, a)
@johncolby
johncolby / rowname_index.R
Created November 1, 2011 20:18
Example showing indexing/replacement by row names
original = expand.grid(ID1=c('a', 'b', 'c'), ID2 = c('red', 'green', 'blue'))
original$value = 0
replacement = data.frame(ID1='b', ID2='red', value=1)
rownames(original) = paste(original$ID1, original$ID2)
rownames(replacement) = paste(replacement$ID1, replacement$ID2)
original[rownames(replacement), ] = replacement
Pf1 Pf2 Pf3 Pf4
0.4 0.3 0.1 0.6
0.1 0.7 0.7 1
0.4 0.9 0.5 0.7
0.3 0.4 0.4 0.7
1 0.8 0.4 0.2
0.4 0 0.3
0.4 0.8 0.5
0.1 0.2
0.2 0.2
@johncolby
johncolby / textplot.R
Created December 15, 2011 21:27
Modification to textplot() from gplots to allow for better justification
# $Id: textplot.R 1213 2007-11-01 20:20:10Z warnes $
textplot <- function(object, halign="center", valign="center", cex, ... )
UseMethod('textplot')
textplot.default <- function(object,
halign=c("center","left","right"),
valign=c("center","top","bottom"),
cex, ... )
@johncolby
johncolby / macos_retina_compared.md
Last active July 6, 2023 19:50
macOS retina scaling comparison

macOS hiDPI retina scaling options compared

These are some photos comparing different macOS retina scaling options. All use a non-vector test pattern displayed at 100% (AAPM TG18). All photos are taken at roughly the same distance, using the same crop. Forgive the slight hand-held motion blur, and focus on these variables:

  • Pixel size
  • UI size
  • Pixel perfection (has any interpolation taken place?)
  • Real estate (how much of the image is displayed in this representative patch?)

Dell U2713H