def coerce(cls, string):
        """Create a :class:`Requirement` object from a given package spec."""
        match = re.match(cls.spec_regex, string)
        if not match:
            raise InvalidRequirementSpecError("could not parse requirement")
        package = match.group(1)
        if all(match.group(2, 3)):
            version = "".join(match.group(2, 3))
        else:
            version = None
        return cls(package, version)
def phasor(bch, ax=0):
    """create phasor plot from bch"""
    f1 = bch.machine['p']*bch.dqPar['speed']
    w1 = 2*np.pi*f1
    xd = w1*bch.dqPar['ld'][-1]
    xq = w1*bch.dqPar['lq'][-1]
    r1 = bch.machine['r1']
    i1beta_phasor(bch.dqPar['up'][-1],
                  bch.dqPar['i1'][-1], bch.dqPar['beta'][-1],
                  r1, xd, xq, ax)