nettracer3d 1.2.7__py3-none-any.whl → 1.3.6__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.
@@ -442,6 +442,17 @@ def combine_lists_to_sublists(master_list):
442
442
 
443
443
  return combined_list
444
444
 
445
+ def combine_lists_to_sublists_no_edges(master_list):
446
+
447
+
448
+ list1 = master_list[0]
449
+ list2 = master_list[1]
450
+
451
+ # Combine the lists into one list of sublists
452
+ combined_list = [list(sublist) for sublist in zip(list1, list2)]
453
+
454
+ return combined_list
455
+
445
456
 
446
457
  def find_centroids(nodes, down_factor = None, network = None):
447
458
 
@@ -867,11 +878,7 @@ def buckets(dists, num_objects, rad_dist, directory = None):
867
878
 
868
879
  try:
869
880
 
870
- if directory is None:
871
- # Save the DataFrame to an Excel file
872
- df.to_excel('radial_distribution.xlsx', index=False)
873
- print("Radial distribution saved to radial_distribution.xlsx")
874
- else:
881
+ if directory is not None:
875
882
  df.to_excel(f'{directory}/radial_distribution.xlsx', index=False)
876
883
  print(f"Radial distribution saved to {directory}/radial_distribution.xlsx")
877
884
  except:
@@ -923,8 +930,15 @@ def get_distance_list(centroids, network, xy_scale, z_scale):
923
930
  return distance_list
924
931
 
925
932
 
926
- def prune_samenode_connections(networkfile, nodeIDs):
927
- """Even faster numpy-based version for very large datasets"""
933
+ def prune_samenode_connections(networkfile, nodeIDs, target=None):
934
+ """Even faster numpy-based version for very large datasets
935
+
936
+ Args:
937
+ networkfile: Network file path or list of node pairs
938
+ nodeIDs: Node identity mapping (file path or dict)
939
+ target: Optional string. If provided, only prunes pairs where BOTH nodes
940
+ have this specific identity. If None, prunes all same-identity pairs.
941
+ """
928
942
  import numpy as np
929
943
 
930
944
  # Handle nodeIDs input
@@ -953,8 +967,13 @@ def prune_samenode_connections(networkfile, nodeIDs):
953
967
  idsA = np.array([data_dict.get(node) for node in nodesA])
954
968
  idsB = np.array([data_dict.get(node) for node in nodesB])
955
969
 
956
- # Create boolean mask - keep where IDs are different
957
- keep_mask = idsA != idsB
970
+ # Create boolean mask based on target parameter
971
+ if target is None:
972
+ # Original behavior: keep where IDs are different
973
+ keep_mask = idsA != idsB
974
+ else:
975
+ # New behavior: only remove pairs where BOTH nodes have the target identity
976
+ keep_mask = ~((idsA == target) & (idsB == target))
958
977
 
959
978
  # Apply filter
960
979
  filtered_nodesA = nodesA[keep_mask].tolist()