Skip to content

Commit

Permalink
Merge pull request #22 from WildMeOrg/astro-png-issue
Browse files Browse the repository at this point in the history
Update util_grabdata.py
  • Loading branch information
holmbergius authored May 21, 2023
2 parents e27888f + 43aa476 commit 4c2044f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
4 changes: 2 additions & 2 deletions requirements/runtime.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
delorean
gitpython
lockfile
networkx
numpy
networkx==2.5.1
numpy==1.20
opencv-contrib-python-headless
ordered-set
pandas
Expand Down
28 changes: 14 additions & 14 deletions utool/util_grabdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,20 +613,20 @@ def split_archive_ext(path):


TESTIMG_URL_DICT = {
'grace.jpg': 'http://i.imgur.com/rgQyu7r.jpg',
'jeff.png': 'http://i.imgur.com/l00rECD.png',
'ada2.jpg': 'http://i.imgur.com/zHOpTCb.jpg',
'ada.jpg': 'http://i.imgur.com/iXNf4Me.jpg',
'lena.png': 'http://i.imgur.com/JGrqMnV.png', # depricate lena
'astro.png': 'https://i.imgur.com/KXhKM72.png', # Use instead of lena
'carl.jpg': 'http://i.imgur.com/flTHWFD.jpg',
'easy1.png': 'http://i.imgur.com/Qqd0VNq.png',
'easy2.png': 'http://i.imgur.com/BDP8MIu.png',
'easy3.png': 'http://i.imgur.com/zBcm5mS.png',
'hard3.png': 'http://i.imgur.com/ST91yBf.png',
'zebra.png': 'http://i.imgur.com/58hbGcd.png',
'star.png': 'http://i.imgur.com/d2FHuIU.png',
'patsy.jpg': 'http://i.imgur.com/C1lNRfT.jpg',
'grace.jpg': 'https://cthulhu.dyn.wildme.io/public/testimgs/rgQyu7r.jpg',
'jeff.png': 'https://cthulhu.dyn.wildme.io/public/testimgs/l00rECD.png',
'ada2.jpg': 'https://cthulhu.dyn.wildme.io/public/testimgs/zHOpTCb.jpg',
'ada.jpg': 'https://cthulhu.dyn.wildme.io/public/testimgs/iXNf4Me.jpg',
'lena.png': 'https://cthulhu.dyn.wildme.io/public/testimgs/JGrqMnV.png', # depricate lena
'astro.png': 'https://cthulhu.dyn.wildme.io/public/testimgs/KXhKM72.png', # Use instead of lena
'carl.jpg': 'https://cthulhu.dyn.wildme.io/public/testimgs/flTHWFD.jpg',
'easy1.png': 'https://cthulhu.dyn.wildme.io/public/testimgs/Qqd0VNq.png',
'easy2.png': 'https://cthulhu.dyn.wildme.io/public/testimgs/BDP8MIu.png',
'easy3.png': 'https://cthulhu.dyn.wildme.io/public/testimgs/zBcm5mS.png',
'hard3.png': 'https://cthulhu.dyn.wildme.io/public/testimgs/ST91yBf.png',
'zebra.png': 'https://cthulhu.dyn.wildme.io/public/testimgs/58hbGcd.png',
'star.png': 'https://cthulhu.dyn.wildme.io/public/testimgs/d2FHuIU.png',
'patsy.jpg': 'https://cthulhu.dyn.wildme.io/public/testimgs/C1lNRfT.jpg',
}


