qspec logo qspec logo

A physics toolbox for laser spectroscopy.

Static Badge Static Badge Static Badge

Static Badge Static Badge

© 2026 Patrick Müller. All rights reserved.

qspec. check_shape  (  shape ,  *args ,  allow_scalar=True ,  return_mode=False  )[source]

Check whether all arguments have the specified shape.

Parameters:
shapetuple

The shape which must be matched by the specified arguments.

argsndarray

The arguments which must match the specified shape.

allow_scalarbool

Whether scalar values (shape == ()) are seen as compatible with arbitrary shapes.

return_modebool

Whether to return False instead of raising a ValueError if any argument does not have shape shape.

Returns:
matchbool | None

Whether the arguments match the specified shape.

Raises:
ValueError

If any argument does not match the specified shape and return_mode is False.