Citation Author(s):
Rakesh
Singh
Submitted by:
Rakesh Singh
Last updated:
Mon, 03/21/2022 - 04:36
DOI:
10.21227/v3wq-0s51
Data Format:
64 Views
Categories:
Keywords:

Abstract

Dataset haiving the curvature and spline values for the roundabout

Instructions:

1. use java program to analyse the data

2. use python program for vizualization

sample Java program

`public class AnalysisByRadius {    public static void main(String args[]) throws IOException {        Class clazz = Analysis.class;        DecimalFormat df = new DecimalFormat();        df.setMaximumFractionDigits(2);        //System.out.println( clazz.getResourceAsStream("/resultsWEU/result.txt").available());InputStream inputStream = clazz.getResourceAsStream("/resultsWEU/result.txt");        String data = readFromInputStream(inputStream);        System.out.println(data);        String[] finaldata = data.split("\n");        HashMap<Character,Double> ratioMap = new HashMap<>();        HashMap<Character,Integer> numberMap = new HashMap<>();        for(int i=2;i<finaldata.length;){            Integer roundaboutnumber=Integer.parseInt(finaldata[i].split(",")[2]);            String admin= finaldata[i].split(",")[0];            for(int j=i+1;j<i+1+roundaboutnumber;j++){                System.out.println(finaldata[j]);                String[] splitresult= finaldata[j].split(",");                Double lowerValue=Double.parseDouble(splitresult[1])+10;                Double ratioValue=Double.parseDouble(splitresult[3]);                Character select='Z';                if(lowerValue<=30){                    select='A';                }else if(lowerValue<=40){                    select='B';                }else if(lowerValue<=50){                    select='C';                }else if(lowerValue<=60){                    select='D';                }else if(lowerValue<=70){                    select='E';                }else if(lowerValue>70){                    select='F';                }                if(ratioMap.containsKey(select)) {                    ratioMap.put(select, ratioMap.get(select) + ratioValue);                    numberMap.put(select,numberMap.get(select)+1);                }                else{                    ratioMap.put(select,ratioValue);                    numberMap.put(select,1);                }            }            i+=roundaboutnumber+1;            i++;        }        System.out.println( ratioMap.size());        int totalNumberRoundabout=0;        for(Character c : ratioMap.keySet()){            System.out.println(ratioMap.get(c)+"......"+numberMap.get(c));            totalNumberRoundabout+=numberMap.get(c);        }        System.out.println("total cases --->"+totalNumberRoundabout);    }    private static String readFromInputStream(InputStream inputStream)            throws IOException {        StringBuilder resultStringBuilder = new StringBuilder();        try (BufferedReader br                     = new BufferedReader(new InputStreamReader(inputStream))) {            String line;            while ((line = br.readLine()) != null) {                resultStringBuilder.append(line).append("\n");            }        }        return resultStringBuilder.toString();    }}sample python program`
`import plotly.graph_objects as golabels = ['arcLength <= 50','arcLength <= 80','arcLength <= 110','arcLength <= 140','arcLength <= 170','arcLength <= 200','arcLength > 200']values = [106, 466, 454, 165, 39, 18, 39]fig = go.Figure(data=[go.Pie(labels=labels, values=values)])fig.show()----------------------------------`
`# Librariesimport numpy as npimport matplotlib.pyplot as plt# Make a random dataset:#height = [98.0,89.0,88.0,79.0,100.0,83.0,100.0,94.0,82.0,100.0,97.0,100.0,94.0,94.0,96.0,100.0,100.0,100.0,100.0,94.0,81.0,87.0,67.0,100.0,95.0,97.0,88.0,98.0,100.0,87.0,98.0,100.0,89.0,91.0,85.0,82.0,77.0,92.0,94.0,100.0,84.0,96.0,78.0,67.0,73.0,87.0,100.0,89.0,100.0,100.0,67.0,100.0,83.0,100.0,100.0,65.0,97.0,91.0,62.0,100.0,100.0,99.0,99.0,83.0,95.0,78.0,84.0,96.0,85.0,79.0,81.0,86.0,60.0,73.0,91.0,90.0,86.0,93.0,92.0,81.0,75.0,90.0,100.0,95.0,76.0,96.0,86.0,93.0,100.0,77.0,91.0,81.0,97.0,90.0,93.0,89.0,89.0,87.0]height=[98.0,89.0,88.0,79.0,100.0,83.0,100.0,94.0,82.0,100.0,97.0,100.0,94.0,94.0,96.0,100.0,100.0]#bars = ('Baden','Eisenstadt','Weiz','Liezen','Güssing','Jennersdorf','Kirchdorf Krems','Spittal Drau','Voitsberg','Steyr','Bruck Leitha','Reutte','Mödling','Hollabrunn','Oberpullendorf','Grieskirchen','Sankt Pölten')#bars=('Malacky','Námestovo','Pezinok','Liptovský Mikuláš','Zlaté Moravce','Trenčín','Žiar nad Hronom','Nové Mesto nad Váhom','Spišská Nová Ves','Krupina','Trebišov','Bardejov','Čadca','Dunajská Streda','Myjava','Banská Štiavnica','Senica','Tvrdošín','Hlohovec','Zvolen','Banská Bystrica','Košice','Levoča','Veľký Krtíš','Svidník','Komárno','Skalica','Bytča','Kežmarok','Louny','Prievidza','Žarnovica','Púchov','Žilina','Nitra','Martin','Michalovce','Trnava','Piešťany','Medzilaborce','Sabinov','Detva','Ilava','Humenné','Revúca','Bratislava','Vranov nad Topľou','Senec','Dolný Kubín','Partizánske','Topoľčany','Ružomberok','Bánovce nad Bebravou','Lučenec','Šaľa','Prešov','Levice','Poprad','Košice-Okolie','Rožňava','Stará Ľubovňa','Rimavská Sobota','Brezno','Považská Bystrica','Nové Zámky','Galanta','Snina','Blansko','Karlovy Vary','Příbram','Liberec','Praha-východ','Tábor','Přerov','Olomouc','Cheb','Plzeň-jih','Benešov','Česká Lípa','Rychnov nad Kněžnou','Děčín','Rakovník','Bruntál','Litoměřice','Beroun','Kroměříž','Brno-venkov','Prachatice','Rokycany','Plzeň-sever','Kolín','České Budějovice','Břeclav','Brno-město','Tachov','Šumperk','Mělník','Frýdek-Místek')bars=('Malacky','Námestovo','Pezinok','Liptovský Mikuláš','Zlaté Moravce','Trenčín','Žiar nad Hronom','Nové  Váhom','Spišská Nová Ves','Krupina','Trebišov','Bardejov','Čadca','Dunajská Streda','Myjava','Banská Štiavnica','Senica')y_pos = np.arange(len(bars))# Create barsplt.bar(y_pos, height)plt.xlabel("Admins");plt.ylabel("Valid Ranges")# Create names on the x-axisplt.xticks(y_pos, bars,rotation=80)# Show graphicplt.show()`