Example #1
0
    def MockCallBacks(self):
        df = pd.read_csv('data/CrossValidationData.csv')
        df.columns = ['x', 'y', 'z', 'id', 'is_building', 'label']

        deleteIndex = df[df['is_building'] == 0]['id']
        labels = df[df['is_building'] == 1][['id', 'label']]

        # The prune model
        sd = Methods()
        df = sd.splitCallBack(labels, 'lidar_sf__1')
        sd.hullCallBack(df, 'lidar_sf__1')
        sd.deleteCallBack(df, 'lidar_sf__1')
        sd.deleteCallBack(deleteIndex, 'lidar_sf__1')
Example #2
0
    def __init__(self,
                 database='building',
                 User='******',
                 host='localhost',
                 projection=4326,
                 transform_to=None):
        # If the dataset is not in metric units, transform projection
        self.transform_to = transform_to

        # file uploads
        self.upload = pgDataLoader(database=database,
                                   User=User,
                                   host=host,
                                   projection=projection)

        # methods to cal to server
        self.methods = Methods(database=database,
                               User=User,
                               host=host,
                               projection=projection)

        # Reset storage tables
        self.methods.tableSetUp(transform_to=transform_to)
Example #3
0
        lambda x: len(x) <= second_layer_screen or len(x) >= 10000)
    not_blds.reset_index(inplace=True)

    # Recluster buildings in only x-y to negate the effects of funny-shaped rooves.
    db = DBSCAN(eps=eps, min_samples=min_samples).fit(blds[['x',
                                                            'y']].as_matrix())
    blds = pd.DataFrame([blds.id, db.labels_]).T
    blds.columns = ['id', 'label']
    blds['id'] = blds['id'].astype(int)

    # Is as building: id, label
    # Not a building: id
    return blds, not_blds['id']


if __name__ == '__main__':
    import os
    from pgMethods import Methods
    m = Methods(projection=32610)
    df = m.pg_df('SELECT x, y, z, id FROM lidar_nyc_small')

    print 'df loaded'
    #df = pd.read_csv('../tests/data/CrossValidationData.csv')
    blds, not_blds = dbscan(df)

    m.df_pg(blds, 'temp12345678')
    m.pg_post(
        'DROP TABLE IF EXISTS checkcheck; CREATE TABLE checkcheck AS SELECT a.* FROM z_20130805_usgsnyc14_18TWL835075 a RIGHT JOIN temp12345678 b ON a.id=b.id;'
    )
    m.pg_post('DROP TABLE temp12345678;')
Example #4
0
 def MockPartition(self, split=6):
     sd = Methods(projection=32610)
     sd.partionSpace('lidar_sf', split=split)