IMP logo
IMP Reference Guide  develop.5dd67dc178,2024/04/28
The Integrative Modeling Platform
FitParameters.h
Go to the documentation of this file.
1 /**
2  * \file IMP/saxs/FitParameters.h \brief
3  *
4  * Copyright 2007-2022 IMP Inventors. All rights reserved.
5  *
6  */
7 
8 #ifndef IMPSAXS_FIT_PARAMETERS_H
9 #define IMPSAXS_FIT_PARAMETERS_H
10 #include <IMP/saxs/saxs_config.h>
11 #include <iostream>
12 
13 IMPSAXS_BEGIN_NAMESPACE
14 
15 //! Parameters of a fit, from ProfileFitter.
16 class IMPSAXSEXPORT FitParameters {
17  public:
19  : chi_square_(0.0), c1_(0.0), c2_(0.0), c_(0.0), o_(0.0),
20  default_chi_square_(0.0), mol_index_(-1) {}
21  FitParameters(double chi_square, double c1, double c2, double c, double o)
22  : chi_square_(chi_square), c1_(c1), c2_(c2), c_(c), o_(o),
23  default_chi_square_(0.0), mol_index_(-1) {}
24  FitParameters(double chi_square, double c1, double c2)
25  : chi_square_(chi_square), c1_(c1), c2_(c2), c_(0.0), o_(0.0),
26  default_chi_square_(0.0), mol_index_(-1) {}
27 
28  double get_score() const { return chi_square_; }
29  double get_chi_square() const { return chi_square_; }
30  double get_c1() const { return c1_; }
31  double get_c2() const { return c2_; }
32  double get_scale() const { return c_; }
33  double get_offset() const { return o_; }
34  double get_default_chi_square() const { return default_chi_square_; }
35  std::string get_pdb_file_name() const { return pdb_file_name_; }
36  std::string get_profile_file_name() const { return profile_file_name_; }
37  int get_mol_index() const { return mol_index_; }
38 
39  void set_score(double score) { chi_square_ = score; }
40  void set_chi_square(double chi_square) { chi_square_ = chi_square; }
41  void set_default_chi_square(double chi_square) { default_chi_square_ = chi_square; }
42  void set_profile_file_name(std::string file_name) {
43  profile_file_name_ = file_name;
44  }
45  void set_pdb_file_name(std::string file_name) { pdb_file_name_ = file_name; }
46  void set_mol_index(int index) { mol_index_ = index; }
47 
48  void show(std::ostream& s) const {
49  if (pdb_file_name_.length() > 0) {
50  s << pdb_file_name_ << " ";
51  }
52  if (profile_file_name_.length() > 0) {
53  s << profile_file_name_ << " ";
54  }
55  s << "Chi^2 = " << chi_square_ << " c1 = " << c1_ << " c2 = " << c2_
56  << " default chi^2 = " << default_chi_square_ << std::endl;
57  }
58 #ifndef SWIG
59  struct compare_fit_parameters {
60  bool operator()(const FitParameters& fp1, const FitParameters& fp2) {
61  return fp1.get_score() < fp2.get_score();
62  }
63  };
64 #endif
65 
66  protected:
67  double chi_square_; // fit score
68  double c1_; // excluded volume fit
69  double c2_; // water layer fit
70  double c_; // scaling
71  double o_; // offset
72  double default_chi_square_; // default chi_square value without fitting c1/c2
73  std::string profile_file_name_;
74  std::string pdb_file_name_;
75  int mol_index_; // unique mol index
76 };
77 
78 IMPSAXS_END_NAMESPACE
79 
80 #endif /* IMPSAXS_FIT_PARAMETERS_H */
Parameters of a fit, from ProfileFitter.
Definition: FitParameters.h:16
std::ostream & show(Hierarchy h, std::ostream &out=std::cout)
Print the hierarchy using a given decorator to display each node.