def test_modify_uns_in_copy():
    # https://github.com/theislab/anndata/issues/571
    adata = ad.AnnData(np.ones((5, 5)), uns={"parent": {"key": "value"}})
    adata_copy = adata[:3].copy()
    adata_copy.uns["parent"]["key"] = "new_value"
    assert adata.uns["parent"]["key"] != adata_copy.uns["parent"]["key"]
def demag(isa, ax=0):
    """plot demag of NC/I7/ISA7 model
    Args:
      isa: Isa7/NC object
    """
    emag = [e for e in isa.elements if e.is_magnet()]
    demag = np.array([e.demagnetization(isa.MAGN_TEMPERATURE) for e in emag])
    _contour(ax, f'Demagnetization at {isa.MAGN_TEMPERATURE} °C',
             emag, demag, '-H / kA/m', isa)
    logger.info("Max demagnetization %f", np.max(demag))