From 79d4325f2807ddb8714db31f68ed3dd60273fc78 Mon Sep 17 00:00:00 2001 From: Gavin Date: Tue, 7 Dec 2021 10:11:10 -0700 Subject: [PATCH] updated node.py to use logging --- autocnet/graph/node.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/autocnet/graph/node.py b/autocnet/graph/node.py index 843888fc..be5ae62e 100644 --- a/autocnet/graph/node.py +++ b/autocnet/graph/node.py @@ -1,7 +1,7 @@ from collections import defaultdict, MutableMapping import itertools import os -import warnings +import logging from csmapi import csmapi import numpy as np @@ -22,6 +22,8 @@ from autocnet.io import keypoints as io_keypoints from autocnet.vis.graph_view import plot_node from autocnet.utils import utils +# set up the logging file +log = logging.getLogger(__name__) class Node(dict, MutableMapping): """ @@ -395,7 +397,7 @@ class Node(dict, MutableMapping): def project_keypoints(self): if self.camera is None: # Without a camera, it is not possible to project - warnings.warn('Unable to project points, no camera available.') + log.warning('Unable to project points, no camera available.') return False # Project the sift keypoints to the ground def func(row, args): @@ -444,7 +446,7 @@ class Node(dict, MutableMapping): PATH to the directory for output and base file name """ if self.keypoints.empty: - warnings.warn('Node {} has not had features extracted.'.format(self['node_id'])) + log.warning('Node {} has not had features extracted.'.format(self['node_id'])) return io_keypoints.to_npy(self.keypoints, self.descriptors, @@ -524,7 +526,7 @@ class NetworkNode(Node): try: fp, cam_type = self.footprint except Exception as e: - warnings.warn('Unable to generate image footprint.\n{}'.format(e)) + log.warning('Unable to generate image footprint.\n{}'.format(e)) fp = cam_type = None # Create the image i = Images(name=self['image_name'], @@ -638,7 +640,7 @@ class NetworkNode(Node): with open(isdpath, 'w') as f: json.dump(response, f) except Exception as e: - warnings.warn('Failed to write JSON ISD for image {}.\n{}'.format(self['image_path'], e)) + log.warning('Failed to write JSON ISD for image {}.\n{}'.format(self['image_path'], e)) isd = csmapi.Isd(self['image_path']) plugin = csmapi.Plugin.findPlugin('UsgsAstroPluginCSM') self._camera = plugin.constructModelFromISD(isd, model_name) -- GitLab