9 #ifndef IMPSAXS_PROFILE_H
10 #define IMPSAXS_PROFILE_H
12 #include <IMP/saxs/saxs_config.h>
19 IMPSAXS_BEGIN_NAMESPACE
21 class RadialDistributionFunction;
37 class IntensityEntry {
39 IntensityEntry() : q_(0.0), intensity_(0.0), error_(1.0), weight_(1.0) {}
40 IntensityEntry(
Float q) : q_(q),intensity_(0.0),error_(1.0),weight_(1.0) {}
42 : q_(q), intensity_(intensity), error_(error), weight_(1.0) {}
50 friend std::ostream& operator<<(std::ostream& q,
const IntensityEntry& e);
52 friend std::istream& operator>>(std::istream& q, IntensityEntry& e);
56 void calculate_profile(
const Particles& particles,
58 bool reciprocal=
false,
60 double variance_tau=0.1) {
62 "variance not implemented in reciprocal calculation");
63 if(!reciprocal) calculate_profile_real(particles, ff_type,
64 variance, variance_tau);
65 else calculate_profile_reciprocal(particles, ff_type);
69 void calculate_profile_partial(
const Particles& particles,
74 void calculate_profile_partial(
const Particles& particles1,
75 const Particles& particles2,
80 void calculate_profile_reciprocal_partial(
const Particles& particles,
86 void calculate_profile(
const Particles& particles1,
87 const Particles& particles2,
90 double variance_tau=0.1) {
91 calculate_profile_real(particles1, particles2, ff_type,
92 variance, variance_tau);
96 Float calculate_I0(
const Particles& particles,
100 void calculate_profile_constant_form_factor(
const Particles& particles,
101 Float form_factor = 1.0);
106 void calculate_profile_symmetric(
const Particles& particles,
unsigned int n,
111 Float max_distance)
const;
117 void add(
const Profile& other_profile,
Float weight = 1.0);
120 void add_partial_profiles(
const Profile& other_profile,
Float weight = 1.0);
123 void background_adjust(
double start_q);
129 void offset(
Float c);
132 void read_SAXS_file(
const String& file_name);
138 void write_SAXS_file(
const String& file_name,
Float max_q=0.0)
const;
140 void write_partial_profiles(
const String& file_name)
const;
158 unsigned int size()
const {
return profile_.size(); }
161 Float get_intensity(
unsigned int i)
const {
return profile_[i].intensity_; }
162 Float get_q(
unsigned int i)
const {
return profile_[i].q_; }
163 Float get_error(
unsigned int i)
const {
return profile_[i].error_; }
164 Float get_weight(
unsigned int i)
const {
return profile_[i].weight_; }
165 Float get_variance(
unsigned int i,
unsigned int j)
const
166 {
unsigned a=std::min(i,j);
unsigned b=std::max(i,j);
167 return variances_[a][b-a]; }
169 Float get_average_radius()
const {
return average_radius_; }
171 void set_intensity(
unsigned int i,
Float iq) { profile_[i].intensity_ = iq; }
176 void set_average_radius(
Float r) { average_radius_ = r; }
178 void set_average_volume(
Float v) { average_volume_ = v; }
182 profile_.push_back(IntensityEntry(q, intensity, error));
186 bool is_uniform_sampling()
const;
192 void add_noise(
Float percentage = 0.03);
198 static const Float modulation_function_parameter_;
201 void init(
bool variance =
false);
203 void calculate_profile_reciprocal(
const Particles& particles,
206 void calculate_profile_reciprocal(
const Particles& particles1,
207 const Particles& particles2,
210 void calculate_profile_real(
const Particles& particles,
212 bool variance =
false,
213 double variance_tau = 0.1);
215 void calculate_profile_real(
const Particles& particles1,
216 const Particles& particles2,
218 bool variance =
false,
219 double variance_tau = 0.1);
223 bool variance=
false,
double variance_tau=0.1);
225 void squared_distributions_2_partial_profiles(
226 const std::vector<RadialDistributionFunction>& r_dist);
228 double radius_of_gyration_fixed_q(
double end_q)
const;
231 std::vector<IntensityEntry> profile_;
232 std::vector<std::vector<double> > variances_;
233 Float min_q_, max_q_;
236 std::vector<Profile> partial_profiles_;
238 Float average_radius_;
239 Float average_volume_;
242 IMPSAXS_END_NAMESPACE