Exemplo n.º 1
0
    pylab.yticks(np.arange(0, yres, yaxis_res), y_labels)
    pylab.xticks(rotation=90)
    pylab.xlim(0, xres)
    pylab.ylim(yres, 0)
    pylab.xlabel('x')
    pylab.ylabel('y')
    ax = pylab.colorbar()
    ax.set_label('Iterations till divergence')
    pylab.draw()


#########################
#         DRIVER        #
#########################
if __name__ == '__main__':
    log.setLevel('INFO')  # Set the logging level
    # Report basic system info
    log.out.info("Python version: " + sys.version)

    # TEST
    plot_mandelbot(xmin=-2.25,
                   xmax=0.75,
                   xres=300,
                   ymin=-1.25,
                   ymax=1.25,
                   yres=250,
                   maxiter=250,
                   horizon=2.0**40)

    # plot_mandelbot(xmin=-0.35, xmax=0.10, xres=6000,
    #                ymin=-1.12, ymax=-0.63, yres=6000,
    ]
    master_dict = {}

    for this_year in range(year_start, year_end + 1):
        log.out.info("Requesting year: " + str(this_year))
        this_years_data = request_v3_by_year(this_year, keys=keys_wanted)
        for movie_dict in this_years_data:
            master_dict[movie_dict["id"]] = {}
            master_dict[movie_dict["id"]]["year"] = this_year
            for key in keys_wanted:
                master_dict[movie_dict["id"]][key] = movie_dict[key]
        # Overwrite temp file with new data
        pathname, filename = os.path.split(output_json)
        write_json_from_dict(master_dict,
                             filepath=pathname,
                             filename=filename + '.tmp',
                             overwrite=True)
    # Write final data
    pathname, filename = os.path.split(output_json)
    write_json_from_dict(master_dict,
                         filepath=pathname,
                         filename=filename,
                         overwrite=True)


if __name__ == '__main__':
    log.setLevel("INFO")
    read_api_keys(API_FILE)
    tmdb.API_KEY = API_V3_KEY
    movie_data_to_json("./movie_info.json", year_start=1950, year_end=2017)