00001
00002
00003
00004
00005
00006
00007 #ifndef IMPSAXS_PROFILE_H
00008 #define IMPSAXS_PROFILE_H
00009
00010 #include "saxs_config.h"
00011 #include "FormFactorTable.h"
00012 #include "Distribution.h"
00013
00014 #include <IMP/Model.h>
00015
00016 #include <iostream>
00017 #include <vector>
00018
00019 IMPSAXS_BEGIN_NAMESPACE
00020
00021 class RadialDistributionFunction;
00022
00023
00024
00025
00026
00027
00028 class IMPSAXSEXPORT Profile {
00029 public:
00030
00031 Profile(const String& file_name);
00032
00033
00034 Profile(Float qmin = 0.0, Float qmax = 0.5, Float delta = 0.005);
00035
00036 private:
00037 class IntensityEntry {
00038 public:
00039 IntensityEntry() : q_(0.0), intensity_(0.0), error_(1.0), weight_(1.0) {}
00040 IntensityEntry(Float q) : q_(q),intensity_(0.0),error_(1.0),weight_(1.0) {}
00041 IntensityEntry(Float q, Float intensity, Float error)
00042 : q_(q), intensity_(intensity), error_(error), weight_(1.0) {}
00043
00044 Float q_;
00045 Float intensity_;
00046 Float error_;
00047 Float weight_;
00048 };
00049
00050 friend std::ostream& operator<<(std::ostream& q, const IntensityEntry& e);
00051
00052 friend std::istream& operator>>(std::istream& q, IntensityEntry& e);
00053
00054 public:
00055
00056 void calculate_profile(const Particles& particles,
00057 bool reciprocal=false, bool autocorrelation = true) {
00058 if(!reciprocal) calculate_profile_real(particles, autocorrelation);
00059 else calculate_profile_reciprocal(particles);
00060 }
00061
00062
00063
00064
00065 void calculate_profile(const Particles& particles, unsigned int n) {
00066 calculate_profile_real(particles, n);
00067 }
00068
00069
00070 void calculate_profile_partial(const Particles& particles,
00071 const Floats& surface = Floats(),
00072 bool autocorrelation = true);
00073
00074 void calculate_profile_partial(const Particles& particles1,
00075 const Particles& particles2);
00076
00077
00078
00079 void calculate_profile(const Particles& particles1,
00080 const Particles& particles2) {
00081 calculate_profile_real(particles1, particles2);
00082 }
00083
00084
00085 void profile_2_distribution(RadialDistributionFunction& rd,
00086 Float max_distance) const;
00087
00088
00089 void distribution_2_profile(const RadialDistributionFunction& r_dist);
00090
00091
00092 void add(const Profile& other_profile);
00093
00094
00095 void add_partial_profiles(const Profile& other_profile);
00096
00097
00098 void background_adjust(double start_q);
00099
00100
00101 void scale(Float c);
00102
00103
00104 void offset(Float c);
00105
00106
00107 void read_SAXS_file(const String& file_name);
00108
00109
00110 void write_SAXS_file(const String& file_name);
00111
00112
00113 Float get_delta_q() const { return delta_q_; }
00114
00115
00116 Float get_min_q() const { return min_q_; }
00117
00118
00119 Float get_max_q() const { return max_q_; }
00120
00121
00122 unsigned int size() const { return profile_.size(); }
00123
00124 Float get_intensity(unsigned int i) const { return profile_[i].intensity_; }
00125 Float get_q(unsigned int i) const { return profile_[i].q_; }
00126 Float get_error(unsigned int i) const { return profile_[i].error_; }
00127 Float get_weight(unsigned int i) const { return profile_[i].weight_; }
00128
00129 void set_intensity(unsigned int i, Float iq) { profile_[i].intensity_ = iq; }
00130
00131
00132 void add_entry(Float q, Float intensity, Float error=1.0) {
00133 profile_.push_back(IntensityEntry(q, intensity, error));
00134 }
00135
00136
00137 bool is_uniform_sampling() const;
00138
00139
00140 void add_errors();
00141
00142
00143 void sum_partial_profiles(Float c1, Float c2, Profile& out_profile);
00144
00145
00146 static const Float modulation_function_parameter_;
00147
00148 private:
00149 void init();
00150
00151 void calculate_profile_reciprocal(const Particles& particles,
00152 bool autocorrelation = true);
00153
00154 void calculate_profile_reciprocal(const Particles& particles1,
00155 const Particles& particles2);
00156
00157 void calculate_profile_real(const Particles& particles,
00158 bool autocorrelation = true);
00159
00160 void calculate_profile_real(const Particles& particles1,
00161 const Particles& particles2);
00162
00163
00164
00165
00166
00167
00168 void squared_distribution_2_profile(const RadialDistributionFunction& r_dist);
00169 void squared_distributions_2_partial_profiles(
00170 const std::vector<RadialDistributionFunction>& r_dist);
00171
00172 protected:
00173 std::vector<IntensityEntry> profile_;
00174 Float min_q_, max_q_;
00175 Float delta_q_;
00176 FormFactorTable* ff_table_;
00177 std::vector<Profile> partial_profiles_;
00178 bool experimental_;
00179 };
00180
00181 IMPSAXS_END_NAMESPACE
00182
00183 #endif