make_empty_recarray

jwst.datamodels.utils.flat_multispec.make_empty_recarray(n_rows, n_spec, columns, is_vector, defaults=0)[source]

Create an empty output table with the specified number of rows.

Parameters:
n_rowsint

The number of rows in the output table; this is the maximum number of data points for any spectrum in the exposure.

n_specint

The number of spectra in the output table.

columnsndarray[tuple]

Array of tuples containing the column names and their dtypes.

is_vectorndarray[bool]

Array of booleans indicating whether each column is vector-like. If True, the column will be a 1D array of length n_rows. Otherwise, the column will be a scalar.

defaultslist, ndarray, int, or float, optional

List of default values for each column. If a column is vector-like, the default value will be repeated to fill the array. If a column is scalar, the default value will be used directly. If int or float, the same value will be used for all columns; string-type columns will be filled with the string representation of the value.

Returns:
output_tablerecarray

The empty output table with the specified shape and dtypes.