basic check to prevent 'orphan' clusters during prune#222
basic check to prevent 'orphan' clusters during prune#222espg wants to merge 1 commit intodemiangomez:masterfrom
Conversation
|
Worth reviewing the logic so we're clear on what is happening: if problems == 0:
for row in mod:
if np.sum(row) > 0:
problems += ~(np.max(mod[:,row].sum(axis=0)) >= 2)
if problems == 0:
subset.append(i)
OC[i, :] = np.zeros(rowlength)First line, Lines 2 and 3: iterate thru each row of the M by N station matrix, where M rows refer to M clusters, and N columns refer to N total stations to process. The Line 4: we entered this loop because removing the current cluster didn't cause any problems in station coverage. Now we'll check if removing the cluster causes any problems in overlap coverage. Line 5 and beyond: When removing a cluster, we have to check all other cluster to see if we've removed all overlap/ties, so we iterate thru the full overcluster matrix everytime we remove a cluster, and see if any clusters are impacted. If none are, we modify the overcluster matrix and remove that cluster. If removing that cluster leaves any other clusters without any ties, then we don't remove that cluster. |
|
This doesn't have any logic to check for a minimum number of ties/overlaps. It just checks that clusters have overlap post pruning. |
|
One more note on this-- if we have a case where we haven't overclustered something, such as the rejection_threshold triggering: ...then adding in the logic in this PR will result in no pruning at all for the clusters. This is because if overcluster doesn't add overlap stations for a row, then This is very much an edge case, but we should be aware of it. We could add another function to check for orphans between the overcluster and prune steps explicitly, and then error / warn or apply different logic when we detect the edge case. |
|
I think that when an orphan is detected, we should probably remove it from the dataset to allow the processing to continue, but we also need to make PGAMIT aware of this so that it prints a message to the user. Maybe we could do this through an exception during |

Additional check inside of
pruneto ensure that each cluster is connected to at least one other cluster