Ejemplo n.º 1
0
def locs_metrics(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    outfile = ctx.obj["outfile"]
    lm = LocsMetrics(db)
    lm.generate(outfile)
Ejemplo n.º 2
0
def usermetrics(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    um = UserMetrics(db)
    um.generate()
    db.close()
Ejemplo n.º 3
0
def locs_metrics(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    outfile = ctx.obj['outfile']
    lm = LocsMetrics(db)
    lm.generate(outfile)
Ejemplo n.º 4
0
def photodensity(ctx):
    config = ctx.obj["config"]
    db = DB(ctx.obj["dbname"], config)
    db.open()
    pd = PhotoDensity(db)
    pd.generate()
    db.close()
Ejemplo n.º 5
0
def usersamples(ctx):
    dbname = ctx.obj["dbname"]
    infile = ctx.obj["infile"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    us = UserSamples(db, dbname, infile)
    us.generate()
    db.close()
Ejemplo n.º 6
0
def fix_locations(ctx):
    click.echo("Fixing locations")
    config = ctx.obj["config"]
    db = DB(ctx.obj["dbname"], config)
    db.open()
    fixer = FixLocations(db)
    fixer.run()
    db.close()
Ejemplo n.º 7
0
def areas(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    infile = ctx.obj["infile"]
    smooth = ctx.obj["smooth"]
    ar = Areas(db, infile, smooth)
    ar.compute()
Ejemplo n.º 8
0
def clean_locations(ctx):
    click.echo("Cleaning location data")
    db = DB(ctx.obj["dbname"], ctx.obj["config"])
    db.open()
    locs = Locations(db)
    locs.clean()
    db.close()
    click.echo("done.")
Ejemplo n.º 9
0
def retrieve(ctx):
    click.echo("Retrieving Instagram data")
    config = ctx.obj["config"]
    db = DB(ctx.obj["dbname"], config)
    db.open()
    retriever = Retriever(config, db)
    retriever.run()
    db.close()
Ejemplo n.º 10
0
def areas(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    infile = ctx.obj['infile']
    smooth = ctx.obj['smooth']
    ar = Areas(db, infile, smooth)
    ar.compute()
Ejemplo n.º 11
0
def add_locations(ctx):
    country_code = ctx.obj["country_code"]
    click.echo("Adding locations for %s" % country_code)
    db = DB(ctx.obj["dbname"], ctx.obj["config"])
    db.open()
    locs = Locations(db)
    (points, inserted) = locs.add_locations(ctx.obj["locs_file"], country_code)
    db.close()
    click.echo("%d points found, %d points added." % (points, inserted))
Ejemplo n.º 12
0
def crop_rectangle(ctx):
    min_lat = float(ctx.obj["min_lat"])
    min_lng = float(ctx.obj["min_lng"])
    max_lat = float(ctx.obj["max_lat"])
    max_lng = float(ctx.obj["max_lng"])
    db = DB(ctx.obj["dbname"], ctx.obj["config"])
    db.open()
    ghostb.cropdata.crop_rectangle(db, min_lat, min_lng, max_lat, max_lng)
    db.close()
Ejemplo n.º 13
0
def distances(ctx):
    dbname = ctx.obj["dbname"]
    infile = ctx.obj["infile"]
    outfile = ctx.obj["outfile"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    dist = Distances(db)
    dist.compute(infile, outfile)
    db.close()
Ejemplo n.º 14
0
def gen_graph(ctx):
    dbname = ctx.obj["dbname"]
    outfile = ctx.obj["outfile"]
    table = ctx.obj["table"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    gg = GenGraph(db, outfile, table)
    gg.generate()
    db.close()
Ejemplo n.º 15
0
def dists(ctx):
    dbname = ctx.obj["dbname"]
    infile = ctx.obj["infile"]
    outfile = ctx.obj["outfile"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    g = ghostb.graph.read_graph(infile)
    ghostb.graph.write_dists(g, db, outfile)
    db.close()
Ejemplo n.º 16
0
def borders(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    indir = ctx.obj['indir']
    infile = ctx.obj['infile']
    outfile = ctx.obj['outfile']
    smooth = ctx.obj['smooth']
    bs = Borders(db, smooth)
    bs.process(indir, infile, outfile)
Ejemplo n.º 17
0
def scales_usermetrics(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    outdir = ctx.obj["outdir"]
    intervals = int(ctx.obj["intervals"])
    scale_membership = ctx.obj["scale_membership"]

    s = Scales(outdir, intervals)
    s.usermetrics(db, scale_membership)
Ejemplo n.º 18
0
def dist_sequence(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    outdir = ctx.obj["outdir"]
    intervals = int(ctx.obj["intervals"])
    smooth = ctx.obj["smooth"]

    scales = Scales(outdir, intervals)
    scales.dist_sequence(db, smooth)
Ejemplo n.º 19
0
def borders(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    indir = ctx.obj["indir"]
    infile = ctx.obj["infile"]
    outfile = ctx.obj["outfile"]
    smooth = ctx.obj["smooth"]
    bs = Borders(db, smooth)
    bs.process(indir, infile, outfile)
Ejemplo n.º 20
0
def filter_dists(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    infile = ctx.obj["infile"]
    outfile = ctx.obj["outfile"]
    max_dist = float(ctx.obj["max_dist"])
    fd = FilterDists(db)
    fd.filter(infile, outfile, max_dist)
    db.close()
Ejemplo n.º 21
0
def dist_sequence(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    outdir = ctx.obj['outdir']
    intervals = int(ctx.obj['intervals'])
    smooth = ctx.obj['smooth']

    scales = Scales(outdir, intervals)
    scales.dist_sequence(db, smooth)
Ejemplo n.º 22
0
def replace_low_degree(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    infile = ctx.obj["infile"]
    outfile = ctx.obj["outfile"]
    min_degree = float(ctx.obj["min_degree"])
    rld = ReplaceLowDegree(db, infile, min_degree)
    rld.run(outfile)
    db.close()
Ejemplo n.º 23
0
def scales_usermetrics(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    outdir = ctx.obj['outdir']
    intervals = int(ctx.obj['intervals'])
    scale_membership = ctx.obj['scale_membership']

    s = Scales(outdir, intervals)
    s.usermetrics(db, scale_membership)
Ejemplo n.º 24
0
def add_region_grid(ctx):
    region = ctx.obj["region"]
    rows = int(ctx.obj["rows"])
    cols = int(ctx.obj["cols"])
    click.echo("Adding grid of locations for region: %s" % region)
    db = DB(ctx.obj["dbname"], ctx.obj["config"])
    db.open()
    locs = Locations(db)
    locs.add_region_grid(region, rows, cols)
    db.close()
Ejemplo n.º 25
0
def similarity_matrix(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    outdir = ctx.obj['outdir']
    intervals = int(ctx.obj['intervals'])
    smooth = ctx.obj['smooth']
    optimize = ctx.obj['optimize']

    scales = Scales(outdir, intervals)
    scales.similarity_matrix(db, smooth, optimize)
Ejemplo n.º 26
0
def scales_borders(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    outdir = ctx.obj['outdir']
    best = ctx.obj['best']
    smooth = ctx.obj['smooth']
    intervals = int(ctx.obj['intervals'])
    
    scales = Scales(outdir, intervals)
    scales.generate_borders(db, best, smooth)
Ejemplo n.º 27
0
def similarity_matrix(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    outdir = ctx.obj["outdir"]
    intervals = int(ctx.obj["intervals"])
    smooth = ctx.obj["smooth"]
    optimize = ctx.obj["optimize"]

    scales = Scales(outdir, intervals)
    scales.similarity_matrix(db, smooth, optimize)
Ejemplo n.º 28
0
def scales_graphs(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    outdir = ctx.obj['outdir']
    intervals = int(ctx.obj['intervals'])
    scale = ctx.obj['scale']
    table = ctx.obj['table']
    
    scales = Scales(outdir, intervals)
    scales.generate_graphs(db, scale, table)
Ejemplo n.º 29
0
def userscales(ctx):
    dbname = ctx.obj["dbname"]
    infile = ctx.obj["infile"]
    outfile = ctx.obj["outfile"]
    scales = ctx.obj["scales"]
    table = ctx.obj["table"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    us = UserScales(db, outfile, infile, scales, table)
    us.generate()
    db.close()
Ejemplo n.º 30
0
def scales_borders(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    outdir = ctx.obj["outdir"]
    best = ctx.obj["best"]
    smooth = ctx.obj["smooth"]
    intervals = int(ctx.obj["intervals"])

    scales = Scales(outdir, intervals)
    scales.generate_borders(db, best, smooth)
Ejemplo n.º 31
0
def scales_graphs(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    outdir = ctx.obj["outdir"]
    intervals = int(ctx.obj["intervals"])
    scale = ctx.obj["scale"]
    table = ctx.obj["table"]

    scales = Scales(outdir, intervals)
    scales.generate_graphs(db, scale, table)
Ejemplo n.º 32
0
def add_area(ctx):
    min_lat = float(ctx.obj["min_lat"])
    min_lng = float(ctx.obj["min_lng"])
    max_lat = float(ctx.obj["max_lat"])
    max_lng = float(ctx.obj["max_lng"])
    click.echo("Adding locations in area: [%s, %s, %s, %s]" % (min_lat, min_lng, max_lat, max_lng))
    db = DB(ctx.obj["dbname"], ctx.obj["config"])
    db.open()
    locs = Locations(db)
    (points, inserted) = locs.add_area(ctx.obj["locs_file"], min_lat, min_lng, max_lat, max_lng)
    db.close()
    click.echo("%d points found, %d points added." % (points, inserted))
Ejemplo n.º 33
0
def scales_multi_borders(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    outdir = ctx.obj["outdir"]
    outfile = ctx.obj["outfile"]
    smooth = ctx.obj["smooth"]
    intervals = int(ctx.obj["intervals"])
    scales = ctx.obj["scales"]

    s = Scales(outdir, intervals)
    s.generate_multi_borders(db, outfile, smooth, scales)
Ejemplo n.º 34
0
def scales_multi_borders(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    outdir = ctx.obj['outdir']
    outfile = ctx.obj['outfile']
    smooth = ctx.obj['smooth']
    intervals = int(ctx.obj['intervals'])
    scales = ctx.obj['scales']

    s = Scales(outdir, intervals)
    s.generate_multi_borders(db, outfile, smooth, scales)
Ejemplo n.º 35
0
def add_grid(ctx):
    min_lat = float(ctx.obj["min_lat"])
    min_lng = float(ctx.obj["min_lng"])
    max_lat = float(ctx.obj["max_lat"])
    max_lng = float(ctx.obj["max_lng"])
    rows = int(ctx.obj["rows"])
    cols = int(ctx.obj["cols"])
    click.echo("Adding grid of locations for area: [%s, %s, %s, %s]" % (min_lat, min_lng, max_lat, max_lng))
    db = DB(ctx.obj["dbname"], ctx.obj["config"])
    db.open()
    locs = Locations(db)
    locs.add_grid(min_lat, min_lng, max_lat, max_lng, rows, cols)
    db.close()
Ejemplo n.º 36
0
def scales_metric(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    outdir = ctx.obj['outdir']
    best = ctx.obj['best']
    intervals = int(ctx.obj['intervals'])
    smooth = ctx.obj['smooth']
    scale = ctx.obj['scale']
    metric = ctx.obj['metric']

    scales = Scales(outdir, intervals)
    scales.metric(metric, db, best, smooth, scale)
Ejemplo n.º 37
0
def scales_metric(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    outdir = ctx.obj["outdir"]
    best = ctx.obj["best"]
    intervals = int(ctx.obj["intervals"])
    smooth = ctx.obj["smooth"]
    scale = ctx.obj["scale"]
    metric = ctx.obj["metric"]

    scales = Scales(outdir, intervals)
    scales.metric(metric, db, best, smooth, scale)
Ejemplo n.º 38
0
def usermetrics(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    um = UserMetrics(db)
    um.generate()
    db.close()
Ejemplo n.º 39
0
def photodensity(ctx):
    config = ctx.obj['config']
    db = DB(ctx.obj['dbname'], config)
    db.open()
    pd = PhotoDensity(db)
    pd.generate()
    db.close()
Ejemplo n.º 40
0
def json_export(ctx):
    dbname = ctx.obj['dbname']
    outfile = ctx.obj['outfile']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    je = JsonExport(db, outfile)
    je.export()
    db.close()
Ejemplo n.º 41
0
def clean_locations(ctx):
    click.echo('Cleaning location data')
    db = DB(ctx.obj['dbname'], ctx.obj['config'])
    db.open()
    locs = Locations(db)
    locs.clean()
    db.close()
    click.echo('done.')
Ejemplo n.º 42
0
def retrieve(ctx):
    click.echo('Retrieving Instagram data')
    config = ctx.obj['config']
    db = DB(ctx.obj['dbname'], config)
    db.open()
    retriever = Retriever(config, db)
    retriever.run()
    db.close()
Ejemplo n.º 43
0
def fix_locations(ctx):
    click.echo('Fixing locations')
    config = ctx.obj['config']
    db = DB(ctx.obj['dbname'], config)
    db.open()
    fixer = FixLocations(db)
    fixer.run()
    db.close()
Ejemplo n.º 44
0
def usersamples(ctx):
    dbname = ctx.obj['dbname']
    infile = ctx.obj['infile']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    us = UserSamples(db, dbname, infile)
    us.generate()
    db.close()
Ejemplo n.º 45
0
def import_locations(ctx):
    infile = ctx.obj['infile']
    click.echo('Importing locations from %s' % infile)
    db = DB(ctx.obj['dbname'], ctx.obj['config'])
    db.open()
    locs = Locations(db)
    (points, inserted) = locs.import_locations(infile)
    db.close()
    click.echo('%d points found, %d points added.' % (points, inserted))
Ejemplo n.º 46
0
def crop_rectangle(ctx):
    min_lat = float(ctx.obj['min_lat'])
    min_lng = float(ctx.obj['min_lng'])
    max_lat = float(ctx.obj['max_lat'])
    max_lng = float(ctx.obj['max_lng'])
    db = DB(ctx.obj['dbname'], ctx.obj['config'])
    db.open()
    ghostb.cropdata.crop_rectangle(db, min_lat, min_lng, max_lat, max_lng)
    db.close()
Ejemplo n.º 47
0
def dists(ctx):
    dbname = ctx.obj['dbname']
    infile = ctx.obj['infile']
    outfile = ctx.obj['outfile']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    g = ghostb.graph.read_graph(infile)
    ghostb.graph.write_dists(g, db, outfile)
    db.close()
Ejemplo n.º 48
0
def distances(ctx):
    dbname = ctx.obj['dbname']
    infile = ctx.obj['infile']
    outfile = ctx.obj['outfile']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    dist = Distances(db)
    dist.compute(infile, outfile)
    db.close()
Ejemplo n.º 49
0
def gen_graph(ctx):
    dbname = ctx.obj['dbname']
    outfile = ctx.obj['outfile']
    table = ctx.obj['table']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    gg = GenGraph(db, outfile, table)
    gg.generate()
    db.close()
Ejemplo n.º 50
0
def add_locations(ctx):
    country_code = ctx.obj['country_code']
    click.echo('Adding locations for %s' % country_code)
    db = DB(ctx.obj['dbname'], ctx.obj['config'])
    db.open()
    locs = Locations(db)
    (points, inserted) = locs.add_locations(ctx.obj['locs_file'], country_code)
    db.close()
    click.echo('%d points found, %d points added.' % (points, inserted))
Ejemplo n.º 51
0
def filter_dists(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    infile = ctx.obj['infile']
    outfile = ctx.obj['outfile']
    max_dist = float(ctx.obj['max_dist'])
    fd = FilterDists(db)
    fd.filter(infile, outfile, max_dist)
    db.close()
Ejemplo n.º 52
0
def add_region_grid(ctx):
    region = ctx.obj['region']
    rows = int(ctx.obj['rows'])
    cols = int(ctx.obj['cols'])
    click.echo('Adding grid of locations for region: %s' % region)
    db = DB(ctx.obj['dbname'], ctx.obj['config'])
    db.open()
    locs = Locations(db)
    locs.add_region_grid(region, rows, cols)
    db.close()
Ejemplo n.º 53
0
def replace_low_degree(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    infile = ctx.obj['infile']
    outfile = ctx.obj['outfile']
    min_degree = float(ctx.obj['min_degree'])
    rld = ReplaceLowDegree(db, infile, min_degree)
    rld.run(outfile)
    db.close()
Ejemplo n.º 54
0
def userscales(ctx):
    dbname = ctx.obj['dbname']
    infile = ctx.obj['infile']
    outfile = ctx.obj['outfile']
    scales = ctx.obj['scales']
    table = ctx.obj['table']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    us = UserScales(db, outfile, infile, scales, table)
    us.generate()
    db.close()
Ejemplo n.º 55
0
def cropgraph(ctx):
    infile = ctx.obj['infile']
    outfile = ctx.obj['outfile']
    min_lat = float(ctx.obj['min_lat'])
    min_lng = float(ctx.obj['min_lng'])
    max_lat = float(ctx.obj['max_lat'])
    max_lng = float(ctx.obj['max_lng'])
    db = DB(ctx.obj['dbname'], ctx.obj['config'])
    db.open()
    cg = CropGraph(db)
    cg.crop(infile, outfile, min_lat, min_lng, max_lat, max_lng)
    db.close()
Ejemplo n.º 56
0
def add_area(ctx):
    min_lat = float(ctx.obj['min_lat'])
    min_lng = float(ctx.obj['min_lng'])
    max_lat = float(ctx.obj['max_lat'])
    max_lng = float(ctx.obj['max_lng'])
    click.echo('Adding locations in area: [%s, %s, %s, %s]' % (min_lat, min_lng, max_lat, max_lng))
    db = DB(ctx.obj['dbname'], ctx.obj['config'])
    db.open()
    locs = Locations(db)
    (points, inserted) = locs.add_area(ctx.obj['locs_file'],
                                       min_lat, min_lng, max_lat, max_lng)
    db.close()
    click.echo('%d points found, %d points added.' % (points, inserted))
Ejemplo n.º 57
0
def add_grid(ctx):
    min_lat = float(ctx.obj['min_lat'])
    min_lng = float(ctx.obj['min_lng'])
    max_lat = float(ctx.obj['max_lat'])
    max_lng = float(ctx.obj['max_lng'])
    rows = int(ctx.obj['rows'])
    cols = int(ctx.obj['cols'])
    click.echo('Adding grid of locations for area: [%s, %s, %s, %s]' % (min_lat, min_lng, max_lat, max_lng))
    db = DB(ctx.obj['dbname'], ctx.obj['config'])
    db.open()
    locs = Locations(db)
    locs.add_grid(min_lat, min_lng, max_lat, max_lng, rows, cols)
    db.close()
Ejemplo n.º 58
0
def create_db(ctx):
    click.echo("Creating database")
    db = DB(ctx.obj["dbname"], ctx.obj["config"])
    db.create_db()
    db.close()
Ejemplo n.º 59
0
def crop_region(ctx):
    region = ctx.obj["region"]
    db = DB(ctx.obj["dbname"], ctx.obj["config"])
    db.open()
    ghostb.cropdata.crop_region(db, region)
    db.close()
Ejemplo n.º 60
0
def locphotos(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    lp = LocPhotos(db)
    lp.update()