Creating test data set


In [ ]:
from planet4 import io
dbname = io.get_current_database_fname()
dbname

In [ ]:
db = io.DBManager()
p4ids = db.image_ids
p4ids[0]

In [ ]:
data = db.get_image_id_markings(p4ids[1])

In [ ]:
%matplotlib notebook

In [ ]:
from planet4 import markings
p4id_data = markings.ImageID(p4ids[1])

In [ ]:
p4id_data.plot_all()

In [ ]:
from planet4.clustering import DBScanner

In [ ]:
from planet4.dbscan import DBScanner

In [ ]:
reduced_fans = DBScanner(p4id_data.get_fans(), kind='fan',
                         scope='hirise').reduced_data
fans_data = [cluster.data for cluster in reduced_fans]
p4id_data.plot_fans(fans=pd.DataFrame(fans_data))
for fan in reduced_fans:
    fan.add_midpoint_pointer(plt.gca())

In [ ]:
reduced_blotches = DBScanner(p4id_data.get_blotches(), kind='blotch',
                             scope='hirise').reduced_data
blotches_data = [cluster.data for cluster in reduced_blotches]
fig, ax = plt.subplots()
p4id_data.plot_blotches(blotches=pd.DataFrame(blotches_data), ax=ax)
p4id_data.plot_fans(fans=pd.DataFrame(fans_data), ax=ax)
for fan in reduced_fans:
    fan.add_midpoint_pointer(plt.gca())

In [ ]:
from numpy.linalg import norm
for blotch in reduced_blotches:
    print(blotch.center)
    for fan in reduced_fans:
        fancoord = fan.base + fan.midpoint
        delta = blotch.center - (fan.base+fan.midpoint)
        print(norm(delta))

In [ ]:
reduced_blotches[0].data

In [ ]:
p4id_data.plot_fans(fans=pd.DataFrame(fans_data))

In [ ]: