code: def round_to_n_decimal_places(array, n=3):
      
      # check if in scientific notation
      if issubclass(array.__class__, float) and '%.e'%array == str(array):
          return array # do nothing
  
      shape = np.shape(array)
      out = ((np.atleast_1d(array) * 10**n).round().astype('int') / (10.**n))
      return out.reshape(shape)
docs: tool to keep round a float to n decimal places.
  
      n=3 by default
  
      Parameters
      ----------
      array : np.array
      n : int. number of decimal places to keep
  
      Returns
      -------
      array : rounded np.array