@@ -32,6 +32,7 @@ def calculate_spectral_index_for_multiple_ranges(intensity_data: IntensityMapDat
3232 ena_spectral_index = np .concat ([m .ena_spectral_index for m in spectral_maps ], axis = 1 ),
3333 ena_spectral_index_stat_uncert = np .concat ([m .ena_spectral_index_stat_uncert for m in spectral_maps ], axis = 1 ),
3434 ena_spectral_index_scalar_coefficient = np .concat ([m .ena_spectral_index_scalar_coefficient for m in spectral_maps ], axis = 1 ),
35+ ena_spectral_index_scalar_coefficient_stat_uncert = np .concat ([m .ena_spectral_index_scalar_coefficient_stat_uncert for m in spectral_maps ], axis = 1 )
3536 )
3637
3738
@@ -81,7 +82,7 @@ def fit_spectral_index_map(intensity_data: IntensityMapData) -> SpectralIndexMap
8182 mean_energy = np .sqrt (min_energy * max_energy )
8283 new_energy_label = f"{ min_energy } - { max_energy } "
8384
84- output_scalar_coefficients , output_gammas , output_gamma_errors = fit_arrays_to_power_law (fluxes , uncertainty , energy )
85+ output_scalar_coefficients , output_scalar_errors , output_gammas , output_gamma_errors = fit_arrays_to_power_law (fluxes , uncertainty , energy )
8586 mean_obs_date = calculate_datetime_weighted_average (intensity_data .obs_date ,
8687 weights = intensity_data .exposure_factor ,
8788 axis = 1 , keepdims = True )
@@ -110,12 +111,13 @@ def fit_spectral_index_map(intensity_data: IntensityMapData) -> SpectralIndexMap
110111 solid_angle = intensity_data .solid_angle ,
111112 ena_spectral_index = output_gammas ,
112113 ena_spectral_index_stat_uncert = output_gamma_errors ,
113- ena_spectral_index_scalar_coefficient = output_scalar_coefficients
114+ ena_spectral_index_scalar_coefficient = output_scalar_coefficients ,
115+ ena_spectral_index_scalar_coefficient_stat_uncert = output_scalar_errors ,
114116 )
115117
116118
117119def fit_arrays_to_power_law (fluxes : np .ndarray , uncertainties : np .ndarray , energy : np .ndarray ) -> tuple [
118- np .ndarray , np .ndarray , np .ndarray ]:
120+ np .ndarray , np .ndarray , np .ndarray , np . ndarray ]:
119121 par_info = [
120122 {'limits' : [0.0 , 1000.0 ]},
121123 {'limits' : [0.0 , 1000.0 ]},
@@ -125,6 +127,7 @@ def fit_arrays_to_power_law(fluxes: np.ndarray, uncertainties: np.ndarray, energ
125127 output_gammas = np .full (output_shape , np .nan , dtype = float )
126128 output_gamma_errors = np .full_like (output_gammas , np .nan )
127129 output_scalar_coefficients = np .full_like (output_gammas , np .nan )
130+ output_scalar_coefficients_errors = np .full_like (output_gammas , np .nan )
128131
129132 for epoch in range (fluxes .shape [0 ]):
130133 intensity = fluxes [epoch ].reshape ((fluxes [epoch ].shape [0 ], - 1 ))
@@ -133,6 +136,7 @@ def fit_arrays_to_power_law(fluxes: np.ndarray, uncertainties: np.ndarray, energ
133136 gammas = np .full (intensity .shape [- 1 ], np .nan , dtype = float )
134137 gamma_errors = np .full_like (gammas , np .nan )
135138 scalar_coefficients = np .full (intensity .shape [- 1 ], np .nan , dtype = float )
139+ scalar_coefficient_errors = np .full (intensity .shape [- 1 ], np .nan , dtype = float )
136140
137141 for i in range (intensity .shape [- 1 ]):
138142 flux = intensity [:, i ]
@@ -158,10 +162,12 @@ def fit_arrays_to_power_law(fluxes: np.ndarray, uncertainties: np.ndarray, energ
158162 gammas [i ] = gamma
159163 scalar_coefficients [i ] = a
160164 gamma_errors [i ] = gamma_error
165+ scalar_coefficient_errors [i ] = a_error
161166 output_gammas [epoch , 0 ] = gammas .reshape (fluxes .shape [2 :])
162167 output_gamma_errors [epoch , 0 ] = gamma_errors .reshape (fluxes .shape [2 :])
163168 output_scalar_coefficients [epoch , 0 ] = scalar_coefficients .reshape (fluxes .shape [2 :])
164- return output_scalar_coefficients , output_gammas , output_gamma_errors
169+ output_scalar_coefficients_errors [epoch , 0 ] = scalar_coefficient_errors .reshape (fluxes .shape [2 :])
170+ return output_scalar_coefficients , output_scalar_coefficients_errors , output_gammas , output_gamma_errors
165171
166172
167173def power_law (params , ** kwargs ):
0 commit comments