def _check_input_diffs(self, connections, params_dict, unknowns_dict):
        """For all sets of connected inputs, find any differences in units
        or initial value.
        """
        # loop over all dangling inputs
        for tgt, connected_inputs in iteritems(self._input_inputs):

            # figure out if any connected inputs have different initial
            # values or different units
            tgt_idx = connected_inputs.index(tgt)
            units = [params_dict[n].get('units') for n in connected_inputs]
            vals = [params_dict[n]['val'] for n in connected_inputs]

            diff_units = []

            for i, u in enumerate(units):
                if i != tgt_idx and u != units[tgt_idx]:
                    if units[tgt_idx] is None:
                        sname, s = connected_inputs[i], u
                        tname, t = connected_inputs[tgt_idx], units[tgt_idx]
                    else:
                        sname, s = connected_inputs[tgt_idx], units[tgt_idx]
                        tname, t = connected_inputs[i], u

                    diff_units.append((connected_inputs[i], u))

            if isinstance(vals[tgt_idx], np.ndarray):
                diff_vals = [(connected_inputs[i],v) for i,v in
                               enumerate(vals) if not
                                   (isinstance(v, np.ndarray) and
                                      v.shape==vals[tgt_idx].shape and
                                      (v==vals[tgt_idx]).all())]
            else:
                vtype = type(vals[tgt_idx])
                diff_vals = [(connected_inputs[i],v) for i,v in
                                 enumerate(vals) if vtype!=type(v) or
                                                      v!=vals[tgt_idx]]

            # if tgt has no unknown source, units MUST match, unless
            # one of them is None. At this point, connections contains
            # only unknown to input connections, so if the target is
            # in connections, it has an unknown source.

            if diff_units:
                filt = set([u for n,u in diff_units])
                if None in filt:
                    filt.remove(None)
                if filt:
                    proms = set([params_dict[item]['top_promoted_name'] \
                                 for item in connected_inputs])

                    # All params are promoted, so extra message for clarity.
                    if len(proms) == 1:
                        msg = "The following connected inputs are promoted to " + \
                            "'%s', but have different units" % proms.pop()
                    else:
                        msg = "The following connected inputs have no source and different " + \
                              "units"

                    msg += ": %s." % sorted([(tgt, params_dict[tgt].get('units'))] + \
                                            diff_units)
                    correct_src = params_dict[connected_inputs[0]]['top_promoted_name']
                    msg += " Connect '%s' to a source (such as an IndepVarComp)" % correct_src + \
                           " with defined units."

                    self._setup_errors.append(msg)
            if diff_vals:
                msg = ("The following sourceless connected inputs have "
                       "different initial values: "
                       "%s.  Connect one of them to the output of "
                       "an IndepVarComp to ensure that they have the "
                       "same initial value." %
                       (sorted([(tgt,params_dict[tgt]['val'])]+
                                         diff_vals)))
                self._setup_errors.append(msg)

        # now check for differences in step_size, step_type, or form for
        # promoted inputs
        for promname, absnames in iteritems(self.root._sysdata.to_abs_pnames):
            if len(absnames) > 1:
                step_sizes, step_types, forms = {}, {}, {}
                for name in absnames:
                    meta = self.root._params_dict[name]
                    ss = meta.get('step_size')
                    if ss is not None:
                        step_sizes[ss] = name
                    st = meta.get('step_type')
                    if st is not None:
                        step_types[st] = name
                    f = meta.get('form')
                    if f is not None:
                        forms[f] = name

                if len(step_sizes) > 1:
                    self._setup_errors.append("The following parameters have the same "
                                  "promoted name, '%s', but different "
                                  "'step_size' values: %s" % (promname,
                                  sorted([(v,k) for k,v in step_sizes.items()])))

                if len(step_types) > 1:
                    self._setup_errors.append("The following parameters have the same "
                                  "promoted name, '%s', but different "
                                  "'step_type' values: %s" % (promname,
                                 sorted([(v,k) for k,v in step_types.items()])))

                if len(forms) > 1:
                    self._setup_errors.append("The following parameters have the same "
                                  "promoted name, '%s', but different 'form' "
                                  "values: %s" % (promname,
                                      sorted([(v,k) for k,v in forms.items()])))
dataset/ETHPy150Open OpenMDAO/OpenMDAO/openmdao/core/problem.py/Problem._check_input_diffs/original