nettracer3d 1.2.5__py3-none-any.whl → 1.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
nettracer3d/modularity.py CHANGED
@@ -103,7 +103,7 @@ def read_excel_to_lists(file_path, sheet_name=0):
103
103
 
104
104
 
105
105
 
106
- def show_communities_flex(G, master_list, normalized_weights, geo_info=None, geometric=False, directory=None, weighted=True, partition=None, style=0):
106
+ def show_communities_flex(G, master_list, normalized_weights, geo_info=None, geometric=False, directory=None, weighted=True, partition=None, style=0, show_labels = True):
107
107
 
108
108
  if normalized_weights is None:
109
109
  G, edge_weights = network_analysis.weighted_network(master_list)
@@ -179,7 +179,8 @@ def show_communities_flex(G, master_list, normalized_weights, geo_info=None, geo
179
179
  normalized_weight = G[edge[0]][edge[1]]['weight']
180
180
  nx.draw_networkx_edges(G, pos, edgelist=[edge], width=5 * normalized_weight, edge_color='black')
181
181
 
182
- nx.draw_networkx_labels(G, pos)
182
+ if show_labels:
183
+ nx.draw_networkx_labels(G, pos)
183
184
 
184
185
  else:
185
186
  pos = nx.spring_layout(G)
@@ -195,20 +196,28 @@ def show_communities_flex(G, master_list, normalized_weights, geo_info=None, geo
195
196
  normalized_weight = G[edge[0]][edge[1]]['weight']
196
197
  nx.draw_networkx_edges(G, pos, edgelist=[edge], width=5 * normalized_weight, edge_color='black')
197
198
 
198
- nx.draw_networkx_labels(G, pos)
199
+ if show_labels:
200
+ nx.draw_networkx_labels(G, pos)
199
201
 
200
202
  else:
201
203
  # Create node color list based on partition and the same color mapping
202
- node_colors = [colors_matplotlib[partition[node]] for node in G.nodes()]
204
+ node_colors = []
205
+ for node in G.nodes():
206
+ try:
207
+ node_colors.append(colors_matplotlib[partition[node]])
208
+ except:
209
+ node_colors.append((1, 1, 1))
210
+
211
+ #node_colors = [colors_matplotlib[partition[node]] for node in G.nodes()]
203
212
 
204
213
  if geometric:
205
214
  pos, z_pos = simple_network.geometric_positions(geo_info[0], geo_info[1])
206
215
  node_sizes_list = [z_pos[node] for node in G.nodes()]
207
- nx.draw(G, pos, with_labels=True, font_color='black', font_weight='bold',
216
+ nx.draw(G, pos, with_labels=show_labels, font_color='black', font_weight='bold',
208
217
  node_size=node_sizes_list, node_color=node_colors, alpha=0.8, font_size=12)
209
218
  else:
210
219
  pos = nx.spring_layout(G)
211
- nx.draw(G, pos, with_labels=True, font_color='black', font_weight='bold',
220
+ nx.draw(G, pos, with_labels=show_labels, font_color='black', font_weight='bold',
212
221
  node_size=100, node_color=node_colors, alpha=0.8)
213
222
 
214
223
  plt.axis('off')
nettracer3d/morphology.py CHANGED
@@ -337,7 +337,7 @@ def search_neighbor_ids(nodes, targets, id_dict, neighborhood_dict, totals, sear
337
337
  targets = np.isin(nodes, targets)
338
338
  targets = nettracer.binarize(targets)
339
339
 
340
- dilated = nettracer.dilate(targets, search, xy_scale = xy_scale, z_scale = z_scale, fast_dil = fastdil)
340
+ dilated = nettracer.dilate_3D_dt(targets, search, xy_scaling = xy_scale, z_scaling = z_scale, fast_dil = fastdil)
341
341
  dilated = dilated - targets #technically we dont need the cores
342
342
  search_vol = np.count_nonzero(dilated) * xy_scale * xy_scale * z_scale #need this for density
343
343
  targets = dilated != 0