Created
November 23, 2018 19:29
-
-
Save alexshpilkin/9f7d6c8b838043934d81c22f040535b9 to your computer and use it in GitHub Desktop.
Blocked fraction as function of domain length
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
#!/usr/bin/octave | |
pkg load image; | |
pkg load statistics; | |
pop = load("ru.hist"); | |
obs = load("backorder.hist"); | |
obs = padarray(obs, max(0, size(pop)-size(obs)), "post"); | |
[_ var] = binostat(pop, obs./pop); | |
errorbar(obs./pop, sqrt(var)./pop, "xk"); | |
xlabel("Domain length"); | |
ylabel("Blocked fraction"); | |
ylim([0 0.01]); | |
printf("png... "); print -dpng "-S1200,600" blocked.png; | |
printf("svg... "); print -dsvg "-S1200,600" blocked.svg; | |
printf("done\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
#!/bin/awk -f | |
BEGIN { | |
maxlen = 0; | |
} | |
{ | |
hist[length($1)]++ | |
if (maxlen < length($1)) maxlen = length($1) | |
} | |
END { | |
for (i = 1; i <= maxlen; i++) { hist[i] += 0; print hist[i]; } | |
} |
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
.PHONY: all clean | |
all: blocked.png blocked.svg | |
clean: | |
rm -f backorder.hist ru.hist blocked.png blocked.svg | |
blocked.png blocked.svg: blocked ru.hist backorder.hist | |
./$< | |
backorder.hist: backorder.csv hist | |
tail +2 $< | cut -d';' -f1 | \ | |
sed -Ene 's/^([-0-9A-Za-z]*)\.ru/\1/p' | \ | |
tr A-Z a-z | uniq | ./hist >$@ | |
ru.hist: ru.zone.txt.xz hist | |
pv $< | xzcat | \ | |
sed -Ene 's/^([-0-9A-Za-z]*)\.[Rr][Uu]\.\s+[0-9]+\s+IN.*/\1/p' | \ | |
tr A-Z a-z | uniq | ./hist >$@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment