upxo.pxtalops.manipulator_mergers module
- upxo.pxtalops.manipulator_mergers.select_sinks_min_mprop(NeighGidSubset={}, NeighGidsMprop={}, mprop_range_for_sink_selection=[-5, 5], NG_sinks={}, force_select_criteria='distance_based')[source]
Select sink grains based on minimum neigh grain mprop.
Explanation
For each central grain (cgid), we look at the mprops of its neighboring grains. We define a proportional threshold range around the minimum mprop found among these neighbors, based on the specified uncertainty percentages (mprop_range_for_sink_selection). We then identify all neighboring grains whose mprops fall within this range as candidate sinks. If there are multiple candidate sinks, we randomly select one to be the sink for the candidate grain.
- param NeighGidSubset:
Dictionary mapping candidate grain IDs to lists of neighboring grain IDs.
- type NeighGidSubset:
dict
- param NeighGidsMprop:
Dictionary mapping candidate grain IDs to arrays of neighboring grain mprops.
- type NeighGidsMprop:
dict
- param mprop_range_for_sink_selection:
List or tuple containing two elements representing the lower and upper uncertainty percentages for sink selection.
- type mprop_range_for_sink_selection:
list or tuple
- param NG_sinks:
Dictionary to store the selected sink grain IDs for each candidate grain.
- type NG_sinks:
dict
- param force_select_criteria:
Criteria to force sink selection, default is ‘distance_based’. Options include ‘distance_based’, ‘max_mprop’, etc.
- type force_select_criteria:
str, optional
- returns:
Updated NG_sinks dictionary with selected sink grain IDs for each candidate grain.
- rtype:
dict
Example
mprop_range_for_sink_selection = [-5, 5] prop_thresh_low = min_area prop_thresh_up = min_area * (1 + mprop_range_for_sink_selection[1]/100) candidate_sinks = neigh_areas within [prop_thresh_low, prop_thresh_up]
Only upper uncertainty is considered here since we are looking for minima.
- upxo.pxtalops.manipulator_mergers.select_sinks_mean_mprop(NeighGidSubset={}, NeighGidsMprop={}, mprop_range_for_sink_selection=[-5, 5], NG_sinks={}, force_select_criteria='distance_based')[source]
Select sink grains based on mean neigh grain mprop.
Explanation
For each central grain (cgid), we look at the mprop of its neighboring grains. We calculate the mean mprop of these neighbors and define a proportional threshold range around this mean based on the specified uncertainty percentages (mprop_range_for_sink_selection). We then identify all neighboring grains whose mprops fall within this range as candidate sinks. If there are multiple candidate sinks, we randomly select one to be the sink for the candidate grain.
Example
mprop_range_for_sink_selection = [-5, 5] prop_thresh_low = mean_area * (1 - mprop_range_for_sink_selection[0]/100) prop_thresh_up = mean_area * (1 + mprop_range_for_sink_selection[1]/100) candidate_sinks = neigh_areas within [prop_thresh_low, prop_thresh_up]
This approach considers both lower and upper uncertainties around the mean.
- upxo.pxtalops.manipulator_mergers.select_sinks_max_mprop(NeighGidSubset={}, NeighGidsMprop={}, mprop_range_for_sink_selection=[-5, 5], NG_sinks={}, force_select_criteria='distance_based')[source]
Select sink grains based on maximum neigh grain mprop.
Explanation
For each central grain (cgid), we look at the mprops of its neighboring grains. We define a proportional threshold range around the maximum mprop found among these neighbors, based on the specified uncertainty percentages (mprop_range_for_sink_selection). We then identify all neighboring grains whose mprops fall within this range as candidate sinks. If there are multiple candidate sinks, we randomly select one to be the sink for the candidate grain.
Example
mprop_range_for_sink_selection = [-5, 5] prop_thresh_low = max_area * (1 - mprop_range_for_sink_selection[0]/100) prop_thresh_up = max_area candidate_sinks = neigh_areas within [prop_thresh_low, prop_thresh_up]
Only lower uncertainty is considered here since we are looking for maxima.
- upxo.pxtalops.manipulator_mergers.select_sinks_median_mprop(NeighGidSubset={}, NeighGidsMprop={}, mprop_range_for_sink_selection=[-5, 5], NG_sinks={}, force_select_criteria='distance_based')[source]
Select sink grains based on median neigh grain mprop.
Explanation
For each central grain (cgid), we look at the mprops of its neighboring grains. We calculate the median mprop of these neighbors and define a proportional threshold range around this median based on the specified uncertainty percentages (mprop_range_for_sink_selection). We then identify all neighboring grains whose mprops fall within this range as candidate sinks. If there are multiple candidate sinks, we randomly select one to be the sink for the candidate grain.
Example
mprop_range_for_sink_selection = [-5, 5] prop_thresh_low = median_area * (1 - mprop_range_for_sink_selection[0]/100) prop_thresh_up = median_area * (1 + mprop_range_for_sink_selection[1]/100) candidate_sinks = neigh_areas within [prop_thresh_low, prop_thresh_up]
This approach considers both lower and upper uncertainties around the median.
- upxo.pxtalops.manipulator_mergers.select_sinks_quantile_mprop(NeighGidSubset={}, NeighGidsMprop={}, mprop_range_for_sink_selection=[-20, 20], NG_sinks={}, sink_metric='q25', force_select_criteria='distance_based')[source]
Select sink grains based on quantile neigh grain mprop.
Explanation
For each central grain (cgid), we look at the mprops of its neighboring grains. We calculate the specified quantile mprop of these neighbors and define a proportional threshold range around this quantile based on the specified uncertainty percentages (ssu). We then identify all neighboring grains whose mprops fall within this range as candidate sinks. If there are multiple candidate sinks, we randomly select one to be the sink for the candidate grain.
Example
mprop_range_for_sink_selection = [-5, 5] prop_thresh_low = quantile_area * (1 - mprop_range_for_sink_selection[0]/100) prop_thresh_up = quantile_area * (1 + mprop_range_for_sink_selection[1]/100) candidate_sinks = neigh_areas within [prop_thresh_low, prop_thresh_up]
This approach considers both lower and upper uncertainties around the specified quantile.