Get a result set for the fits for this product
181570
function getFits()
    {
        if (!is_null($this->fits)) {
            return $this->fits;
        }
        if ($productId = (int)$this->getId()) {
            $this->fits = $this->doGetFits($productId);
            return $this->fits;
        }
        return array();
    }
420099
def get_results_range(self):
        
        spec = self.context.getResultsRange()
        if spec:
            return dicts_to_dict(spec, "keyword")
        return ResultsRangeDict()
48028
def get_products_size(products):
        """"""
        size_total = 0
        for title, props in products.items():
            size_product = props["size"]
            size_value = float(size_product.split(" ")[0])
            size_unit = str(size_product.split(" ")[1])
            if size_unit == "MB":
                size_value /= 1024.
            if size_unit == "KB":
                size_value /= 1024. * 1024.
            size_total += size_value
        return round(size_total, 2)
752866
def _search_result(self, name, tipo, obsres, resultid):
        """"""

        instrument = obsres.instrument

        conf = obsres.configuration.uuid

        drp = self.drps.query_by_name(instrument)
        label = drp.product_label(tipo)

        # search results of these OBs
        for prod in self.prod_table[instrument]:
            pid = prod['id']
            if pid == resultid:
                # this is a valid product
                # We have found the result, no more checks
                # Make a copy
                rprod = dict(prod)

                if 'content' in prod:
                    path = prod['content']
                else:
                    # Build path
                    path = build_product_path(drp, self.rootdir, conf, name, tipo, obsres)
                _logger.debug("path is %s", path)
                rprod['content'] = self.product_loader(tipo, name, path)
                return StoredProduct(**rprod)
        else:
            msg = 'result with id %s not found' % (resultid, )
            raise NoResultFound(msg)
527369
def _viewset_results(self):
        """"""
        results = []
        try:
            response = self._viewset_method(
                self._viewset.request, *self._request.args, **self._request.kwargs
            )

            if response.status_code == 200:
                results = response.data

                if not isinstance(results, list):
                    if isinstance(results, dict):
                        # XXX: This can incidently match if a single
                        # object has results key
                        if 'results' in results and isinstance(
                            results['results'], list
                        ):
                            # Support paginated results.
                            results = results['results']
                        else:
                            results.setdefault(self._meta.primary_key, 1)
                            results = [collections.OrderedDict(results)]
                    else:
                        raise ValueError(
                            "Observable views must return a dictionary or a list of dictionaries!"
                        )
        except Http404:
            pass
        except django_exceptions.ObjectDoesNotExist:
            # The evaluation may fail when certain dependent objects (like users) are removed
            # from the database. In this case, the observer is stopped.
            pass

        return results
1233739
def parse_fits(self, fit_name):
        '''
        '''
        fits = self.fits.loc[self.fits.specimen_comp_name ==
                             fit_name].loc[self.fits.specimen_tilt_correction == 0]
        fits.reset_index(inplace=True)
        means = self.means.loc[self.means.site_comp_name ==
                               fit_name].loc[self.means.site_tilt_correction == 0]
        means.reset_index(inplace=True)
        mean_name = str(fit_name) + "_mean"
        setattr(self, fit_name, fits)
        setattr(self, mean_name, means)
902855
def find_best_rsquared(list_of_fits):
        """"""
        res = sorted(list_of_fits, key=lambda x: x.rsquared)
        return res[-1]
343545
def report_fit(self):
        
        if not self.fitted:
            print('Model not yet fit.')
            return

        print('R-Squared: {0:.3f}'.format(self.model_fit.rsquared))
        print('Adj. R-Squared: {0:.3f}'.format(self.model_fit.rsquared_adj))
        print('')

        tbl = PrettyTable(
            ['Component', ])
        tbl = PrettyTable()

        tbl.add_column('Component', self.fit_parameters.index.values)
        for col in ('Coefficient', 'Std. Error', 'T-Score'):
            tbl.add_column(col, self.fit_parameters[col].values)

        tbl.align['Component'] = 'l'
        tbl.float_format = '.3'

        print(tbl)
167089
def results( self ):
        """"""
        return self.report(self.parameters(),
                           self.metadata(),
                           self.experimentalResults())
343710
def __process_results(results):
    
    if 'no match' in results and 'returning 0 elements' in results:
        return []

    result_list = []

    # Splts the result and cuts first and last dataset which are comments
    split = results.split(sep='\n\n')[1:-1]

    for entry in split:
        entry_dict = {}
        for value in entry.split('\n'):
            if len(value) < 1:
                continue
            (desc, val) = value.split(': ')
            entry_dict[desc.replace('-', '')] = val.strip(' ')
        result_list.append(entry_dict)
    return result_list
378936
def parse_result(cls, result):
        
        if isinstance(result, tuple) == 2:
            items, context = result
        else:
            context = {}
            items = result
        return items, context
1353914
def batch(items, size):
    """"""
    return [items[x:x + size] for x in xrange(0, len(items), size)]
948526
def get_products(self):
        
        products = set()
        for _, _, _, react, _ in self.get_kinks():
            products = products.union(set([k.reduced_formula
                                           for k in react.products]))
        return list(products)
839244
def fit(*args)
    range, items = parse_fit_args(args)
    r = range.map{|x| "#{x} "}.join
    c = items.cmd_str
    puts send_cmd("fit #{r}#{c}")
    nil
  end
1252258
function ResultSet(metadata, rows) {
  this.rows = [];
  this.metadata = metadata;
  for (var i = 0; i < rows.length; i++) {
    this.rows.push(new Row(metadata.columnSpecs, rows[i]));
  }
}
555142
def _results(r):
    """
    x, funcalls, iterations, flag = r
    return results(x, funcalls, iterations, flag == 0)
899389
def set_guess_to_fit_result(self):
        
        if self.results is None:
            print("No fit results to use! Run fit() first.")
            return

        # loop over the results and set the guess values
        for n in range(len(self._pguess)): self._pguess[n] = self.results[0][n]

        if self['autoplot']: self.plot()

        return self