pickprofk
Program for e.d. spot integration, using least-squares profile-fitting
C************************** PICKPROFK ********************************** C C Program for e.d. spot integration, using least-squares profile-fitting. C Many features of this program are similar to those found in the old C programs PICKOFF, PICKYCOR and PICKAUTO. The main change is the C introduction of profile-fitting, which might help the accuracy of C measurement of weaker spots. C C remember to change version number if you update. C VX1.00 19.4.92 RH original version C VX1.01 22.5.92 RH substantial general debugging C VX1.02 19.3.96 RH tidy up small raster performance C VX1.03 22.3.96 RH debug lack of NSTEP some headers C VX2.00 23.3.96 RH renamed as PICKPROFA - add unbend option C for use with CCD + tapered fibre optics C VX2.01 14.4.96 RH substantial debugging e.g. subr CENTRE C VX2.02 25.6.96 RH increase spots to 5000 and debug LOSCAL C VX2.03 28.6.96 RH substantial debugging of profile fitting C VX2.04 4.7.96 RH profile flattened prior to normalisation C VX2.05 6.5.97 RH change PEN(2) to PEN(1) C VX2.06 8.11.97 RH add rough code for tilted e.d. LPTYPE=3 C VX2.07 20.11.97 RH extensive debugging of old and new code C remove all JLOOK.le.0 C VX3.00 24.11.97 RH input B3, NCYC added; rename PICKPROFB C VX3.01 25.11.97 RH option for global background averaging C VX3.02 1.12.97 RH radius of gyration, tilted deconvolution C profile LPTYPE=3 has shrink calculated C by deconvoluting radii of gyration C VX3.03 24.12.97 RH apply TILTDIR after lattice refinement C debug plotting of lattice vectors C VX3.04 29.12.97 RH debug GLOBAL, check spot is present C VX4.00 30.12.97 RH subroutine_reindex added, PICKPROFC C VX4.01 17.7.98 RH check input OD range is < NLOOKUP=1500 C VX4.02 29.8.98 RH improved description of ATANGL,ATAXIS C VX5.00 22.8.00 RH convert to plot2000 -> PICKPROFK C " 13.6.01 TSH P2K_FONT needed string terminator C C C Data cards are : C C 1. A,B,G,ANGDIS,SHRINK,TILTDIR,KV,LPRINT C Real space cell dimensions and gamma angle, C angle on film perpendicular to which a shrinkage by factor SHRINK is C applied before calculating tiltaxis and tiltangle (using EMTILT). C TILTDIR - direction of tilt on microscope. C -1 = clockwise on goniometer C +1 = counterclockwise C LPRINT - T = comprehensive printout. C C 2. LUNBEND,LGLOBL,NGLOBL C LUNBEND - T read in distortion correction table TABLEIN and use it to C to correct predicted spot positions. C - F use the input file directly. C LGLOBL - T OR F, apply wider global background subtraction C NGLOBL - number of nearby spots to include global background correct. C C 3. LPROFIT,LPTYPE,LPRANGE,INTERLEAVE,IFLATTEN,PROFMIN,TSIGMA C LPROFIT - T perform profile fitting C - F simple old-fashioned raster C LPTYPE - 0 use single profile for whole film. C - 1 learn total of 5 profiles (4 outside quarters and centre) C stored in APROF C - 2 calculate profiles on a spot-by-spot basis, with LPRANGE C - 3 learn 3 profiles for tilted e.d. with convolution to C different parts of film, stored in TPROF - could be C increased to 5 profiles if necessary later. C LPRANGE - Spots within LPRANGE pixels are used to perform local C profile averaging, with option LPTYPE = 2. C INTERLEAVE - (T/F) Apply odd/even scan line offset to eliminate C effects of densitometer zig-zag offset. C IFLATTEN - (T/F) Flatten profile when density falls below PROFMIN. C this is compulsory for LPTYPE=3 C PROFMIN - Density threshold for profile flattening - normally 0.03 C TSIGMA - Throw out outliers from background that deviate by more C than TSIGMA*stndev from the fitted value, and refit. C C C 4. J,K C Look-up table for optical density: LOOKUP(J)=K C This is linearly interpolated for J=1,1500. The first card must have C J=1 and the last J=1500. C C 5. Description of source of above look-up table - TITLE. C C C 6. NPLATE plate number, used on output file C C 7. TITLE Title of diffraction pattern, for use on output file. C C 8. LREINDEX, ATANGL, ATAXIS C Attempt to reindex the lattice parameters so that the titlangle and C tiltaxis are close to the expected values given by ATANGL and ATAXIS C ATANGL always positive, ATAXIS measured relative to the XY-axis C C 9. X0,Y0,TLTAXA,TLTANG,B3 C Coordinates of centre, position of tiltaxis (angle from tiltaxis to C A-axis in direction A to B positive), size of tiltangle. If non-zero, C X0,Y0 as well as TLTAXA and TLTANG and B3 override values calculated C internally or taken from header of digitised pattern. Note that C TLTAXA here is angle between tiltaxis and astar ON FILM, not in 3D C as in ORIGTILT. B3 is the pincushion distortion value (0.00000000240) C C 10. DX1,DY1,DX2,DY2 C Position of (1,0) and (0,1) relative to centre. If non-zero, these C values override the values on the input file header (from AUTOINDEX). C C 11. ROUT,RIN,PRPMAX C Outer and inner radii in Angstroms, converted to pixels in the program C using cell dimensions on card 1. PRPMAX is the maximum perpendicular C resolution from the tiltaxis. C C 12. NXM,NYM, NXMT,NYMT C sizes for peak integration, peak raster sizes used for initial C lattice parameter refinement, near and far from tiltaxis. C C 13. FRACT,ABSOL,XAMINE,NCYC C Reflections with Friedel differences greater than FRACT and ABSOL are C rejected. Weak reflections are rejected from the centre of gravity C and lattice parameter calculations by a criterion using XAMINE applied C to the peak rasters. NCYC is maximum number of cycles of refinement C of lattice parameters. NCYC=0 indicates no refinement, where program C goes straight to integration - allows strict comparisons to be made. C C C C INPUT AND OUTPUT************************************************************** C C 'IN' (1) : INPUT densitometered film array, any size. C FOR002 : OUTPUT of profile-fitted intensity values. C 'RADIAL' (3) : INPUT radial density curve for background correction. C 'YCORR' (4) : INPUT Y-axis densitometer drift curve for background correction. C FOR005 : INPUT control cards. C FOR006 : OUTPUT datastream. C 'PLOTOUT' : PLOTTER OUTPUT of spot positions and c. of gravity deviations. C 'INPARAM'(9) : INPUT header of image file with autoindexed lattice parameters C 'DENOUT'(10) : OUTPUT of film density with radial background, ycorr, zigzag C offset and profile fitted peaks subtracted - should be C completely flat. C 'TABLEIN'(11): INPUT of position distortion correction table from ccunbende.for C C******************************************************************************* C Notes on meaning of some of the variables: C GSBACK,GPBACK - global backgrounds derived from simple fit and profile C SINT,BACK - simple raster integrated peak and background density C ICORR - background-corrected raster integrated intensity C IPROF - profile-fitted integrated intensity C XCOORD,YCOORD - distortion corrected coordinates of spots. C X0,Y0 - coordinates of pattern centre. C JPROF - exact interpolated raster of density around each spot. C LPROF - logical array which flags over- or underloaded pixels. C TPROF - three profiles for convolution in tilted patterns C APROF - profile to be used for measurement in PROFMEAS C JSTORE - raw densities transferred from input array. C C******************************************************************************* C