conference_footprint

compute the CO2 footprint of an academic conference
git clone https://a3nm.net/git/conference_footprint/
Log | Files | Refs

addnoise.py (303B)


      1 #!/usr/bin/env python3
      2 
      3 import sys
      4 from random import uniform
      5 
      6 noise = float(sys.argv[1])
      7 
      8 for l in sys.stdin.readlines():
      9     f = l.strip().split(',')
     10     mode = f[0]
     11     dist = float(f[3])
     12     dist_anon = round(uniform(dist * (1-noise), dist * (1+noise)))
     13     print(','.join((mode, str(dist_anon))))
     14