Detector

Detector — Detector geometry

Functions

Types and Values

struct detector
struct panel
struct badregion
struct rigid_group
struct rg_collection

Includes

#include "detector.h"

Description

This structure represents the detector geometry

Functions

copy_geom ()

struct detector *
copy_geom (const struct detector *in);

fill_in_adu ()

void
fill_in_adu (struct image *image);

free_detector_geometry ()

void
free_detector_geometry (struct detector *det);

get_detector_geometry ()

struct detector *
get_detector_geometry (const char *filename,
                       struct beam_params *beam);

get_detector_geometry_2 ()

struct detector *
get_detector_geometry_2 (const char *filename,
                         struct beam_params *beam,
                         char **hdf5_peak_path);

write_detector_geometry ()

int
write_detector_geometry (const char *geometry_filename,
                         const char *output_filename,
                         struct detector *det);

write_detector_geometry_2 ()

int
write_detector_geometry_2 (const char *geometry_filename,
                           const char *output_filename,
                           struct detector *det,
                           const char *additional_comment,
                           int write_panel_coffset);

panel_number ()

int
panel_number (struct detector *det,
              struct panel *p);

find_panel_by_name ()

struct panel *
find_panel_by_name (struct detector *det,
                    const char *name);

simple_geometry ()

struct detector *
simple_geometry (const struct image *image,
                 int w,
                 int h);

record_image ()

void
record_image (struct image *image,
              int do_poisson,
              double background,
              gsl_rng *rng,
              double beam_radius,
              double nphotons);

get_pixel_extents ()

void
get_pixel_extents (struct detector *det,
                   double *min_x,
                   double *min_y,
                   double *max_x,
                   double *max_y);

get_q_for_panel ()

struct rvec
get_q_for_panel (struct panel *p,
                 double fs,
                 double ss,
                 double *ttp,
                 double k);

get_tt ()

double
get_tt (struct image *image,
        double xs,
        double ys,
        int *err);

smallest_q ()

double
smallest_q (struct image *image);

reverse_2d_mapping ()

int
reverse_2d_mapping (double x,
                    double y,
                    struct detector *det,
                    struct panel **pp,
                    double *pfs,
                    double *pss);

largest_q ()

double
largest_q (struct image *image);

in_bad_region ()

int
in_bad_region (struct detector *det,
               struct panel *p,
               double fs,
               double ss);

mark_resolution_range_as_bad ()

void
mark_resolution_range_as_bad (struct image *image,
                              double min,
                              double max);

Flags, in the bad pixel mask for image , every pixel whose resolution is between min and max .

Parameters

image

An image structure

 

min

Minimum value of 1/d to be marked as bad

 

max

Maximum value of 1/d to be marked as bad

 

find_orig_panel ()

struct panel *
find_orig_panel (struct detector *det,
                 double fs,
                 double ss);

find_orig_panel_number ()

signed int
find_orig_panel_number (struct detector *det,
                        double fs,
                        double ss);

panel_is_in_rigid_group ()

int
panel_is_in_rigid_group (const struct rigid_group *rg,
                         struct panel *p);

rigid_group_is_in_collection ()

int
rigid_group_is_in_collection (struct rg_collection *c,
                              struct rigid_group *rg);

single_panel_data_source ()

int
single_panel_data_source (struct detector *det,
                          const char *element);

Parameters

det

A detector structure

 

element

If manually selected by the user, the HDF5 element being used. Otherwise NULL.

 

Returns

non-zero if the combination of det and element mean that all the data comes from a single block.


find_rigid_group_collection_by_name ()

struct rg_collection *
find_rigid_group_collection_by_name (struct detector *det,
                                     const char *name);

detector_has_clen_references ()

int
detector_has_clen_references (struct detector *det);

adjust_centering_for_rail ()

void
adjust_centering_for_rail (struct panel *p);

Types and Values

struct detector

struct detector {
	struct panel     *panels;
	int               n_panels;

	struct badregion *bad;
	int               n_bad;

	unsigned int       mask_bad;
	unsigned int       mask_good;

	struct rigid_group **rigid_groups;
	int                n_rigid_groups;

	struct rg_collection **rigid_group_collections;
	int               	 n_rg_collections;

	/* Location of the pixel furthest away from the beam position, which
	 * will have the largest value of 2theta regardless of camera length
	 * and wavelength */
	struct panel      *furthest_out_panel;
	double             furthest_out_fs;
	double             furthest_out_ss;

	/* As above, but for the smallest 2theta */
	struct panel      *furthest_in_panel;
	double             furthest_in_fs;
	double             furthest_in_ss;

