{"record":{"id":"36f72910cd25f6bb","repo":"jax-ml/jax","slug":"jax-scipy-ndimage-map-coordinates-currently-requir","errorCode":null,"errorMessage":"jax.scipy.ndimage.map_coordinates currently requires order<=1","messagePattern":"jax\\.scipy\\.ndimage\\.map_coordinates currently requires order<=1","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"jax/_src/scipy/ndimage.py","lineNumber":99,"sourceCode":"                     '{} != {}'.format(len(coordinates), input_arr.ndim))\n\n  index_fixer = _INDEX_FIXERS.get(mode)\n  if index_fixer is None:\n    raise NotImplementedError(\n        'jax.scipy.ndimage.map_coordinates does not yet support mode {}. '\n        'Currently supported modes are {}.'.format(mode, set(_INDEX_FIXERS)))\n\n  if mode == 'constant':\n    is_valid = lambda index, size: (0 <= index) & (index < size)\n  else:\n    is_valid = lambda index, size: True\n\n  if order == 0:\n    interp_fun = _nearest_indices_and_weights\n  elif order == 1:\n    interp_fun = _linear_indices_and_weights\n  else:\n    raise NotImplementedError(\n        'jax.scipy.ndimage.map_coordinates currently requires order<=1')\n\n  valid_1d_interpolations = []\n  for coordinate, size in zip(coordinate_arrs, input_arr.shape):\n    interp_nodes = interp_fun(coordinate)\n    valid_interp = []\n    for index, weight in interp_nodes:\n      fixed_index = index_fixer(index, size)\n      valid = is_valid(index, size)\n      valid_interp.append((fixed_index, valid, weight))\n    valid_1d_interpolations.append(valid_interp)\n\n  outputs = []\n  for items in itertools.product(*valid_1d_interpolations):\n    indices, validities, weights = util.unzip3(items)\n    if all(valid is True for valid in validities):\n      # fast path\n      contribution = input_arr[indices]","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/scipy/ndimage.py#L81-L117","documentation":"JAX's map_coordinates only implements order 0 (nearest) and order 1 (linear) interpolation; any higher spline order raises NotImplementedError because spline prefilters are not implemented.","triggerScenarios":"Passing order=3 (scipy's default) or order=2..5; migrating scipy.ndimage.shift/rotate/affine_transform code that defaults to cubic splines.","commonSituations":"Porting image augmentation or registration pipelines that rely on cubic interpolation; accuracy differences after downgrading to linear.","solutions":["Set order=0 or order=1","Accept the interpolation quality change, or pre/post-process with a hand-written higher-order interpolation","Watch jax releases; higher orders may land later"],"exampleFix":"# before\nout = ndimage.map_coordinates(img, coords, order=3)\n# after\nout = ndimage.map_coordinates(img, coords, order=1)","handlingStrategy":"fallback","validationCode":"order = 1 if order > 1 else order","typeGuard":"def order_supported(o: int) -> bool: return o in (0, 1)","tryCatchPattern":"try:\n    out = map_coordinates(img, coords, order=order)\nexcept NotImplementedError:\n    out = map_coordinates(img, coords, order=1)","preventionTips":["Set order=1 explicitly when porting scipy code"],"tags":["jax","scipy","ndimage","interpolation","unsupported-feature"],"backgroundTag":"unsupported-argument-value","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}