Commit 664c5568 authored by Laura, Jason R's avatar Laura, Jason R
Browse files

Merge branch 'main' into 'main'

Main

See merge request astrogeology/autocnet!679
parents c075205b 7e9e23e8
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -42,9 +42,7 @@ doc-build-and-deploy:
  stage: test 
  script:
    - mamba install --file doc_requirements.txt
    - cd docs 
    - ls
    - make html
    - sphinx-build -b html docs public
  artifacts:
    paths:
      - public
+2 −2
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ import pandas as pd
import numpy as np
import networkx as nx
import geopandas as gpd
import ogr
from osgeo import ogr
import logging

from skimage import transform as tf
@@ -597,7 +597,7 @@ def alpha_shape(points, alpha):
    circums = a * b * c / (4.0 * areas)

    # avoid devide by zero
    thresh = 1.0/alpha if alpha is not 0 else circums.max()
    thresh = 1.0/alpha if alpha != 0 else circums.max()
    filtered = triangles[circums < thresh]

    edge1 = filtered[:,(0,1)]
+2 −1
Original line number Diff line number Diff line
from collections import defaultdict, MutableMapping, Counter
from collections import defaultdict, Counter
from collections.abc import MutableMapping
from functools import wraps, singledispatch
import json
import logging
+11 −10
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import shapely
import scipy.special

import geoalchemy2
from sqlalchemy import text
from sqlalchemy.orm.decl_api import DeclarativeMeta
from sqlalchemy.sql import func
import shapely.affinity
@@ -137,7 +138,7 @@ class CandidateGraph(nx.Graph):
            self.graph['node_name_map'][i] = node_id

        # Relabel the nodes in place to use integer node ids
        nx.relabel_nodes(self, self.graph['node_name_map'], copy=False)
        # nx.relabel_nodes(self, self.graph['node_name_map'], copy=False)
        for s, d, e in self.edges(data=True):
            if s > d:
                s, d = d, s
@@ -150,6 +151,10 @@ class CandidateGraph(nx.Graph):
        if overlaps:
            self.compute_overlaps()

    def __post_init__(self):
        # Relabel the nodes in place to use integer node ids
        nx.relabel_nodes(self, self.graph['node_name_map'], copy=False)

    def __key(self):
        # TODO: This needs to be a real self identifying key
        return 'abcde'
@@ -400,8 +405,8 @@ class CandidateGraph(nx.Graph):

        # If image name is provided, build the node from the image before
        # calling nx.add_node()
        if len(image_name) is not 0:
            if len(basepath) is not 0:
        if len(image_name) != 0:
            if len(basepath) != 0:
                image_path = os.path.join(basepath, image_name)
            else:
                image_path = image_name
@@ -1584,13 +1589,10 @@ class NetworkCandidateGraph(CandidateGraph):
        self.config = config_dict
        
        self.async_watchers = async_watchers
        print('Watchers setup')
        # Setup REDIS
        self._setup_queues()
        print('Queues setup')
        # Setup the database
        self._setup_database()
        print('Database setup')

        # Setup threaded queue watchers
        if self.async_watchers == True:
@@ -1642,7 +1644,7 @@ class NetworkCandidateGraph(CandidateGraph):
        sleeptime = 2
        retries = 0
        while retries < 5:
            print(f'Database connection attempt {retries}')
            log.debug(f'Database connection attempt {retries}')
            try:
                self.Session, self.engine = new_connection(self.config['database'])

@@ -2487,11 +2489,10 @@ class NetworkCandidateGraph(CandidateGraph):
          SELECT * FROM Images WHERE (split_part(path, '/', 6) ~ 'P[0-9]+_.+') = True
        """

        composite_query = sql.from_database_composite.format(formatInput=sql.select_pub_image)
        composite_query = text(sql.from_database_composite.format(formatInput=sql.select_pub_image))

        with self.session_scope() as session:
            res = session.execute(composite_query)            

            adjacency = defaultdict(list)
            adjacency_lookup = {}
            for r in res:
+2 −4
Original line number Diff line number Diff line
from collections import defaultdict, MutableMapping
from collections import defaultdict
from collections.abc import MutableMapping
import itertools
import os
import logging
@@ -704,7 +705,6 @@ class NetworkNode(Node):
        footprint_latlon = cam_type = None

        if exist_check:
            print('ERRORRRORORORORRR!!!')
            footprint_latlon, cam_type = self.footprint_from_database()

        # not in database, create footprint
@@ -714,13 +714,11 @@ class NetworkNode(Node):
                t1 = time.time()
                footprint_latlon, cam_type = self.footprint_from_isis()
                t2 = time.time()
                print(f'time to get ISIS footprint: {t2 - t1}')
            else:
                # Get CSM footprint
                t1 = time.time()
                footprint_latlon, cam_type = self.footprint_from_csm()
                t2 = time.time()
                print(f'time to get CSM footprint: {t2 - t1}')
       
        return footprint_latlon, cam_type

Loading