Loading autocnet/graph/network.py +16 −4 Original line number Diff line number Diff line Loading @@ -1828,7 +1828,14 @@ class NetworkCandidateGraph(CandidateGraph): """ # Ingest isis control net as a df and do some massaging data = cnet.from_isis(path) data_to_update = data[['id', 'serialnumber', 'measureJigsawRejected', 'sampleResidual', 'lineResidual', 'samplesigma', 'linesigma', 'adjustedCovar', 'apriorisample', 'aprioriline']] data_to_update = data[['id', 'serialnumber', 'measureJigsawRejected', 'sampleResidual', 'lineResidual', 'samplesigma', 'linesigma', 'adjustedCovar']] data_to_update.loc[:,'adjustedCovar'] = data_to_update['adjustedCovar'].apply(lambda row : list(row)) data_to_update.loc[:,'id'] = data_to_update['id'].apply(lambda row : int(row)) Loading @@ -1839,7 +1846,12 @@ class NetworkCandidateGraph(CandidateGraph): sql = f""" UPDATE measures AS f SET "measureJigsawRejected" = t."measureJigsawRejected", sampler = t."sampleResidual", liner = t."lineResidual", samplesigma = t."samplesigma", linesigma = t."linesigma", apriorisample = t."apriorisample", aprioriline = t."aprioriline" SET "measureJigsawRejected" = t."measureJigsawRejected", sampler = t."sampleResidual", liner = t."lineResidual", samplesigma = t."samplesigma", linesigma = t."linesigma", FROM temp_measures_{i} AS t WHERE f.serialnumber = t.serialnumber AND f.pointid = t.id; Loading autocnet/io/db/controlnetwork.py +2 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ SELECT measures."pointid", points."adjusted", points."pointIgnore", points."referenceIndex", points."identifier", measures."id", measures."serialnumber", measures."sample", Loading Loading @@ -60,6 +61,7 @@ ORDER BY measures."pointid", measures."id"; df.rename(columns = {'pointid': 'id', 'pointType': 'pointtype', 'measureType': 'measuretype'}, inplace=True) df['id'] = df.apply(lambda row: f"{row['identifier']}_{row['id']}", axis=1) #create columns in the dataframe; zeros ensure plio (/protobuf) will #ignore unless populated with alternate values Loading autocnet/io/db/model.py +2 −2 Original line number Diff line number Diff line Loading @@ -296,7 +296,7 @@ class Points(BaseMixin, Base): id = Column(Integer, primary_key=True, autoincrement=True) _pointtype = Column("pointType", IntEnum(PointType), nullable=False) # 2, 3, 4 - Could be an enum in the future, map str to int in a decorator identifier = Column(String, unique=True) identifier = Column(String) overlapid = Column(Integer, ForeignKey('overlay.id')) _geom = Column("geom", Geometry('POINT', srid=latitudinal_srid, dimension=2, spatial_index=True)) cam_type = Column(String) Loading autocnet/spatial/overlap.py +61 −15 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ def place_points_in_overlaps(size_threshold=0.0007, ncg=ncg) def place_points_in_overlap(overlap, indentifier="autocnet", cam_type="csm", size=71, distribute_points_kwargs={}, Loading @@ -97,20 +98,47 @@ def place_points_in_overlap(overlap, Parameters ---------- overlap : obj An autocnet.io.db.model Overlay model instance An autocnet.io.db.model Overlay model instance. identifier: str The tag used to distiguish points laid down by this function. cam_type : str options: {"csm", "isis"} Pick what kind of camera model implementation to use Pick what kind of camera model implementation to use. size : int The size of the window used to extractor features to find an interesting feature to which the point is shifted. The amount of pixel around a points initial location to search for an interesting feature to which to shift the point. distribute_points_kwargs: dict kwargs to pass to autocnet.cg.cg.distribute_points_in_geom point_type: int The type of point being placed. Default is pointtype=2, corresponding to free points. ncg: obj An autocnet.graph.network NetworkCandidateGraph instance representing the network to apply this function to Returns ------- points : list of Points The list of points seeded in the overlap See Also -------- autocnet.io.db.model.Overlay: for associated properties of the Overlay object autocnet.cg.cg.distribute_points_in_geom: for the possible arguments to pass through using disribute_points_kwargs. autocnet.model.io.db.PointType: for the point type options. autocnet.graph.network.NetworkCandidateGraph: for associated properties and functionalities of the NetworkCandidateGraph class """ if not ncg.Session: raise BrokenPipeError('This func requires a database session from a NetworkCandidateGraph.') Loading Loading @@ -248,7 +276,8 @@ def place_points_in_overlap(overlap, updated_lon, updated_lat = og2oc(updated_lon_og, updated_lat_og, semi_major, semi_minor) point_geom = shapely.geometry.Point(x, y, z) point = Points(overlapid=overlap.id, point = Points(identifier=identifier, overlapid=overlap.id, apriori=point_geom, adjusted=point_geom, pointtype=point_type, # Would be 3 or 4 for ground Loading Loading @@ -286,6 +315,7 @@ def place_points_in_overlap(overlap, return points def place_points_in_image(image, identifier="autocnet", cam_type="csm", size=71, distribute_points_kwargs={}, Loading @@ -301,6 +331,9 @@ def place_points_in_image(image, image : obj An autocnet Images model object identifier: str The tag used to distiguish points laid down by this function. cam_type : str options: {"csm", "isis"} Pick what kind of camera model implementation to use Loading @@ -309,8 +342,20 @@ def place_points_in_image(image, The size of the window used to extractor features to find an interesting feature to which the point is shifted. distirbute_points_kwargs : dict Of optional arguments for distirbute_points_in_geom distribute_points_kwargs: dict kwargs to pass to autocnet.cg.cg.distribute_points_in_geom ncg: obj An autocnet.graph.network NetworkCandidateGraph instance representing the network to apply this function to See Also -------- autocnet.cg.cg.distribute_points_in_geom: for the possible arguments to pass through using disribute_points_kwargs. autocnet.graph.network.NetworkCandidateGraph: for associated properties and functionalities of the NetworkCandidateGraph class """ # Arg checking if not ncg.Session: Loading Loading @@ -440,7 +485,8 @@ def place_points_in_image(image, with ncg.session_scope() as session: oid = session.query(Overlay.id).filter(Overlay.geom.ST_Contains(point_geometry)).one()[0] point = Points(overlapid=oid, point = Points(identifier=identifier, overlapid=oid, apriori=point_geom, adjusted=point_geom, pointtype=2, # Would be 3 or 4 for ground Loading Loading
autocnet/graph/network.py +16 −4 Original line number Diff line number Diff line Loading @@ -1828,7 +1828,14 @@ class NetworkCandidateGraph(CandidateGraph): """ # Ingest isis control net as a df and do some massaging data = cnet.from_isis(path) data_to_update = data[['id', 'serialnumber', 'measureJigsawRejected', 'sampleResidual', 'lineResidual', 'samplesigma', 'linesigma', 'adjustedCovar', 'apriorisample', 'aprioriline']] data_to_update = data[['id', 'serialnumber', 'measureJigsawRejected', 'sampleResidual', 'lineResidual', 'samplesigma', 'linesigma', 'adjustedCovar']] data_to_update.loc[:,'adjustedCovar'] = data_to_update['adjustedCovar'].apply(lambda row : list(row)) data_to_update.loc[:,'id'] = data_to_update['id'].apply(lambda row : int(row)) Loading @@ -1839,7 +1846,12 @@ class NetworkCandidateGraph(CandidateGraph): sql = f""" UPDATE measures AS f SET "measureJigsawRejected" = t."measureJigsawRejected", sampler = t."sampleResidual", liner = t."lineResidual", samplesigma = t."samplesigma", linesigma = t."linesigma", apriorisample = t."apriorisample", aprioriline = t."aprioriline" SET "measureJigsawRejected" = t."measureJigsawRejected", sampler = t."sampleResidual", liner = t."lineResidual", samplesigma = t."samplesigma", linesigma = t."linesigma", FROM temp_measures_{i} AS t WHERE f.serialnumber = t.serialnumber AND f.pointid = t.id; Loading
autocnet/io/db/controlnetwork.py +2 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ SELECT measures."pointid", points."adjusted", points."pointIgnore", points."referenceIndex", points."identifier", measures."id", measures."serialnumber", measures."sample", Loading Loading @@ -60,6 +61,7 @@ ORDER BY measures."pointid", measures."id"; df.rename(columns = {'pointid': 'id', 'pointType': 'pointtype', 'measureType': 'measuretype'}, inplace=True) df['id'] = df.apply(lambda row: f"{row['identifier']}_{row['id']}", axis=1) #create columns in the dataframe; zeros ensure plio (/protobuf) will #ignore unless populated with alternate values Loading
autocnet/io/db/model.py +2 −2 Original line number Diff line number Diff line Loading @@ -296,7 +296,7 @@ class Points(BaseMixin, Base): id = Column(Integer, primary_key=True, autoincrement=True) _pointtype = Column("pointType", IntEnum(PointType), nullable=False) # 2, 3, 4 - Could be an enum in the future, map str to int in a decorator identifier = Column(String, unique=True) identifier = Column(String) overlapid = Column(Integer, ForeignKey('overlay.id')) _geom = Column("geom", Geometry('POINT', srid=latitudinal_srid, dimension=2, spatial_index=True)) cam_type = Column(String) Loading
autocnet/spatial/overlap.py +61 −15 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ def place_points_in_overlaps(size_threshold=0.0007, ncg=ncg) def place_points_in_overlap(overlap, indentifier="autocnet", cam_type="csm", size=71, distribute_points_kwargs={}, Loading @@ -97,20 +98,47 @@ def place_points_in_overlap(overlap, Parameters ---------- overlap : obj An autocnet.io.db.model Overlay model instance An autocnet.io.db.model Overlay model instance. identifier: str The tag used to distiguish points laid down by this function. cam_type : str options: {"csm", "isis"} Pick what kind of camera model implementation to use Pick what kind of camera model implementation to use. size : int The size of the window used to extractor features to find an interesting feature to which the point is shifted. The amount of pixel around a points initial location to search for an interesting feature to which to shift the point. distribute_points_kwargs: dict kwargs to pass to autocnet.cg.cg.distribute_points_in_geom point_type: int The type of point being placed. Default is pointtype=2, corresponding to free points. ncg: obj An autocnet.graph.network NetworkCandidateGraph instance representing the network to apply this function to Returns ------- points : list of Points The list of points seeded in the overlap See Also -------- autocnet.io.db.model.Overlay: for associated properties of the Overlay object autocnet.cg.cg.distribute_points_in_geom: for the possible arguments to pass through using disribute_points_kwargs. autocnet.model.io.db.PointType: for the point type options. autocnet.graph.network.NetworkCandidateGraph: for associated properties and functionalities of the NetworkCandidateGraph class """ if not ncg.Session: raise BrokenPipeError('This func requires a database session from a NetworkCandidateGraph.') Loading Loading @@ -248,7 +276,8 @@ def place_points_in_overlap(overlap, updated_lon, updated_lat = og2oc(updated_lon_og, updated_lat_og, semi_major, semi_minor) point_geom = shapely.geometry.Point(x, y, z) point = Points(overlapid=overlap.id, point = Points(identifier=identifier, overlapid=overlap.id, apriori=point_geom, adjusted=point_geom, pointtype=point_type, # Would be 3 or 4 for ground Loading Loading @@ -286,6 +315,7 @@ def place_points_in_overlap(overlap, return points def place_points_in_image(image, identifier="autocnet", cam_type="csm", size=71, distribute_points_kwargs={}, Loading @@ -301,6 +331,9 @@ def place_points_in_image(image, image : obj An autocnet Images model object identifier: str The tag used to distiguish points laid down by this function. cam_type : str options: {"csm", "isis"} Pick what kind of camera model implementation to use Loading @@ -309,8 +342,20 @@ def place_points_in_image(image, The size of the window used to extractor features to find an interesting feature to which the point is shifted. distirbute_points_kwargs : dict Of optional arguments for distirbute_points_in_geom distribute_points_kwargs: dict kwargs to pass to autocnet.cg.cg.distribute_points_in_geom ncg: obj An autocnet.graph.network NetworkCandidateGraph instance representing the network to apply this function to See Also -------- autocnet.cg.cg.distribute_points_in_geom: for the possible arguments to pass through using disribute_points_kwargs. autocnet.graph.network.NetworkCandidateGraph: for associated properties and functionalities of the NetworkCandidateGraph class """ # Arg checking if not ncg.Session: Loading Loading @@ -440,7 +485,8 @@ def place_points_in_image(image, with ncg.session_scope() as session: oid = session.query(Overlay.id).filter(Overlay.geom.ST_Contains(point_geometry)).one()[0] point = Points(overlapid=oid, point = Points(identifier=identifier, overlapid=oid, apriori=point_geom, adjusted=point_geom, pointtype=2, # Would be 3 or 4 for ground Loading