pint.phase.Phase
- class pint.phase.Phase(arg1, arg2=None)[source]
Bases:
PhaseClass 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 soPhase.intandPhase.fracare always arrays- Parameters:
arg1 (numpy.ndarray or astropy.units.Quantity) – Quantity should be dimensionless
arg2 (numpy.ndarray or astropy.units.Quantity) – Quantity should be dimensionless
- Returns:
pulse phase object with arrays of dimensionless
Quantityobjects as theintandfracparts- Return type:
Methods
count(value, /)Return number of occurrences of value.
index(value[, start, stop])Return first index of value.
Attributes
Alias for field number 1
Alias for field number 0
quantityvalue- 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