Find the errors in the energy values.

    This function finds the errors in the enthalpys.

    Parameters
    ----------
    vals : list of lists of floats

    Returns
    -------
    err_vals : list of lists containing the errors.
333809
def _find_error(vals):
    

    err_vals = []
    for en in vals:
        c = en[2]
        conc = [float(i)/sum(c) for i in c]

        err = abs(en[0]-en[1])

        err_vals.append([conc,err])

    return err_vals
68123
def _parse_qual(self, data):
        
        list = []
        headers = data.split(':')
        name = headers[0].strip()

        name = re.split(' IN ', name, flags=re.I) # ignore case
        units = None
        if len(name) > 1:
            units = name[1].strip()
        name = name[0].strip()

        if len(headers) < 2:
            raise BadFormat("*qual line must contain a name and values: %s" % data)

        for header in headers[1:]:
            xheader = {'name': name}
            if units:
                xheader['units'] = units

            xheader['value'] = header.strip()
            list.append(xheader)

            # extract energy if SQRT(S) is one of the qualifiers
            if name.startswith('SQRT(S)') and lower(units) in ('gev'):
                energies = re.split(' TO ', xheader['value'], flags=re.I)
                for energy in energies:
                    try:
                        energy = float(energy)
                        self.set_of_energies.add(energy)
                    except:
                        pass

        self.current_table.qualifiers.append(list)
586544
def itervalues(d, **kw):
    """"""
    if not PY2:
        return iter(d.values(**kw))
    return d.itervalues(**kw)
1064383
def _values(self):
        """"""
        return [
            val for serie in self.series for val in serie.values
            if val is not None
        ]
532367
def errors(self, value):
        
        if value not in self.values:
            return [Error(self._error_message, code=ERROR_CODE_UNKNOWN)]
        return []
1053946
def volume_to_distance_with_errors(vol, vol_err):
    
    dist = (vol * 3.0/4.0/numpy.pi) ** (1.0/3.0)
    ehigh = ((vol + vol_err) * 3.0/4.0/numpy.pi) ** (1.0/3.0) - dist
    delta = numpy.where(vol >= vol_err, vol - vol_err, 0)
    elow = dist - (delta * 3.0/4.0/numpy.pi) ** (1.0/3.0)
    return dist, ehigh, elow
1324739
int errorv(float[] a) {
        int best = best(a, 1);
        for (int k = 0; k < dim; k++) {
            a[k] = valuelist[best * dim + k];
        }
        return (best);
    }
1354229
def _get_corr_stddevs(C, tau_ss, stddev_types, num_sites, phi_ss, NL=None,
                      tau_value=None):
    
    stddevs = []
    temp_stddev = phi_ss * phi_ss

    if tau_value is not None and NL is not None:
        temp_stddev = temp_stddev + tau_value * tau_value * ((1 + NL) ** 2)
    else:
        temp_stddev = temp_stddev + C[tau_ss] * C[tau_ss]

    for stddev_type in stddev_types:
        if stddev_type == const.StdDev.TOTAL:
            stddevs.append(np.sqrt(temp_stddev) + np.zeros(num_sites))
    return stddevs
799240
def unpack_hyperopt_vals(vals):
    
    assert isinstance(vals, dict), "Parameter must be given as dict."
    ret = {}
    for k, v in list(vals.items()):
        try:
            ret[k] = v[0]
        except (TypeError, IndexError):
            ret[k] = v
    return ret
1288312
def kl_error(self, input_data, targets, average=True,
                 cache=None, prediction=True):
        

        if cache is not None:
            activations = cache
        else:
            activations = \
              self.feed_forward(input_data, prediction=prediction)

        targets_non_nan = gpuarray.empty_like(targets)
        nan_to_zeros(targets, targets_non_nan)
        kl_error = gpuarray.sum(targets_non_nan *
                                (cumath.log(targets_non_nan + eps) -
                                 cumath.log(activations + eps)))
        if average:
            kl_error /= targets.shape[0]
        return kl_error.get()
880242
def _std_err(self):
        
        return np.sqrt(np.sum(np.square(self._resids), axis=1) / self._df_err)
635001
def sorted_errors(self):
        
        for i, (name, mae) in enumerate(
                sorted(self.mae_dict.items(), key=lambda x: x[1])):
            yield(i + 1, name, self.mse_dict[name], self.mae_dict[name],)
630773
def _process_items(cls, vals):
        ""
        if type(vals) is cls:
            return vals.data
        elif not isinstance(vals, (list, tuple)):
            vals = [vals]
        items = []
        counts = defaultdict(lambda: 1)
        cls._unpack_paths(vals, items, counts)
        items = cls._deduplicate_items(items)
        return items
782137
def _check_errors(self):
        """"""
        # use this to make sure that sweep, sstart, sstop, and sinterval
        # all have values if one of them has values
        # (P^Q^R^S) OR (-P and -Q and -R and -S)
        # above is the minimal form for this logical statement in DNF
        if not ((self._inn(self.args.sweep) and self._inn(self.args.sstart)
                 and self._inn(self.args.sstop) and self._inn(self.args.sinterval))
                or
                (not self._inn(self.args.sweep) and not self._inn(self.args.sstart) and not
                 self._inn(self.args.sstop) and not self._inn(self.args.sinterval))):
            mutually_inclusive = ["sweep", "sstart", "sstop", "sinterval"]
            print_str = ""
            for each in mutually_inclusive:
                print_str += "    {0}: {1}\n".format(each, getattr(self.args, each))
            raise AssertionError("""You specified one or more of the --sweep,
            --sstart, --stop, or --sinterval arguments but did not specify all of
            them. All of them are required when running the program in sweep mode.
            Do not specify any of these arguments if not running the program in
            sweep mode.\n{0}""".format(print_str))
458931
def proc_val(key, val):
        

        list_type_keys = list(VALID_FEFF_TAGS)
        del list_type_keys[list_type_keys.index("ELNES")]
        del list_type_keys[list_type_keys.index("EXELFS")]
        boolean_type_keys = ()
        float_type_keys = ("S02", "EXAFS", "RPATH")

        def smart_int_or_float(numstr):
            if numstr.find(".") != -1 or numstr.lower().find("e") != -1:
                return float(numstr)
            else:
                return int(numstr)

        try:
            if key.lower() == 'cif':
                m = re.search(r"\w+.cif", val)
                return m.group(0)

            if key in list_type_keys:
                output = list()
                toks = re.split(r"\s+", val)

                for tok in toks:
                    m = re.match(r"(\d+)\*([\d\.\-\+]+)", tok)
                    if m:
                        output.extend([smart_int_or_float(m.group(2))] *
                                      int(m.group(1)))
                    else:
                        output.append(smart_int_or_float(tok))
                return output
            if key in boolean_type_keys:
                m = re.search(r"^\W+([TtFf])", val)
                if m:
                    if m.group(1) == "T" or m.group(1) == "t":
                        return True
                    else:
                        return False
                raise ValueError(key + " should be a boolean type!")

            if key in float_type_keys:
                return float(val)

        except ValueError:
            return val.capitalize()

        return val.capitalize()
3793
def RMSError(self):
        
        tss = 0.0
        size = 0
        for layer in self.layers:
            if layer.type == 'Output':
                tss += layer.TSSError()
                size += layer.size
        return math.sqrt( tss / size )
390776
def error_value_processor(value, error):
    
    if isinstance(error, (str, unicode)):
        try:
            if "%" in error:
                error_float = float(error.replace("%", ""))
                error_abs = (value/100) * error_float
                return error_abs
            elif error == "":
                error = 0.0
            else:
                error = float(error)
        except:
            pass

    return error