Output boxplot-able data
parent
c1824e6297
commit
ae7884c354
|
@ -4,4 +4,4 @@ scan*.bin
|
|||
scan*.json
|
||||
latency.json
|
||||
country.json
|
||||
country.csv
|
||||
boxplot.csv
|
||||
|
|
|
@ -53,7 +53,7 @@ go run country.go -in latency.json -db iptocountry -out country.json
|
|||
I will start with a simple plot of latency to every country from Singapore.
|
||||
|
||||
```
|
||||
go run json2csv.go -in country.json -out country.csv
|
||||
go run boxplot.go -in country.json -out boxplot.csv
|
||||
```
|
||||
|
||||
##
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"encoding/csv"
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"gonum.org/v1/gonum/stat"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"sort"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
var flagIn = flag.String("in", "", "input file")
|
||||
var flagOut = flag.String("out", "boxplot.csv", "output file")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
in := *flagIn
|
||||
out := *flagOut
|
||||
|
||||
data := make(map[string][]float64, 0)
|
||||
|
||||
log.Println("Reading file " + in)
|
||||
raw, err := ioutil.ReadFile(in)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
log.Println("Parsing file " + in)
|
||||
err = json.Unmarshal(raw, &data)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
log.Println("File " + in + " read successfully")
|
||||
|
||||
log.Println("Computing params")
|
||||
odata := make([][]string, 0)
|
||||
for cc, ttls := range data {
|
||||
sort.Float64s(ttls)
|
||||
min := stat.Quantile(0.00, stat.Empirical, ttls, nil)
|
||||
q1 := stat.Quantile(0.25, stat.Empirical, ttls, nil)
|
||||
median := stat.Quantile(0.50, stat.Empirical, ttls, nil)
|
||||
q3 := stat.Quantile(0.75, stat.Empirical, ttls, nil)
|
||||
max := stat.Quantile(1.00, stat.Empirical, ttls, nil)
|
||||
odata = append(odata, []string{
|
||||
cc,
|
||||
strconv.Itoa(len(ttls)),
|
||||
strconv.FormatFloat(min, 'f', -1, 64),
|
||||
strconv.FormatFloat(q1, 'f', -1, 64),
|
||||
strconv.FormatFloat(median, 'f', -1, 64),
|
||||
strconv.FormatFloat(q3, 'f', -1, 64),
|
||||
strconv.FormatFloat(max, 'f', -1, 64),
|
||||
})
|
||||
}
|
||||
|
||||
log.Println("Creating file " + out)
|
||||
outFile, err := os.Create(out)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
log.Println("Encoding csv")
|
||||
w := csv.NewWriter(outFile)
|
||||
err = w.WriteAll(odata)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
|
@ -105,6 +105,10 @@ func main() {
|
|||
odata := make(map[string][]int, 0)
|
||||
j := 0
|
||||
for ip, ttl := range data {
|
||||
if rand.Intn(100) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
for geo[j].End <= ip {
|
||||
j += 1
|
||||
}
|
||||
|
@ -115,9 +119,7 @@ func main() {
|
|||
}
|
||||
cc := geo[j].CC
|
||||
|
||||
if rand.Intn(100) == 0 {
|
||||
odata[cc] = append(odata[cc], ttl)
|
||||
}
|
||||
odata[cc] = append(odata[cc], ttl)
|
||||
}
|
||||
|
||||
total := 0
|
||||
|
|
68
poster.svg
68
poster.svg
|
@ -247,17 +247,17 @@
|
|||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.64"
|
||||
inkscape:cx="1853.3374"
|
||||
inkscape:cy="3388.8728"
|
||||
inkscape:zoom="0.22627417"
|
||||
inkscape:cx="1775.0712"
|
||||
inkscape:cy="1687.1479"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1432"
|
||||
inkscape:window-height="855"
|
||||
inkscape:window-x="4"
|
||||
inkscape:window-width="1440"
|
||||
inkscape:window-height="856"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:window-maximized="1"
|
||||
showguides="true"
|
||||
inkscape:guide-bbox="true">
|
||||
<sodipodi:guide
|
||||
|
@ -353,35 +353,59 @@
|
|||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara6588" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara6590">A good overview of the data is the following chart of the top 5 countries with the lowest latency:</flowPara><flowPara
|
||||
id="flowPara7633">For the purposes of this poster, we will compare the latencies from Singapore to South Korea and the latencies from Singapore to China.</flowPara><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara6592" /><flowPara
|
||||
id="flowPara7635" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara6594" /><flowPara
|
||||
id="flowPara7637" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara6596" /><flowPara
|
||||
id="flowPara7641" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara6598" /><flowPara
|
||||
id="flowPara7643" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara6600" /><flowPara
|
||||
id="flowPara7645" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara6602" /><flowPara
|
||||
id="flowPara7647" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara6604" /><flowPara
|
||||
id="flowPara7649" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara6606" /><flowPara
|
||||
id="flowPara7651" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara6608" /><flowPara
|
||||
id="flowPara7653" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara6610" /><flowPara
|
||||
id="flowPara7655" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara6612" /><flowPara
|
||||
id="flowPara7657" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara6614" /><flowPara
|
||||
id="flowPara7659" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara6616" /><flowPara
|
||||
id="flowPara7661" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara6618">From that data, we can perform a 2-sample t-test on the latency data to USA and the UK. </flowPara><flowPara
|
||||
id="flowPara7663" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara7665" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara7639" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara7625">From that data, we can perform a 2-sample t-test on the latency data to South Korea and China. </flowPara><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara7667" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara7669" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara7671" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara7673" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara7675" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara7677" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara7679" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara7681" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara7683" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
id="flowPara6620" /><flowPara
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.00000381px;line-height:129.99999523%;font-family:'Inter UI';-inkscape-font-specification:'Inter UI';text-align:start;text-anchor:start"
|
||||
|
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 36 KiB |
Loading…
Reference in New Issue