complex_field_to_rgb
- hcipy.plotting.complex_field_to_rgb(field, theme='dark', rmin=None, rmax=None, norm=None)
Convert a complex field to an RGB field.
This function takes a scalar Field with complex numbers and converts it to a vector Field containing the red, green and blue values corresponding to the phase and amplitude of the complex input Field. The phase is decoded as hue, and amplitude as saturation/value. This function is especially useful for plotting complex fields.
- Parameters:
- fieldscalar Field or ndarray
The field that we want to convert.
- theme[‘dark’, ‘light’]
Whether to modulate saturation or value as a function of amplitude of the input field. Dark mode modulates value, light mode modulates saturation.
- rminscalar
The minimum value on the colorbar. If this is not given, then the minimum of the absolute value of the Field will be used.
- rmaxscalar
The maximum value on the colorbar. If this is not given, then the maximum of the absolute value of the Field will be used.
- normNormalize
A Normalize instance is used to scale the absolute value to the (0, 1) range used for the value or saturation for the returned color. If it is not given, a linear scale will be used.
- Returns:
- Field
A vector field containing the red, green and blue components.
- Raises:
- ValueError
If the supplied field is not a scalar field.