	int                path_dim;
	int                dim_dim;

	struct panel       defaults;
};

struct panel

struct panel {
        char     name[1024];  /* Name for this panel */

        double   cnx;       /* Location of corner (min_fs,min_ss) in pixels */
        double   cny;
        double   coffset;
        double   clen;     /* Camera length in metres */
        char    *clen_from;
        char    *mask;
        char    *mask_file;
	char    *satmap;
	char    *satmap_file;
        double   res;      /* Resolution in pixels per metre */
        char     badrow;   /* 'x' or 'y' */
        int      no_index; /* Don't index peaks in this panel if non-zero */
        double   adu_per_photon;   /* Number of ADU per photon */
        double   max_adu;  /* Treat pixel as unreliable if higher than this */
        char    *data;

        double   adu_per_eV;   /* Number of ADU per eV */

        struct dim_structure *dim_structure;

        double fsx;
        double fsy;
        double fsz;
        double ssx;
        double ssy;
        double ssz;

        double rail_x;
        double rail_y;
        double rail_z;
        double clen_for_centering;

        double xfs;
        double yfs;
        double xss;
        double yss;

        /* Position of the panel in the data block in the file.  The panels may
         * get moved around when the file is loaded (see hdf5_read2()),
         * especially if the panels come from different HDF5 elements. */
        int orig_min_fs;
        int orig_max_fs;
        int orig_min_ss;
        int orig_max_ss;

        int w;  /* Width, calculated as max_fs-min_fs+1 */
        int h;  /* Height, calculated as max_ss-min_ss+1 */
};

Members

char name[1024];

Text name for the panel (fixed length array)

 

double cnx;

Location of corner, in pixels, x coordinate

 

double cny;

Location of corner, in pixels, y coordinate

 

double coffset;

The offset to be applied from clen (which may come from elsewhere)

 

double clen;

The distance from the interaction point to the corner of the first pixel

 

char *clen_from;

Location to get clen from, e.g. from HDF5 file

 

char *mask;

Location of mask data

 

char *mask_file;

Filename for mask data

 

char *satmap;

Location of per-pixel saturation map

 

char *satmap_file;

Filename for saturation map

 

double res;

Resolution of panel in pixels per metre

 

char badrow;

Readout direction (for filtering out clusters of peaks)

 

int no_index;

Non-zero if panel is entirely "bad"

 

double adu_per_photon;

Number of detector intensity units per photon

 

double max_adu;

Saturation value

 

char *data;

Location of data in file

 

double adu_per_eV;

Number of detector intensity units per eV of photon energy

 

struct dim_structure *dim_structure;

Dimension structure

 

double fsx;

Real-space x-direction of data fast-scan direction

 

double fsy;

Real-space y-direction of data fast-scan direction

 

double fsz;

Real-space z-direction of data fast-scan direction

 

double ssx;

Real-space x-direction of data slow-scan direction

 

double ssy;

Real-space y-direction of data slow-scan direction

 

double ssz;

Real-space z-direction of data slow-scan direction

 

double rail_x;

x direction of camera length "rail"

 

double rail_y;

y direction of camera length "rail"

 

double rail_z;

z direction of camera length "rail"

 

double clen_for_centering;

Value of clen (without coffset) at which beam is centered

 

double xfs;

Data fast-scan direction of real-space x-direction

 

double yfs;

Data fast-scan direction of real-space y-direction

 

double xss;

Data slow-scan direction of real-space x-direction

 

double yss;

Data slow-scan direction of real-space y-direction

 

int orig_min_fs;

Minimum fs coordinate of data in file

 

int orig_max_fs;

Maximum fs coordinate of data in file

 

int orig_min_ss;

Minimum ss coordinate of data in file (inclusive)

 

int orig_max_ss;

Maximum ss coordinate of data in file (inclusive)

 

int w;

Width of panel

 

int h;

Height of panel

 

struct badregion

struct badregion {
	char name[1024];
	int is_fsss;
	char *panel;

	double min_x;
	double max_x;
	double min_y;
	double max_y;

	/* Specified INCLUSIVELY */
	int      min_fs;
	int      max_fs;
	int      min_ss;
	int      max_ss;
};

struct rigid_group

struct rigid_group {
	char *name;
	struct panel **panels;
	int n_panels;

	/* Updates to panel position calculated during integration */
	double d_fsx;
	double d_ssx;
	double d_cnx;
	double d_fsy;
	double d_ssy;
	double d_cny;
	int have_deltas;
};

struct rg_collection

struct rg_collection {
	char *name;
	struct rigid_group **rigid_groups;
	int n_rigid_groups;
};