From 6ee21aaa02a5c11bd1269bff0bc7d23b0d402c1e Mon Sep 17 00:00:00 2001 From: Chun Hong Yoon Date: Mon, 27 Jan 2014 14:02:34 +0100 Subject: Add two colour spectrum --- libcrystfel/src/image.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/image.h b/libcrystfel/src/image.h index 0c189cad..6b49ad91 100644 --- a/libcrystfel/src/image.h +++ b/libcrystfel/src/image.h @@ -46,7 +46,8 @@ typedef enum { SPECTRUM_TOPHAT, - SPECTRUM_SASE + SPECTRUM_SASE, + SPECTRUM_TWOCOLOUR } SpectrumType; /* Structure describing a feature in an image */ -- cgit v1.2.3 From cae96eaf563f6698b69e142cbf19da0f2888b2bb Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 12 Feb 2014 15:18:36 +0100 Subject: partial_sim: Add --images --- libcrystfel/src/hdf5-file.c | 89 +++++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 43 deletions(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/hdf5-file.c b/libcrystfel/src/hdf5-file.c index ad9495b5..ed3b1e29 100644 --- a/libcrystfel/src/hdf5-file.c +++ b/libcrystfel/src/hdf5-file.c @@ -384,57 +384,60 @@ int hdf5_write_image(const char *filename, struct image *image) H5Dclose(dh); - arr = malloc(image->spectrum_size*sizeof(double)); - if ( arr == NULL ) { - H5Fclose(fh); - return 1; - } - for ( i=0; ispectrum_size; i++ ) { - arr[i] = 1.0e10/image->spectrum[i].k; - } + if ( image->spectrum_size > 0 ) { - size[0] = image->spectrum_size; - sh = H5Screate_simple(1, size, NULL); + arr = malloc(image->spectrum_size*sizeof(double)); + if ( arr == NULL ) { + H5Fclose(fh); + return 1; + } + for ( i=0; ispectrum_size; i++ ) { + arr[i] = 1.0e10/image->spectrum[i].k; + } - dh = H5Dcreate2(gh, "spectrum_wavelengths_A", H5T_NATIVE_DOUBLE, sh, - H5P_DEFAULT, H5S_ALL, H5P_DEFAULT); - if ( dh < 0 ) { - H5Fclose(fh); - return 1; - } - r = H5Dwrite(dh, H5T_NATIVE_DOUBLE, H5S_ALL, - H5S_ALL, H5P_DEFAULT, arr); - H5Dclose(dh); + size[0] = image->spectrum_size; + sh = H5Screate_simple(1, size, NULL); - for ( i=0; ispectrum_size; i++ ) { - arr[i] = image->spectrum[i].weight; - } - dh = H5Dcreate2(gh, "spectrum_weights", H5T_NATIVE_DOUBLE, sh, - H5P_DEFAULT, H5S_ALL, H5P_DEFAULT); - if ( dh < 0 ) { - H5Fclose(fh); - return 1; - } - r = H5Dwrite(dh, H5T_NATIVE_DOUBLE, H5S_ALL, - H5S_ALL, H5P_DEFAULT, arr); + dh = H5Dcreate2(gh, "spectrum_wavelengths_A", H5T_NATIVE_DOUBLE, + sh, H5P_DEFAULT, H5S_ALL, H5P_DEFAULT); + if ( dh < 0 ) { + H5Fclose(fh); + return 1; + } + r = H5Dwrite(dh, H5T_NATIVE_DOUBLE, H5S_ALL, + H5S_ALL, H5P_DEFAULT, arr); + H5Dclose(dh); - H5Dclose(dh); - free(arr); + for ( i=0; ispectrum_size; i++ ) { + arr[i] = image->spectrum[i].weight; + } + dh = H5Dcreate2(gh, "spectrum_weights", H5T_NATIVE_DOUBLE, sh, + H5P_DEFAULT, H5S_ALL, H5P_DEFAULT); + if ( dh < 0 ) { + H5Fclose(fh); + return 1; + } + r = H5Dwrite(dh, H5T_NATIVE_DOUBLE, H5S_ALL, + H5S_ALL, H5P_DEFAULT, arr); - size[0] = 1; - sh = H5Screate_simple(1, size, NULL); + H5Dclose(dh); + free(arr); - dh = H5Dcreate2(gh, "number_of_samples", H5T_NATIVE_INT, sh, - H5P_DEFAULT, H5S_ALL, H5P_DEFAULT); - if ( dh < 0 ) { - H5Fclose(fh); - return 1; - } + size[0] = 1; + sh = H5Screate_simple(1, size, NULL); + + dh = H5Dcreate2(gh, "number_of_samples", H5T_NATIVE_INT, sh, + H5P_DEFAULT, H5S_ALL, H5P_DEFAULT); + if ( dh < 0 ) { + H5Fclose(fh); + return 1; + } - r = H5Dwrite(dh, H5T_NATIVE_INT, H5S_ALL, - H5S_ALL, H5P_DEFAULT, &image->nsamples); + r = H5Dwrite(dh, H5T_NATIVE_INT, H5S_ALL, + H5S_ALL, H5P_DEFAULT, &image->nsamples); - H5Dclose(dh); + H5Dclose(dh); + } H5Gclose(gh); -- cgit v1.2.3 From 2cb4c47dc477761fb621a4df6683c3f27fc7d5a1 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 13 Feb 2014 11:58:34 +0100 Subject: Don't proceed with integration if no suitable reference reflections were found --- libcrystfel/src/integration.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c index 1b2193fa..b14d0f1c 100644 --- a/libcrystfel/src/integration.c +++ b/libcrystfel/src/integration.c @@ -3,11 +3,11 @@ * * Integration of intensities * - * Copyright © 2012-2013 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * * Authors: - * 2010-2013 Thomas White + * 2010-2014 Thomas White * * This file is part of CrystFEL. * @@ -1483,6 +1483,14 @@ static void integrate_prof2d(IntegrationMethod meth, Crystal *cr, setup_profile_boxes(&ic, list); calculate_reference_profiles(&ic); + for ( i=0; i Date: Thu, 13 Feb 2014 13:46:47 +0100 Subject: Fix previous commit --- libcrystfel/src/integration.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c index b14d0f1c..b86399e9 100644 --- a/libcrystfel/src/integration.c +++ b/libcrystfel/src/integration.c @@ -1485,7 +1485,8 @@ static void integrate_prof2d(IntegrationMethod meth, Crystal *cr, for ( i=0; i