- sherpa.astro.ui.calc_model_sum2d(reg=None, id=None)
Sum up the convolved model for a 2D data set.
This function is for two-dimensional data sets: use
calc_model_sumfor one-dimensional data sets.
msum – The sum of the model values, as fitted to the data, that lie within the given region. This includes any PSF included by
- Return type
The coordinate system of the region filter is determined by the coordinate setting for the data set (e.g.
The following examples use the data in the default data set created with the following calls, which sets the y (data) values to be 0 to 11 in a 3 row by 4 column image:
>>> ivals = np.arange(12) >>> y, x = np.mgrid[10:13, 20:24] >>> y = y.flatten() >>> x = x.flatten() >>> load_arrays(1, x, y, ivals, (3, 4), DataIMG) >>> set_source(const2d.bgnd) >>> bgnd.c0 = 2
with no argument, the full data set is used. Since the model evaluates to 2 per pixel, and there are 12 pixels in the data set, the result is 24:
>>> calc_model_sum2d() 24.0
and a spatial filter can be used to restrict the region used for the summation:
>>> calc_model_sum2d('circle(22,12,1)') 8.0 >>> calc_model_sum2d('field()-circle(22,12,1)') 16.0
Apply the spatial filter to the model for the data set labelled “a2142”:
>>> calc_model_sum2d('rotbox(4232.3,3876,300,200,43)', 'a2142')