code: def coerce_float64(
      arr,
      nan_policy="raise",
      handle_inf=True,
      ravel=True,
      ravel_order="C",
  ):
      """coerce array-like objects to be a float64 ndarrays, usually forcing to 1D arrays.
  
      also handles behaviour when array contains ``numpy.nan`` or ``numpy.inf``.
  
      Parameters
      ----------
      arr : array_like
          Input array to consider.
      nan_policy : {'raise', 'propagate', 'omit'}, optional
          policy for handling NaN values. One of:
  
          `'raise'` - raise a `ValueError` if `arr` contains NaN (default)
          `'propagate'` - propagate NaN
          `'omit'` - filter NaN from input array
      handle_inf : bool, optional
          Whether to apply the `nan_policy` to +/-Inf (default is True).
      ravel : bool, optional
          Whether to force to be 1D array (default is True).
      ravel_order : str, optional
          array ordering to assume when unravelling array (default is 'C')
  
      Returns
      -------
      array
          ndarray of type np.float64, possibly after applying the `nan_policy`,
          and usually raveling to 1-D array
  
      Notes
      -----
      Parts of this function are based on scipy/stats/stats.py/_contains_nan
  
      support for 'array-like` objects is from numpy `asfarray`, which includes
      lists of numbers, pandas.Series, h5py.Datasets, and many other array-like
      Python objects
      """
      if np.iscomplexobj(arr):
          arr = np.asfarray(arr, dtype=np.complex128).view(np.float64)
      else:
          arr = np.asfarray(arr, dtype=np.float64)
  
      if ravel:
          arr = arr.ravel(order=ravel_order)
  
      if nan_policy not in ("propagate", "omit", "raise"):
          raise ValueError(
              "nan_policy must be 'propagate', 'omit', or 'raise'."
          )
  
      if handle_inf:
          handler_func = lambda x: ~np.isfinite(x)
      else:
          handler_func = isnull
  
      if nan_policy == "omit":
          # mask locates any values to remove
          mask = ~handler_func(arr)
          if not np.all(
              mask
          ):  # there are some NaNs/infs/missing values
              return arr[mask]
  
      if nan_policy == "raise":
          try:
              # Calling np.sum to avoid creating a huge array into memory
              # e.g. np.isnan(a).any()
              with np.errstate(invalid="ignore"):
                  contains_nan = handler_func(np.sum(arr))
          except TypeError:
              # If the check cannot be properly performed we fallback to omitting
              # nan values and raising a warning. This can happen when attempting to
              # sum things that are not numbers (e.g. as in the function `mode`).
              contains_nan = False
              warnings.warn(
                  "The input array could not be checked for NaNs. "
                  "NaNs will be ignored.",
                  RuntimeWarning,
              )
  
          if contains_nan:
              msg = (
                  "NaN values detected in your input data or the output of "
                  "your objective/model function - fitting algorithms cannot "
                  "handle this! Please read https://lmfit.github.io/lmfit-py/faq.html#i-get-errors-from-nan-in-my-fit-what-can-i-do "
                  "for more information."
              )
              raise ValueError(msg)
      return arr
  
imports: from collections import namedtuple
  from copy import deepcopy
  import inspect
  import multiprocessing
  import numbers
  import warnings
  import numpy
  from scipy.linalg import LinAlgError, inv
  from scipy.optimize import basinhopping
  from scipy.optimize import brute
  from scipy.optimize import differential_evolution
  from scipy.optimize import dual_annealing
  from scipy.optimize import least_squares
  from scipy.optimize import leastsq
  from scipy.optimize import minimize
  from scipy.optimize import shgo
  from scipy.sparse import issparse
  from scipy.sparse.linalg import LinearOperator
  from scipy.stats import cauchy
  from scipy.stats import norm
  from ._ampgo import ampgo
  from .parameter import Parameter, Parameters
  from .printfuncs import fitreport_html_table
label_desc: Use image node_id 6 for calling a global function with example usage: coerce_float64(arr, nan_policy, handle_inf, ravel, ravel_order) and returns: arr, arr