コード例 #1
0
ファイル: Distribution.cpp プロジェクト: AljGaber/imp
double RadialDistributionFunction::R_factor_score(
    const RadialDistributionFunction& model_pr,
    const std::string& file_name) const {
  double sum1 = 0.0, sum2 = 0.0;
  unsigned int distribution_size = std::min(size(), model_pr.size());

  for (unsigned int i = 0; i < distribution_size; i++) {
    sum1 += std::abs((*this)[i] - model_pr[i]);
    sum2 += std::abs((*this)[i]);
  }

  if (file_name.length() > 0) write_fit_file(model_pr, 1.0, file_name);

  return sum1 / sum2;
}
コード例 #2
0
WeightedFitParameters WeightedProfileFitter::fit_profile(
                            ProfilesTemp partial_profiles,
                            float min_c1, float max_c1,
                            float min_c2, float max_c2,
                            const std::string fit_file_name) const {

  std::vector<double> weights;
  WeightedFitParameters fp = search_fit_parameters(partial_profiles,
                                           min_c1, max_c1, min_c2, max_c2,
                                           std::numeric_limits<float>::max(),
                                           weights);

  if(fit_file_name.size() > 0)
    write_fit_file(partial_profiles, fp, fit_file_name);

  return fp;
}
コード例 #3
0
ファイル: Distribution.cpp プロジェクト: AljGaber/imp
double RadialDistributionFunction::fit(
    const RadialDistributionFunction& model_pr,
    const std::string& file_name) const {
  double max_value = 0.0;
  unsigned int max_index = 0;
  for (unsigned int i = 0; i < size(); i++) {
    if ((*this)[i] > max_value) {
      max_value = (*this)[i];
      max_index = i;
    }
  }
  double c = max_value / model_pr[max_index];

  double sum1 = 0.0, sum2 = 0.0;
  unsigned int distribution_size = std::min(size(), model_pr.size());
  for (unsigned int i = 0; i < distribution_size; i++) {
    sum1 += std::abs((*this)[i] - c * model_pr[i]);
    sum2 += std::abs((*this)[i]);
  }

  if (file_name.length() > 0) write_fit_file(model_pr, c, file_name);

  return sum1 / sum2;
}