arviz_base.generate_dims_coords#

arviz_base.generate_dims_coords(shape, var_name, dims=None, coords=None, index_origin=None, skip_event_dims=False, check_conventions=True)[source]#

Generate default dimensions and coordinates for a variable.

Parameters:
shapeiterable of int

Shape of the variable

var_nameiterable of hashable

Name of the variable. If no dimension name(s) is provided, ArviZ will generate a default dimension name using var_name, e.g. "foo_dim_0" for the first dimension if var_name is "foo".

dimsiterable of hashable, optional

Dimension names (or identifiers) for the variable. If skip_event_dims is True it can be longer than shape. In that case, only the first len(shape) elements in dims will be used. Moreover, if needed, axis of length 1 in shape will also be given different names than the ones provided in dims.

coordsdict of {hashable: array_like}, optional

Map of dimension names to coordinate values. Dimensions without coordinate values mapped to them will be given an integer range as coordinate values. It can have keys for dimension names not present in that variable.

index_originint, optional

Starting value of generated integer coordinate values. Defaults to the value in rcParam data.index_origin.

skip_event_dimsbool, default False

Whether to allow for different sizes between shape and dims. See description in dims for more details.

check_conventionsbool, optional

Check ArviZ conventions. Per the ArviZ schema, some dimension names have specific meaning and there might be inconsistencies caught here in the dimension naming step.

Returns:
list of hashable

Default dims for that variable

dict of {hashable: array_like}

Default coords for that variable