def install_pip(self, package, save=True, save_dev=False):
        """Installs a pip package.

        :param save: if `True`, pins the package to the Hydrogen requirements
            YAML file.
        :param save_dev: if `True`, pins the package as a development
            dependency to the Hydrogen requirements YAML file.
        :param return: a **single** :class:`Requirement` object, representing
            the installed version of the given package.
        """
        requirement = Requirement.coerce(package)
        click.echo("pip install " + requirement.package)
        cmd = envoy.run("pip install {}".format(str(requirement)))
        if cmd.status_code == 0:
            installed_packages = get_installed_pypackages()
            package = installed_packages[requirement.package]
            requirement.version = "=={}".format(package.version)
            if save:
                self.requirements["all"].add(requirement)
            if save_dev:
                self.requirements["dev"].add(requirement)
            if save or save_dev:
                self.requirements.save()
            return requirement
        else:
            fatal(cmd.std_err)
def felosses(losses, coeffs, title='', log=True, ax=0):
    """plot iron losses with steinmetz or jordan approximation
    Args:
      losses: dict with f, B, pfe values
      coeffs: list with steinmetz (cw, alpha, beta) or
              jordan (cw, alpha, ch, beta, gamma) coeffs
      title: title string
      log: log scale for x and y axes if True

    """
    import femagtools.losscoeffs as lc
    if ax == 0:
        ax = plt.gca()

    fo = losses['fo']
    Bo = losses['Bo']
    B = plt.np.linspace(0.9*np.min(losses['B']),
                        1.1*0.9*np.max(losses['B']))

    for i, f in enumerate(losses['f']):
        pfe = [p for p in np.array(losses['pfe'])[i] if p]
        if f > 0:
            if len(coeffs) == 5:
                ax.plot(B, lc.pfe_jordan(f, B, *coeffs, fo=fo, Bo=Bo))
            elif len(coeffs) == 3:
                ax.plot(B, lc.pfe_steinmetz(f, B, *coeffs, fo=fo, Bo=Bo))
        plt.plot(losses['B'][:len(pfe)], pfe,
                 marker='o', label="{} Hz".format(f))

    ax.set_title("Fe Losses/(W/kg) " + title)
    if log:
        ax.set_yscale('log')
        ax.set_xscale('log')
    ax.set_xlabel("Flux Density [T]")
    # plt.ylabel("Pfe [W/kg]")
    ax.legend()
    ax.grid(True)