This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%Generate neighbors and relations matrix for each MSA | |
%system(rename msa*.mat msa.mat); | |
%filename=strcat('\nsf\usr\S\sjaffe\Work\Segregation\Matlab\msa', str2int(job_instance)) | |
missing=importdata('/nfs/home/S/sjaffe/Work/Segregation/Matlab/missing.txt'); | |
%16 34 | |
path(path, '/nfs/projects_nobackup/s/sjaffe') | |
path(path, '/nfs/home/S/sjaffe/Work/Segregation/Matlab') | |
cd '/nfs/projects_nobackup/s/sjaffe' | |
for file_num=10:52 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%d=6378.1*acos(sin(2*pi*lat(i)/360)*sin(2*pi*lat(j)/360)+cos(2*pi*(lng(i)-lng(j))/360)*cos(2*pi*lat(i)/360)*cos(2*pi*lat(j)/360)); | |
tic | |
N = 4000; | |
% test some distances | |
lat = rand(N,1)*180; | |
lng = rand(N,1)*180; | |
% the loopy way | |
d = zeros(N); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hsb2 <- read.table('http://www.ats.ucla.edu/stat/R/faq/hsb2.csv', header=T, sep=",") | |
attach(hsb2) | |
sesmeans <- tapply(math, ses, mean) | |
femaleses = tapply(math, list(as.factor(ses), as.factor(female)), mean) | |
bp <- barplot(femaleses, beside = TRUE, main = "Math by SES and gender", | |
col = c("lightblue", "mistyrose", "lavender"), | |
xlab = "Gender", names = c("Male", "Female"), | |
ylab = "Mean Math Score", legend = c("Low", "Medium", "High"), | |
args.legend = list(title = "SES", x = "topright", cex = .7), ylim = c(0, 90)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function h = plotDecision(dprime,sdnoise,criterion) | |
% h = plotDecision(dprime, sdnoise, criterion) | |
% | |
% plotDecision makes a plot of two Gaussian functions, inspired by signal | |
% detection theory. The inputs are given in terms of standard deviates of | |
% the signal distribution: | |
% | |
% dprime - d', the distance between the means of the Gaussians | |
% sdnoise - $\sigma$, the ratio of the standard deviation of the noise to | |
% the standard deviation of the signal. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fnmatch | |
import os | |
import shutil | |
import re | |
for file in os.listdir('.'): | |
flist = os.path.basename(file).split('.') | |
fname = flist[0] | |
fext = '.blah' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% labelImages(impath) | |
% --------------------------------------- | |
% Places labels on an image, and saves the marker locations and a 3x3 | |
% square pixel neighborhood of RGB values. | |
% | |
% Usage: | |
% labelImages('/Users/astorer/Desktop/test.jpg') | |
% LEFT CLICK - Add a point | |
% RIGHT CLICK - Delete a point | |
% 's' - Save progress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lxml import etree | |
import csv | |
import urllib2 | |
import urllib | |
import re | |
def downloadallarticles(tree,year): | |
articles = tree.xpath('.//*[@id="middle2level"]/table[2]//a') | |
destpath = '/Users/astorer/Work/sgrossman/output/' | |
for a in articles: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
num_statements = 5; | |
num_blocks = 9; | |
for run = 1:8 | |
% 150 statements, 50 of each type | |
physical_order = Shuffle(1:50); | |
mental_order = Shuffle(1:50); | |
emotional_order = Shuffle(1:50); | |
physical_num = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Universe = vanilla | |
Executable = /usr/local/bin/matlab | |
Arguments = -nodisplay -r \"addpath('/nfs/home/A/astorer/Work/dchan'); | |
test($(Process))\" | |
when_to_transfer_output = ON_EXIT_OR_EVICT | |
transfer_output_files = out.$(PROCESS) | |
input = | |
output = out.$(Process) | |
error = error.$(Process) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# open the files in the directory, parse them and get the text. | |
#eg.text_content() | |
import glob | |
from lxml import etree | |
import lxml.html | |
import csv | |
import urllib2 |
OlderNewer