pint.phase.Phase

class pint.phase.Phase(arg1, arg2=None)[source]

Bases: Phase

Class representing pulse phase as integer (.int) and fractional (.frac) parts.

The phase values are dimensionless Quantity (u.dimensionless_unscaled == u.Unit("") == Unit(dimensionless))

Ensures that the fractional part stays in [-0.5, 0.5)

SUGGESTION(@paulray): How about adding some documentation here describing why the fractional part is reduced to [-0.5,0.5) instead of [0,1).

Examples

>>> from pint.phase import Phase
>>> import numpy as np
>>> p = Phase(np.arange(10),np.random.random(10))
>>> print(p.int)
>>> print(p.frac[:5])
>>> i,f = p
>>> q = p.quantity

Create new Phase object

Can be initialized with arrays or a scalar Quantity (dimensionless).

Accepts either floating point argument (arg1) or pair of arguments with integer (arg1) and fractional (arg2) parts separate Scalars are converted to length 1 arrays so Phase.int and Phase.frac are always arrays

Parameters:
Returns:

pulse phase object with arrays of dimensionless Quantity objects as the int and frac parts

Return type:

Phase

Methods

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

Attributes

frac

Alias for field number 1

int

Alias for field number 0

quantity

value

__add__(other)[source]

Return self+value.

__mul__(num)[source]

Return self*value.

count(value, /)

Return number of occurrences of value.

frac

Alias for field number 1

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

int

Alias for field number 0