sistema_progs

Programas para customizar o meu entorno de traballo nos meus equipos persoais
Log | Files | Refs

pr227-plot.sh (1049B)


      1 #!/usr/bin/env bash
      2 
      3 awk '
      4   BEGIN {
      5     bin_width = 0.0005;
      6     ibin_min = 99999;
      7     ibin_max = 0;
      8     count = 0;
      9   }
     10   $2 == 0.001 {
     11     v = $1;
     12     ibin = int(v / bin_width)
     13     hist[ibin]++;
     14     if (ibin < ibin_min) ibin_min = ibin;
     15     if (ibin > ibin_max) ibin_max = ibin;
     16     count++;
     17   }
     18   END {
     19     for (ibin = ibin_min; ibin <= ibin_max; ibin++) {
     20       center = (ibin + 0.5) * bin_width;
     21       print center, hist[ibin], hist[ibin] / (count * bin_width);
     22     }
     23   }
     24 ' pr227.ci-macos.txt > pr227.sleep0001.hist
     25 
     26 awk '
     27   BEGIN {
     28     bin_width = 0.005;
     29     ibin_min = 99999;
     30     ibin_max = 0;
     31     count = 0;
     32   }
     33   $2 >= 0.020 {
     34     v = $1 - $2;
     35     ibin = int(v / bin_width)
     36     hist[ibin]++;
     37     if (ibin < ibin_min) ibin_min = ibin;
     38     if (ibin > ibin_max) ibin_max = ibin;
     39     count++;
     40   }
     41   END {
     42     for (ibin = ibin_min; ibin <= ibin_max; ibin++) {
     43       center = (ibin + 0.5) * bin_width;
     44       print center, hist[ibin], hist[ibin] / (count * bin_width);
     45     }
     46   }
     47 ' pr227.ci-macos.txt > pr227.sleep0020p.hist
     48 
     49 gnuplot pr227-plot.gp
     50