electricpy.cprint

electricpy.cprint(val, unit=None, label=None, title=None, pretty=True, printval=True, ret=False, decimals=3, round=3)[source]

Phasor (Complex) Printing Function.

This function is designed to accept a complex value (val) and print the value in the standard electrical engineering notation:

magnitude ∠ angle °

This function will print the magnitude in degrees, and can print a unit and label in addition to the value itself.

Parameters:
val : complex

The Complex Value to be Printed, may be singular value, tuple of values, or list/array.

unit : string, optional

The string to be printed corresponding to the unit mark.

label : str, optional

The pre-pended string used as a descriptive labeling string.

title : str, optional

The pre-pended string describing a set of complex values.

pretty : bool, optional

Control argument to force printed result to a pretty format without array braces. default=True

printval : bool, optional

Control argument enabling/disabling printing of the string. default=True

ret : bool, optional

Control argument allowing the evaluated value to be returned. default=False

decimals : int, optional

Replaces round argument. Control argument specifying how many decimals of the complex value to be printed. May be negative to round to spaces to the left of the decimal place (follows standard round() functionality). default=3

round : int, optional, DEPRECATED

Control argument specifying how many decimals of the complex value to be printed. May be negative to round to spaces to the left of the decimal place (follows standard round() functionality). default=3

Returns:

numarr – The array of values corresponding to the magnitude and angle, values are returned in the form: [[ mag, ang ],…,[ mag, ang ]] where the angles are evaluated in degrees.

Return type:

numpy.ndarray

Examples

>>> import numpy as np
>>> import electricpy as ep
>>> from electricpy import phasors
>>> v = phasor(67, 120)
>>> ep.cprint(v)
67.0 ∠ 120.0°
>>> voltages = np.array([[67,0],
...                      [67,-120],
...                      [67,120]])
>>> Vset = ep.phasors.phasorlist( voltages )
>>> ep.cprint(Vset)
67.0 ∠ 0.0°
67.0 ∠ -120.0°
67.0 ∠ 120.0°

See also

electricpy.phasors.phasor

Phasor Generating Function

electricpy.phasors.phasorlist

Phasor Generating Function for Lists/Arrays

electricpy.phasors.phasorz

Impedance Phasor Generator