Synopsis
Create a data set from array values.
Syntax
load_arrays(id, *args) id - int or str
Examples
Example 1
Create a 1D data set with three points:
>>> load_arrays(1, [10, 12, 15], [4.2, 12.1, 8.4])
Example 2
Create a 1D data set, with the identifier 'prof', from the arrays x (independent axis), y (dependent axis), and dy (statistical error on the dependent axis):
>>> load_arrays('prof', x, y, dy)
Example 3
Explicitly define the type of the data set:
>>> load_arrays('prof', x, y, dy, Data1D)
Example 4
Data set 1 is a histogram, where the bins cover the range 1-3, 3-5, and 5-7 with values 4, 5, and 9 respectively.
>>> load_arrays(1, [1, 3, 5], [3, 5, 7], [4, 5, 9], Data1DInt)
Example 5
Create an image data set:
>>> ivals = np.arange(12) >>> y, x = np.mgrid[0:3, 0:4] >>> x = x.flatten() >>> y = y.flatten() >>> load_arrays('img', x, y, ivals, (3, 4), DataIMG)
PARAMETERS
The parameters for this function are:
Parameter | Definition |
---|---|
id | The identifier for the data set to use. |
*args | Two or more arrays, followed by the type of data set to create. |
Warning
Sherpa currently does not support numpy masked arrays. Use the set_filter function and note that it follows a different convention by default (a positive value or True for a "bad" channel, 0 or False for a good channel).
Notes
The data type identifier, which defaults to `Data1D` , determines the number, and order, of the required inputs.
Identifier | Required Fields | Optional Fields |
---|---|---|
Data1D | x, y | statistical error, systematic error |
Data1DInt | xlo, xhi, y | statistical error, systematic error |
Data2D | x0, x1, y | shape, statistical error, systematic error |
Data2DInt | x0lo, x1lo, x0hi, x1hi, y | shape, statistical error, systematic error |
DataPHA | channel, counts | statistical error, systematic error, bin_lo, bin_hi, grouping, quality |
DataIMG | x0, x1, y | shape, statistical error, systematic error |
The shape argument should be a tuple giving the size of the data (ny,nx) , and for the dataimg case the arrays are 1D, not 2D.
Bugs
See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.
See Also
- data
- dataspace1d, dataspace2d, datastack, fake, load_arf, load_ascii, load_bkg, load_bkg_arf, load_bkg_rmf, load_data, load_grouping, load_image, load_multi_arfs, load_multi_rmfs, load_pha, load_quality, load_rmf, load_staterror, load_syserror, load_table, pack_image, pack_pha, pack_table, unpack_arf, unpack_arrays, unpack_ascii, unpack_bkg, unpack_data, unpack_image, unpack_pha, unpack_rmf, unpack_table
- filtering
- load_filter
- info
- get_default_id, list_bkg_ids, list_data_ids
- modeling
- add_model, add_user_pars, load_table_model, load_template_interpolator, load_template_model, load_user_model, save_model, save_source
- saving
- save_arrays, save_data, save_delchi, save_error, save_filter, save_grouping, save_image, save_pha, save_quality, save_resid, save_staterror, save_syserror, save_table
- statistics
- load_user_stat