def main(): (school_name, RequestHandler.scores) = ecdf.parseArguments() # argument parsing: ecdf.py --school "name" input_file1 input_file2 ... with open ("template.html", "r") as template: RequestHandler.html = template.read() RequestHandler.logger = logging.getLogger('RequestHandler') hdlr = logging.FileHandler('request_history.log') formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') hdlr.setFormatter(formatter) RequestHandler.logger.addHandler(hdlr) RequestHandler.logger.setLevel(logging.INFO) httpd = HTTPServer((ADDR, PORT), RequestHandler) try: httpd.serve_forever() except KeyboardInterrupt: sys.exit()
import numpy import statsmodels import matplotlib.pyplot as plt import ecdf import sys (school_name, scores) = ecdf.parseArguments() e = statsmodels.distributions.empirical_distribution.ECDF(scores) # X = numpy.linspace(min(scores), max(scores)) # print X # y = ecdf(x) # plt.step(x, y) X = numpy.arange(0, 100, 0.1) Y = e(X) fig = plt.figure() plt.step(X, Y) fig.suptitle(school_name, fontsize=14, fontweight='bold') plt.xlabel('mean test score') plt.ylabel('ECDF') plt.show()