From 47e3ba13b5b4058ba762befaf8f8c6e385039aa8 Mon Sep 17 00:00:00 2001 From: Robert Hammann Date: Tue, 29 Oct 2024 13:42:51 +0900 Subject: [PATCH] add create_source_morpher function for readability --- blueice/likelihood.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/blueice/likelihood.py b/blueice/likelihood.py index e948da8..616d62a 100644 --- a/blueice/likelihood.py +++ b/blueice/likelihood.py @@ -152,11 +152,14 @@ def prepare(self, n_cores=1, ipp_client=None): if self.source_wise_interpolation: # Create morphers for each source individually self.source_morphers = OrderedDict() - for sn, shape_parameters in self.source_shape_parameters.items(): - self.source_morphers[sn] = MORPHERS[self.config['morpher']]( + + def create_source_morpher(shape_parameters): + return MORPHERS[self.config['morpher']]( self.config.get('morpher_config', {}), - shape_parameters - ) + shape_parameters) + + for sn, shape_parameters in self.source_shape_parameters.items(): + self.source_morphers[sn] = create_source_morpher(shape_parameters) zs_list = set() for source_name, morpher in self.source_morphers.items(): anchor_points = morpher.get_anchor_points(bounds=None)