File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -501,6 +501,13 @@ class ProbeCenterConstraintOptions(FeatureOptions):
501501 enabled : bool = False
502502
503503 optimization_plan : OptimizationPlan = dataclasses .field (default_factory = OptimizationPlan )
504+
505+ use_intensity_for_com : bool = False
506+ """
507+ Whether to use the magnitude of the dominant shared probe
508+ mode for computing the center of mass of the probe in order
509+ to keep it centered, or to use the total probe intensity.
510+ """
504511
505512
506513@dataclasses .dataclass
Original file line number Diff line number Diff line change @@ -394,7 +394,13 @@ def center_probe(self):
394394 """
395395 Move the probe's center of mass to the center of the probe array.
396396 """
397- com = ip .find_center_of_mass (self .get_mode_and_opr_mode (0 , 0 ))
397+
398+ if self .options .center_constraint .use_intensity_for_com :
399+ probe_to_be_shifted = torch .sum (torch .abs (self .data [0 , ...]) ** 2 , dim = 0 )
400+ else :
401+ probe_to_be_shifted = self .get_mode_and_opr_mode (0 , 0 )
402+
403+ com = ip .find_center_of_mass (probe_to_be_shifted )
398404 shift = utils .to_tensor (self .shape [- 2 :]) // 2 - com
399405 shifted_probe = self .shift (shift )
400406 self .set_data (shifted_probe )
You can’t perform that action at this time.
0 commit comments