{"id":28435,"library":"unwrap","title":"unwrap","description":"A Python library for 2D and 3D phase unwrapping using a quality-guided algorithm. Version 0.1.1, released in 2014, with no recent updates.","status":"maintenance","version":"0.1.1","language":"python","source_language":"en","source_url":"https://github.com/geggo/phase-unwrap","tags":["phase-unwrapping","2d","3d","signal-processing","quality-guided"],"install":[{"cmd":"pip install unwrap","lang":"bash","label":"latest version"}],"dependencies":[{"reason":"required for array operations","package":"numpy","optional":false},{"reason":"required for image processing","package":"scipy","optional":false}],"imports":[{"note":"Common mistake: 'import unwrap' only gives access to unwrap package, not the function directly","wrong":"import unwrap","symbol":"unwrap2d","correct":"from unwrap import unwrap2d"},{"note":"No submodule named unwrapping exists","wrong":"unwrapping.unwrap3d","symbol":"unwrap3d","correct":"from unwrap import unwrap3d"}],"quickstart":{"code":"import numpy as np\nfrom unwrap import unwrap2d, unwrap3d\n\n# 2D example: wrapped phase in [-pi, pi)\nwrapped = np.random.uniform(-np.pi, np.pi, (10, 10))\nunwrapped = unwrap2d(wrapped)\n\n# 3D example\nwrapped_3d = np.random.uniform(-np.pi, np.pi, (5, 10, 10))\nunwrapped_3d = unwrap3d(wrapped_3d)","lang":"python","description":"Basic 2D and 3D phase unwrapping with random wrapped phase data."},"warnings":[{"fix":"Ensure input is in radians, typically by converting degrees * np.pi / 180.","message":"Functions expect input in radians (values between -pi and pi). Using degrees or other ranges will produce incorrect unwrapping without error.","severity":"gotcha","affected_versions":"all"},{"fix":"Preprocess input to replace NaN/Inf with neighboring valid values or mask them before passing to unwrap.","message":"The library does not handle NaN or Inf values. Presence of such values may cause silent failures or incorrect results.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider using alternative libraries like 'skimage.restoration.unwrap_phase' or 'np.unwrap' for simpler cases.","message":"Library is unmaintained since 2014. No support for Python 3.x beyond early versions, and no bug fixes.","severity":"deprecated","affected_versions":"0.1.1"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run: pip install --upgrade unwrap. If still failing, check Python version compatibility (works best with Python 2.7). For Python 3, try using a virtual environment with Python 2.7.","cause":"Installation may have failed or the package version is very old. Also common when using pip with an outdated index or on Python 3.","error":"ImportError: cannot import name 'unwrap2d' from 'unwrap'"},{"fix":"Use: unwrapped = unwrap2d(wrapped_phase) . No extra arguments supported.","cause":"The function signature expects only one positional argument (the array), but users sometimes pass additional parameters like mask.","error":"TypeError: unwrap2d() takes exactly 1 argument (2 given)"},{"fix":"Downgrade numpy to 1.23.5: pip install numpy==1.23.5","cause":"Numpy version mismatch: older versions of the library called .flatten() which was removed in newer numpy. Occurs with numpy >=1.24.","error":"AttributeError: 'numpy.ndarray' object has no attribute 'flatten'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}