Expand Down
14 changes: 14 additions & 0 deletions utool/util_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def nx_transitive_reduction(G, mode=1):
>>> # DISABLE_DOCTEST
>>> from utool.util_graph import * # NOQA
>>> import utool as ut
>>> import networkx as nx
>>> G = nx.DiGraph([('a', 'b'), ('a', 'c'), ('a', 'e'),
>>> ('a', 'd'), ('b', 'd'), ('c', 'e'),
>>> ('d', 'e'), ('c', 'e'), ('c', 'd')])
Expand Down Expand Up @@ -265,6 +266,7 @@ def nx_dag_node_rank(graph, nodes=None):
>>> # ENABLE_DOCTEST
>>> from utool.util_graph import * # NOQA
>>> import utool as ut
>>> import networkx as nx
>>> adj_dict = {0: [5], 1: [5], 2: [1], 3: [4], 4: [0], 5: [], 6: [4], 7: [9], 8: [6], 9: [1]}
>>> nodes = [2, 1, 5]
>>> f_graph = ut.nx_from_adj_dict(adj_dict, nx.DiGraph)
Expand Down Expand Up @@ -381,6 +383,7 @@ def nx_edges_between(
>>> # ENABLE_DOCTEST
>>> from utool.util_graph import * # NOQA
>>> import utool as ut
>>> import networkx as nx
>>> edges = [
>>> (1, 2), (2, 3), (3, 4), (4, 1), (4, 3), # cc 1234
>>> (1, 5), (7, 2), (5, 1), # cc 567 / 5678
Expand Down Expand Up @@ -574,6 +577,7 @@ def nx_delete_node_attr(graph, name, nodes=None):
Example:
>>> from utool.util_graph import * # NOQA
>>> import utool as ut
>>> import networkx as nx
>>> G = nx.karate_club_graph()
>>> nx.set_node_attributes(G, name='foo', values='bar')
>>> datas = nx.get_node_attributes(G, 'club')
Expand Down Expand Up @@ -618,6 +622,7 @@ def nx_delete_edge_attr(graph, name, edges=None):
Example:
>>> from utool.util_graph import * # NOQA
>>> import utool as ut
>>> import networkx as nx
>>> G = nx.karate_club_graph()
>>> nx.set_edge_attributes(G, name='spam', values='eggs')
>>> nx.set_edge_attributes(G, name='foo', values='bar')
Expand All @@ -633,6 +638,7 @@ def nx_delete_edge_attr(graph, name, edges=None):
Example:
>>> from utool.util_graph import * # NOQA
>>> import utool as ut
>>> import networkx as nx
>>> G = nx.MultiGraph()
>>> G.add_edges_from([(1, 2), (2, 3), (3, 4), (4, 5), (4, 5), (1, 2)])
>>> nx.set_edge_attributes(G, name='spam', values='eggs')
Expand Down Expand Up @@ -795,6 +801,7 @@ def nx_gen_node_attrs(
>>> # ENABLE_DOCTEST
>>> from utool.util_graph import * # NOQA
>>> import utool as ut
>>> import networkx as nx
>>> G = nx.Graph([(1, 2), (2, 3)])
>>> nx.set_node_attributes(G, name='part', values={1: 'bar', 3: 'baz'})
>>> nodes = [1, 2, 3, 4]
Expand All @@ -816,6 +823,7 @@ def nx_gen_node_attrs(
>>> # ALL CASES
>>> from utool.util_graph import * # NOQA
>>> import utool as ut
>>> import networkx as nx
>>> G = nx.Graph([(1, 2), (2, 3)])
>>> nx.set_node_attributes(G, name='full', values={1: 'A', 2: 'B', 3: 'C'})
>>> nx.set_node_attributes(G, name='part', values={1: 'bar', 3: 'baz'})
Expand Down Expand Up @@ -968,6 +976,7 @@ def nx_gen_edge_attrs(
>>> # ENABLE_DOCTEST
>>> from utool.util_graph import * # NOQA
>>> import utool as ut
>>> import networkx as nx
>>> G = nx.Graph([(1, 2), (2, 3), (3, 4)])
>>> nx.set_edge_attributes(G, name='part', values={(1, 2): 'bar', (2, 3): 'baz'})
>>> edges = [(1, 2), (2, 3), (3, 4), (4, 5)]
Expand Down Expand Up @@ -1186,6 +1195,7 @@ def testdata_graph():
>>> # DISABLE_DOCTEST
>>> from utool.util_graph import * # NOQA
>>> import utool as ut
>>> import networkx as nx
>>> (graph, G) = testdata_graph()
>>> import wbia.plottool as pt
>>> ut.ensureqt()
Expand Down Expand Up @@ -1290,6 +1300,7 @@ def paths_to_root(tablename, root, child_to_parents):
>>> # ENABLE_DOCTEST
>>> from utool.util_graph import * # NOQA
>>> import utool as ut
>>> import networkx as nx
>>> child_to_parents = {
>>> 'chip': ['dummy_annot'],
>>> 'chipmask': ['dummy_annot'],
Expand Down Expand Up @@ -1594,6 +1605,7 @@ def simplify_graph(graph):
>>> # ENABLE_DOCTEST
>>> from utool.util_graph import * # NOQA
>>> import utool as ut
>>> import networkx as nx
>>> graph = nx.DiGraph([('a', 'b'), ('a', 'c'), ('a', 'e'),
>>> ('a', 'd'), ('b', 'd'), ('c', 'e'),
>>> ('d', 'e'), ('c', 'e'), ('c', 'd')])
Expand Down Expand Up @@ -2135,6 +2147,7 @@ def approx_min_num_components(nodes, negative_edges):
>>> # ENABLE_DOCTEST
>>> from utool.util_graph import * # NOQA
>>> import utool as ut
>>> import networkx as nx
>>> nodes = [1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> edges = [(1, 2), (2, 3), (3, 1),
>>> (4, 5), (5, 6), (6, 4),
Expand Down Expand Up @@ -2283,6 +2296,7 @@ def mincost_diameter_augment(graph, max_cost, candidates=None, weight=None, cost
>>> # ENABLE_DOCTEST
>>> from utool.util_graph import * # NOQA
>>> import utool as ut
>>> import networkx as nx
>>> graph = nx.Graph()
>>> if nx.__version__.startswith('1'):
>>> nx.add_path = nx.Graph.add_path
Expand Down

0 comments on commit 4c2044f

Please sign in to comment.