Ejemplo n.º 1
0
static void write_peaks(struct image *image, FILE *ofh)
{
	int i;

	fprintf(ofh, PEAK_LIST_START_MARKER"\n");
	fprintf(ofh, "  fs/px   ss/px  (1/d)/nm^-1   Intensity\n");

	for ( i=0; i<image_feature_count(image->features); i++ ) {

		struct imagefeature *f;
		struct rvec r;
		double q;

		f = image_get_feature(image->features, i);
		if ( f == NULL ) continue;

		r = get_q(image, f->fs, f->ss, NULL, 1.0/image->lambda);
		q = modulus(r.u, r.v, r.w);

		fprintf(ofh, "%7.2f %7.2f   %10.2f  %10.2f\n",
		       f->fs, f->ss, q/1.0e9, f->intensity);

	}

	fprintf(ofh, PEAK_LIST_END_MARKER"\n");
}
Ejemplo n.º 2
0
static int write_peaks(struct image *image, FILE *ofh)
{
	int i;

	fprintf(ofh, PEAK_LIST_START_MARKER"\n");
	fprintf(ofh, "  fs/px   ss/px  (1/d)/nm^-1   Intensity\n");

	for ( i=0; i<image_feature_count(image->features); i++ ) {

		struct imagefeature *f;
		struct rvec r;
		double q;

		f = image_get_feature(image->features, i);
		if ( f == NULL ) continue;

		r = get_q(image, f->fs, f->ss, NULL, 1.0/image->lambda);
		q = modulus(r.u, r.v, r.w);

		if ( image->det != NULL ) {

			struct panel *p;
			double write_fs, write_ss;

			p = find_orig_panel(image->det, f->fs, f->ss);
			if ( p == NULL ) {
				ERROR("Panel not found\n");
				return 1;
			}

			/* Convert coordinates to match arrangement of panels in
			 * HDF5 file */
			write_fs = f->fs - p->min_fs + p->orig_min_fs;
			write_ss = f->ss - p->min_ss + p->orig_min_ss;

			fprintf(ofh, "%7.2f %7.2f   %10.2f  %10.2f\n",
			        write_fs, write_ss, q/1.0e9, f->intensity);

		} else {

			fprintf(ofh, "%7.2f %7.2f   %10.2f  %10.2f\n",
			        f->fs, f->ss, q/1.0e9, f->intensity);

		}

	}

	fprintf(ofh, PEAK_LIST_END_MARKER"\n");
	return 0;
}