@@ -559,14 +559,16 @@ def _fit_single_bin(
559559
560560 return False
561561
562- def get_interpolator (self , gamma_index : int = 0 ) -> Tuple [Any , Any ]:
562+ def get_interpolator (self , gamma_index : int = 0 , extension_index : int = 0 ) -> Tuple [Any , Any ]:
563563 """
564564 Get an interpolator for fitted parameters at a given spectral index.
565565
566566 Parameters
567567 ----------
568568 gamma_index : int, optional
569569 Index of the spectral index to use. Default is 0.
570+ extension_index : int, optional
571+ Index into extension_grid to use. Default is 0.
570572
571573 Returns
572574 -------
@@ -586,15 +588,15 @@ def get_interpolator(self, gamma_index: int = 0) -> Tuple[Any, Any]:
586588 # Create interpolators
587589 alpha_interp = RegularGridInterpolator (
588590 tuple (bin_centers ),
589- self .fit_alpha [gamma_index ],
591+ self .fit_alpha [extension_index , gamma_index ],
590592 method = "linear" ,
591593 bounds_error = False ,
592594 fill_value = self .fit_alpha [gamma_index ].mean (),
593595 )
594596
595597 beta_interp = RegularGridInterpolator (
596598 tuple (bin_centers ),
597- self .fit_beta [gamma_index ],
599+ self .fit_beta [extension_index , gamma_index ],
598600 method = "linear" ,
599601 bounds_error = False ,
600602 fill_value = self .fit_beta [gamma_index ].mean (),
@@ -606,6 +608,7 @@ def plot_fit(
606608 self ,
607609 bin_indices : Union [Tuple [int , ...], Dict [str , int ]],
608610 gamma_index : int = 0 ,
611+ extension_index : int = 0 ,
609612 ax : Optional [Any ] = None ,
610613 ) -> Any :
611614 """
@@ -618,6 +621,8 @@ def plot_fit(
618621 mapping bin names to indices.
619622 gamma_index : int, optional
620623 Index of spectral index. Default is 0.
624+ extension_index : int, optional
625+ Index into extension_grid to use. Default is 0.
621626 ax : matplotlib.axes.Axes, optional
622627 Axes to plot on. If None, creates new figure.
623628
@@ -640,7 +645,7 @@ def plot_fit(
640645 if isinstance (bin_indices , dict ):
641646 bin_indices = tuple (bin_indices [key ] for key in self .bin_names )
642647
643- param_idx = tuple ([ gamma_index ] + list (bin_indices ) )
648+ param_idx = ( extension_index , gamma_index ) + tuple (bin_indices )
644649
645650 # Get histogram data
646651 hist = self .histograms [param_idx ]
0 commit comments