aboutsummaryrefslogtreecommitdiff
path: root/src/partialator.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-06-27 16:34:45 +0200
committerThomas White <taw@physics.org>2019-07-17 09:22:23 +0200
commit7601a2956156569461498a76105267129e848fb0 (patch)
tree74abe507007eda637731c1d728f9392d8b471a40 /src/partialator.c
parentcccf87c808f430274a0691a0c9557d6f14bf74a9 (diff)
partialator: Use Spectrum API
Diffstat (limited to 'src/partialator.c')
-rw-r--r--src/partialator.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/partialator.c b/src/partialator.c
index 92fcfbe4..de7eeb4b 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -570,8 +570,11 @@ static void skip_to_end(FILE *fh)
}
-static int set_initial_params(Crystal *cr, FILE *fh)
+static int set_initial_params(Crystal *cr, FILE *fh, double force_bandwidth,
+ double force_radius, double force_lambda)
{
+ struct image *image = crystal_get_image(cr);
+
if ( fh != NULL ) {
int err;
@@ -596,6 +599,17 @@ static int set_initial_params(Crystal *cr, FILE *fh)
}
+ if ( force_bandwidth > 0.0 ) {
+ image->bw = force_bandwidth;
+ }
+ if ( force_radius > 0.0 ) {
+ crystal_set_profile_radius(cr, force_radius);
+ }
+ if ( force_lambda > 0.0 ) {
+ image->lambda = force_lambda;
+ }
+ image->spectrum = spectrum_generate_gaussian(image->lambda, image->bw);
+
return 0;
}
@@ -1420,7 +1434,9 @@ int main(int argc, char *argv[])
crystal_set_user_flag(cr, PRFLAG_OK);
reflist_free(cr_refl);
- if ( set_initial_params(cr, sparams_fh) ) {
+ if ( set_initial_params(cr, sparams_fh, force_bandwidth,
+ force_radius, force_lambda) )
+ {
ERROR("Failed to set initial parameters\n");
return 1;
}
@@ -1451,15 +1467,6 @@ int main(int argc, char *argv[])
STATUS("Initial partiality calculation...\n");
for ( i=0; i<n_crystals; i++ ) {
Crystal *cr = crystals[i];
- if ( force_bandwidth > 0.0 ) {
- crystal_get_image(cr)->bw = force_bandwidth;
- }
- if ( force_radius > 0.0 ) {
- crystal_set_profile_radius(cr, force_radius);
- }
- if ( force_lambda > 0.0 ) {
- crystal_get_image(cr)->lambda = force_lambda;
- }
update_predictions(cr);
calculate_partialities(cr, pmodel);
}