make_random_models_table

photutils.datasets.make_random_models_table(n_sources, param_ranges, seed=None)[source]

Make a QTable containing randomly generated parameters for an Astropy model to simulate a set of sources.

Each row of the table corresponds to a source whose parameters are defined by the column names. The parameters are drawn from a uniform distribution over the specified input ranges.

The output table can be input into make_model_sources_image() to create an image containing the model sources.

Parameters:
n_sourcesfloat

The number of random model sources to generate.

param_rangesdict

The lower and upper boundaries for each of the model parameters as a dictionary mapping the parameter name to its (lower, upper) bounds.

seedint, optional

A seed to initialize the numpy.random.BitGenerator. If None, then fresh, unpredictable entropy will be pulled from the OS.

Returns:
tableQTable

A table of parameters for the randomly generated sources. Each row of the table corresponds to a source whose model parameters are defined by the column names. The column names will be the keys of the dictionary param_ranges.

Notes

To generate identical parameter values from separate function calls, param_ranges must have the same parameter ranges and the seed must be the same.

Examples

>>> from photutils.datasets import make_random_models_table
>>> n_sources = 5
>>> param_ranges = {'amplitude': [500, 1000],
...                 'x_mean': [0, 500],
...                 'y_mean': [0, 300],
...                 'x_stddev': [1, 5],
...                 'y_stddev': [1, 5],
...                 'theta': [0, np.pi]}
>>> sources = make_random_models_table(n_sources, param_ranges,
...                                    seed=0)
>>> for col in sources.colnames:
...     sources[col].info.format = '%.8g'  # for consistent table output
>>> print(sources)
amplitude   x_mean    y_mean    x_stddev  y_stddev   theta
--------- --------- ---------- --------- --------- ---------
818.48084 456.37779  244.75607 1.7026225 1.1132787 1.2053586
634.89336 303.31789 0.82155005 4.4527157 1.4971331 3.1328274
520.48676 364.74828  257.22128 3.1658449 3.6824977 3.0813851
508.26382  271.8125  10.075673 2.1988476  3.588758 2.1536937
906.63512 467.53621  218.89663 2.6907489 3.4615404 2.0434781