code: def correlate1d(
      input,
      weights,
      axis=-1,
      output=None,
      mode="reflect",
      cval=0.0,
      origin=0,
  ):
      """Calculate a one-dimensional correlation along the given axis.
  
      The lines of the array along the given axis are correlated with the
      given weights.
  
      Parameters
      ----------
      %(input)s
      weights : array
          One-dimensional sequence of numbers.
      %(axis)s
      %(output)s
      %(mode)s
      %(cval)s
      %(origin)s
  
      Examples
      --------
      >>> from scipy.ndimage import correlate1d
      >>> correlate1d([2, 8, 0, 4, 1, 9, 9, 0], weights=[1, 3])
      array([ 8, 26,  8, 12,  7, 28, 36,  9])
      """
      input = numpy.asarray(input)
      if numpy.iscomplexobj(input):
          raise TypeError("Complex type not supported")
      output = _ni_support._get_output(output, input)
      weights = numpy.asarray(weights, dtype=numpy.float64)
      if weights.ndim != 1 or weights.shape[0] < 1:
          raise RuntimeError("no filter weights given")
      if not weights.flags.contiguous:
          weights = weights.copy()
      axis = _ni_support._check_axis(axis, input.ndim)
      if _invalid_origin(origin, len(weights)):
          raise ValueError(
              "Invalid origin; origin must satisfy "
              "-(len(weights) // 2) <= origin <= "
              "(len(weights)-1) // 2"
          )
      mode = _ni_support._extend_mode_to_code(mode)
      _nd_image.correlate1d(
          input, weights, axis, output, mode, cval, origin
      )
      return output
  
imports: from __future__ import division, print_function, absolute_import
  import warnings
  import numbers
  import numpy
  import operator
  from .None import _ni_support
  from .None import _nd_image
  from .None import _ni_docstrings
label_desc: Use image node_id 2 for calling a global function with example usage: correlate1d(input, weights, axis, output, mode, cval, origin) and returns: output