Loading autocnet/matcher/subpixel.py +8 −6 Original line number Diff line number Diff line Loading @@ -679,6 +679,9 @@ def subpixel_register_measure(measureid, result = {'measureid':measureid, 'status':''} if not ncg.Session: raise BrokenPipeError('This func requires a database session from a NetworkCandidateGraph.') with ncg.session_scope() as session: # Setup the measure that is going to be matched destination = session.query(Measures).filter(Measures.id == measureid).one() Loading Loading @@ -757,10 +760,6 @@ def subpixel_register_point(pointid, Parameters ---------- ncg : obj the network candidate graph that the point is associated with; used for the DB session that is able to access the point. pointid : int or obj The identifier of the point in the DB or a Points object Loading @@ -779,9 +778,12 @@ def subpixel_register_point(pointid, threshold : numeric measures with a cost <= the threshold are marked as ignore=True in the database. ncg : obj the network candidate graph that the point is associated with; used for the DB session that is able to access the point. """ Session = ncg.Session if not Session: if not ncg.Session: raise BrokenPipeError('This func requires a database session from a NetworkCandidateGraph.') if isinstance(pointid, Points): Loading autocnet/spatial/overlap.py +2 −4 Original line number Diff line number Diff line Loading @@ -66,8 +66,7 @@ def place_points_in_overlaps(size_threshold=0.0007, size_threshold : float overlaps with area <= this threshold are ignored """ Session = ncg.Session if not Session: if not ncg.Session: raise BrokenPipeError('This func requires a database session from a NetworkCandidateGraph.') for overlap in Overlay.overlapping_larger_than(size_threshold, Session): Loading Loading @@ -110,8 +109,7 @@ def place_points_in_overlap(overlap, points : list of Points The list of points seeded in the overlap """ Session = ncg.Session if not Session: if not ncg.Session: raise BrokenPipeError('This func requires a database session from a NetworkCandidateGraph.') # Determine what sensor type to use Loading bin/acn_submit +3 −4 Original line number Diff line number Diff line Loading @@ -43,11 +43,10 @@ def _instantiate_row(msg, ncg): # Get the dict mapping iterable keyword types to the objects objdict = ncg.apply_iterable_options rowid = msg['id'] session = ncg.Session() obj = objdict[msg['along']] with ncg.session_scope() as session: res = session.query(obj).filter(getattr(obj, 'id')==msg['id']).one() session.close() session.expunge(res) # Disconnect the object from the session return res def main(msg): Loading Loading
autocnet/matcher/subpixel.py +8 −6 Original line number Diff line number Diff line Loading @@ -679,6 +679,9 @@ def subpixel_register_measure(measureid, result = {'measureid':measureid, 'status':''} if not ncg.Session: raise BrokenPipeError('This func requires a database session from a NetworkCandidateGraph.') with ncg.session_scope() as session: # Setup the measure that is going to be matched destination = session.query(Measures).filter(Measures.id == measureid).one() Loading Loading @@ -757,10 +760,6 @@ def subpixel_register_point(pointid, Parameters ---------- ncg : obj the network candidate graph that the point is associated with; used for the DB session that is able to access the point. pointid : int or obj The identifier of the point in the DB or a Points object Loading @@ -779,9 +778,12 @@ def subpixel_register_point(pointid, threshold : numeric measures with a cost <= the threshold are marked as ignore=True in the database. ncg : obj the network candidate graph that the point is associated with; used for the DB session that is able to access the point. """ Session = ncg.Session if not Session: if not ncg.Session: raise BrokenPipeError('This func requires a database session from a NetworkCandidateGraph.') if isinstance(pointid, Points): Loading
autocnet/spatial/overlap.py +2 −4 Original line number Diff line number Diff line Loading @@ -66,8 +66,7 @@ def place_points_in_overlaps(size_threshold=0.0007, size_threshold : float overlaps with area <= this threshold are ignored """ Session = ncg.Session if not Session: if not ncg.Session: raise BrokenPipeError('This func requires a database session from a NetworkCandidateGraph.') for overlap in Overlay.overlapping_larger_than(size_threshold, Session): Loading Loading @@ -110,8 +109,7 @@ def place_points_in_overlap(overlap, points : list of Points The list of points seeded in the overlap """ Session = ncg.Session if not Session: if not ncg.Session: raise BrokenPipeError('This func requires a database session from a NetworkCandidateGraph.') # Determine what sensor type to use Loading
bin/acn_submit +3 −4 Original line number Diff line number Diff line Loading @@ -43,11 +43,10 @@ def _instantiate_row(msg, ncg): # Get the dict mapping iterable keyword types to the objects objdict = ncg.apply_iterable_options rowid = msg['id'] session = ncg.Session() obj = objdict[msg['along']] with ncg.session_scope() as session: res = session.query(obj).filter(getattr(obj, 'id')==msg['id']).one() session.close() session.expunge(res) # Disconnect the object from the session return res def main(msg): Loading