tedana.selection.selection_nodes.dec_left_op_right

dec_left_op_right(selector, if_true, if_false, decide_comps, op, left, right, left_scale=1, right_scale=1, op2=None, left2=None, right2=None, left2_scale=1, right2_scale=1, op3=None, left3=None, right3=None, left3_scale=1, right3_scale=1, log_extra_info='', custom_node_label='', only_used_metrics=False, tag_if_true=None, tag_if_false=None)[source]

Perform a relational comparison.

Parameters:
  • selector (ComponentSelector) – If only_used_metrics is False, the updated selector is returned.

  • tag_if_true (str) – The classification tag to apply if a component is classified True. Default=””.

  • tag_if_false (str) – The classification tag to apply if a component is classified False. Default=””.

  • decide_comps (str or list[str]) – What classification(s) to operate on. using default or intermediate_classification labels. For example: decide_comps=’unclassified’ means to operate only on unclassified components. Use ‘all’ to include all components.

  • op (str) – Must be one of: “>”, “>=”, “==”, “<=”, “<” Applied the user defined operator to left op right

  • left, right (str or float) – The labels for the two metrics to be used for comparision. For example: left=’kappa’, right=’rho’ and op=’>’ means this function will test kappa>rho. One of the two can also be a number. In that case, a metric would be compared against a fixed threshold. For example left=’T2fitdiff_invsout_ICAmap_Tstat’, right=0, and op=’>’ means this function will test T2fitdiff_invsout_ICAmap_Tstat>0

  • left_scale, right_scale (float or str) – Multiply the left or right metrics value by a constant. For example if left=’kappa’, right=’rho’, right_scale=2, and op=’>’ this tests kappa>(2*rho). These can also be a string that is a value in cross_component_metrics, since those will resolve to a single value. This cannot be a label for a component_table column since that would output a different value for each component. Default=1

  • op2 (str, Default=None)

  • left2, right2, left3, right3 (str or float, Default=None)

  • left2_scale, right2_scale, left3_scale, right3_scale (float or str, Default=1) – This function can also be used to calculate the intersection of two or three boolean statements. If op2, left2, and right2 are defined then this function returns (left_scale*)left op (right_scale*right) AND (left2_scale*)left2 op2 (right2_scale*right2) if the “3” parameters are also defined then it’s the intersection of all 3 statements

  • log_extra_info (str) – Additional text to the information log. Default=””.

  • custom_node_label (str) – A short label to describe what happens in this step. If “” then a label is automatically generated. Default=””.

  • only_used_metrics (bool) – If True, only return the component_table metrics that would be used. Default=False.

  • tag_if_true (str) – The classification tag to apply if a component is classified True. Default=””.

  • tag_if_false (str) – The classification tag to apply if a component is classified False. Default=””.

Returns:

  • selector (ComponentSelector) – If only_used_metrics is False, the updated selector is returned.

  • used_metrics (set(str)) – If only_used_metrics is True, the names of the metrics used in the function are returned.

Note

This function is ideally run with one boolean statement at a time so that the result of each boolean is logged. For example, it’s better to test kappa>kappa_elbow and rho>rho_elbow with two separate calls to this function so that the results of each test can be easily viewed. That said, particularly for the original kundu decision tree, if you’re making decisions on components with various classifications based on multiple boolean statements, the decision tree becomes really messy and the added functionality here is useful. Combinations of boolean statements only test with “and” and not “or”. This is an intentional decision because, if a classification changes if A>B or C>D are true then A>B and C>D should be logged separately