Skip to content

Instantly share code, notes, and snippets.

View rinze's full-sized avatar

José María Mateos rinze

View GitHub Profile
@rinze
rinze / dataframe_matrix_timing.R
Last active December 21, 2015 15:58
Difference in timing for vectorized simple operations between an R matrix and a data.frame.
# Timing measurement in R. Vectorized operation on matrix / data.frame
# Author: José María Mateos - jmmateos@ieee.org
#
# For certain vectorized operations, it makes sense to convert your data.frame
# into a matrix. Even if you are using apply, the data frame iteration can be
# real slow.
#
# In this example, I will compute the Euclidean distance for a random vector
# and a random matrix / data.frame of thousands of elements. Operations will be
# done in two different ways: using the apply function over the columns and
@rinze
rinze / mariano.ijm
Last active December 20, 2015 18:08
ImageJ macro for generating de Mariano Rajoy hybrid image at http://www.flickr.com/photos/rinzewind/9458528864/.
open("C:\\temp\\barcenas.tif");
run("32-bit");
run("Mean...", "radius=30");
open("C:\\temp\\mariano.tif");
run("32-bit");
run("Duplicate...", "title=mariano-1.tif");
run("Mean...", "radius=20");
imageCalculator("Subtract create 32-bit", "mariano.tif","mariano-1.tif");
imageCalculator("Add create 32-bit", "Result of mariano.tif","barcenas.tif");
selectWindow("barcenas.tif");
@rinze
rinze / ingresos.R
Last active December 14, 2015 18:19
El script que he usado para las gráficas https://twitter.com/Rinze/status/310774361588133888 y https://twitter.com/Rinze/status/310774425563836417. El segundo fichero saca https://twitter.com/Rinze/status/310779666774515714 El siguiente enlace permite acceder a los mismos datos que he usado yo (tiene información de más países, yo me he quedado c…
# Eustat data analysis
library(ggplot2)
eustat <- read.csv(file = "/tmp/ilc_di01_1_Data.csv", na.string = ":")
eustat$Value <- gsub(" ", "", eustat$Value)
eustat$Value <- as.numeric(eustat$Value)
spain <- eustat[eustat$GEO == "Spain" &
eustat$CURRENCY == "Purchasing Power Standard" &
eustat$INDIC_IL == "Top cut-off point",
@rinze
rinze / ruido_madrid.csv
Created November 13, 2012 10:09
CSV con valores de ruido de Madrid (09-1998 - 10-2012)
station Leq L1 L10 L50 L90 L99 date
14 GLORIETA FDEZ. LADREDA 67.3 75.3 69.8 64.3 56.7 50 1998-09-30
16 ARTURO SORIA 59.5 67.8 61.6 56 45.3 39.1 1998-09-30
19 ALTO DE EXTREMADURA 63 72.4 66.3 59.3 51.4 47 1998-09-30
27 GLORIETA CARLOS V 74.3 84.4 79.5 67.8 62 55.5 1998-10-31
29 PLAZA DE ESPAÑA 66.3 74 68.8 64.5 59.6 54.8 1998-10-31
31 PLAZA DOCTOR MARAÑÓN 72.5 80.2 75.6 70.2 63.1 55.2 1998-10-31
32 PLAZA M. DE SALAMANCA 73.1 88.4 69.9 63.6 51.8 42.1 1998-10-31
36 RAMÓN Y CAJAL 70.3 77.2 72.9 68.8 56.8 46.3 1998-10-31
39 GLORIETA FDEZ. LADREDA 68 75.8 70.2 64.6 56.8 49.8 1998-10-31
@rinze
rinze / ImagePlusHyp.java
Created July 13, 2012 10:39
ImagePlusHyp class extending ImageJ's ImagePlus.
package jclustering;
import ij.ImagePlus;
/**
* This class extends {@link ImagePlus} in order to add a handy {@link #getTac}
* method that allows to easily grab time-activity curves.
*
* @author <a href="mailto:jmmateos@mce.hggm.es">José María Mateos</a>.
*