00001
00002
00003
00004
00005
00006
00007
00008 #ifndef IMPSAXS_SCORE_H
00009 #define IMPSAXS_SCORE_H
00010
00011 #include "saxs_config.h"
00012 #include "Distribution.h"
00013 #include "Profile.h"
00014
00015 #include <IMP/Model.h>
00016
00017 #include <iostream>
00018 #include <vector>
00019
00020 IMPSAXS_BEGIN_NAMESPACE
00021
00022 class Profile;
00023
00024
00025
00026
00027
00028
00029 class IMPSAXSEXPORT Score: public RefCounted {
00030 public:
00031
00032
00033
00034
00035 Score(const Profile& exp_profile);
00036
00037
00038 Float compute_chi_score(const Profile& model_profile,
00039 bool use_offset = false,
00040 const std::string fit_file_name = "") const {
00041 return sqrt(compute_chi_square_score(model_profile,
00042 use_offset, fit_file_name));
00043 }
00044
00045
00046 Float compute_chi_square_score(const Profile& model_profile,
00047 bool use_offset = false,
00048 const std::string fit_file_name = "") const;
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 void compute_chi_derivative(const Profile& model_profile,
00059 const Particles& particles,
00060 std::vector<algebra::VectorD<3> >& derivatives,
00061 bool use_offset = false) const {
00062 return compute_chi_derivative(model_profile, particles, particles,
00063 derivatives, use_offset);
00064 }
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078 void compute_chi_derivative(const Profile& model_profile,
00079 const Particles& particles1,
00080 const Particles& particles2,
00081 std::vector<algebra::VectorD<3> >& derivatives,
00082 bool use_offset = false) const;
00083
00084
00085 Float compute_scale_factor(const Profile& model_profile,
00086 Float offset = 0.0) const;
00087
00088 Float compute_offset(const Profile& model_profile) const;
00089
00090 private:
00091
00092 void resample(const Profile& model_profile, Profile& resampled_profile) const;
00093
00094
00095 Float compute_chi_square_score_internal(const Profile& model_profile,
00096 const std::string& fit_file_name,
00097 bool use_offset = false) const;
00098
00099
00100 Float compute_chi_square_score_internal(const Profile& model_profile,
00101 const Float c, const Float offset) const;
00102
00103
00104 void write_SAXS_fit_file(const std::string& file_name,
00105 const Profile& model_profile,
00106 const Float chi_square,
00107 const Float c=1, const Float offset=0) const;
00108
00109
00110 void compute_chi_real_derivative(const Profile& model_profile,
00111 const Particles& particles1,
00112 const Particles& particles2,
00113 std::vector<algebra::VectorD<3> >& derivatives,
00114 bool use_offset) const;
00115
00116
00117 void compute_profile_difference(const Profile& model_profile,
00118 const Float c, const Float offset,
00119 Floats& profile_diff) const;
00120
00121
00122 void compute_sinc_cos(Float pr_resolution, Float max_distance,
00123 const Profile& model_profile,
00124 std::vector<Floats>& output_values) const;
00125 IMP_REF_COUNTED_DESTRUCTOR(Score);
00126 protected:
00127 const Profile& exp_profile_;
00128 };
00129
00130 IMPSAXS_END_NAMESPACE
00131
00132 #endif