AFSCALE - SCALE FILMS IN A PACK =============================== INTRODUCTION AFSCALE's function is to scale intensity measurements on the the successive films in a pack (up to six) into a single intensity for each reflection. AFSCALE itself deals with the non-wavelength overlapped spots(singlets), a similar program UNSCRAM uses the inter-film scaling coefficients found by AFSCALE to `unscramble' the intensities of wavelength overlapped reflections (multiplets). The main author of the program was I.J. Clifton, Daresbury Laboratory. List of sections: Running the Program Using AFSCALE Input and Output Files Commands RUNNING THE PROGRAM Use the command 'laue afscale' The program runs in an interactive manner and prompts the user for input as needed. USING AFSCALE On entry AFSCALE asks for a .ge1/.ge2 file name (without the extension) and it is essential to load (see Load command description below) a victoreen coefficients file (.vc) even if the coefficients available are very approximate. The normal strategy would then involve, for each film pair A/B, B/C etc. the following steps: 1) Use the 'Define' command to select reflection pairs to be used. 2) Use the 'Fit' command to evaluate the three $\alpha$ coefficients. 3) Use the 'Plot', 'Scale' and/or 'Rsym' commands to assess the fit. This sequence would normally be repeated several times with variations in the 'Define' command until a satisfactory fit is obtained. Then when all film pairs have been thus fitted, output (using the command 'Output') of scaled and merged intensities is requested. Also the refined Victoreen coefficients may be saved in a file using the 'Write' command. INPUT AND OUTPUT FILES The input files are as follows: a) The .ge1/ge2 pair of files b) A victoreen coefficients file The output files are: a) A scaled intensities output file (type = .afout) This is a card image file with one record per reflection (scaled but unmerged, and unsorted data) containing the items: h k l lambda theta intensity sig(intensity) x and y in format (3I5,2F10.5,2I10,2F8.3). b) An updated victoreen coefficients file (optional) COMMANDS Introduction AFSCALE's main menu has the following commands: Define Selection criteria allows the spot rejection parameters described above to be changed. It also allows the user to select which adjacent pair of films to scale together. Load Loads film factors and sets up initial coefficients for the Victoreen inter-film scaling functions, see below. Fit Victoreen calls a routine to refine the coefficients of the Victoreen inter-film scaling functions to fit the data that has been selected. The Victoreen has the form of K exp( a lambda**3) but normally K should be 1.0. Plot Draws graphs of the data, lambda against inter-film intensity ratio, with the current Victoreen function superimposed. Postscript output is avalable to enable hard copy plots to be produced. Scale Calculates scaling R-factors (i.e. the closeness between (scaled) measurements on different films). Rsymm Calculates symmetry R-factors. The user has to choose which index to use for the symmetry comparison, e.g. `h' means each spot of index (h k l) is compared with the spot (-h k l). Output Writes out a file containing scaled-together intensities for the six films. Obviously, it should be used towards the end of a run when the scale factors for all films have been derived. Selection criteria on intensity and sigma can be applied, but the data chosen for output are independent of the selection criteria set in the 'Data' option. Only singlet spots are output. The output file is in a format suitable for input to the programs LAUENORM and LAUESCALE which may be used for determining the wavelength normalisation curve. Write Film factors writes to a file (default file type .vc) a set of refined Victoreen coefficients for use with other film packs or for input to UNSCRAM. List of subsections in this section: The Define Command The Load Command The Fit Command The Plot Command The Scale Command The Rsymm Command The Output Command The Write Command The Define Command This sets up the rejection criteria and then reads in the singlets to be used for refining the Victoreen function. The adjacent pair of films to be compared have to be specified by giving the number of the first film, e.g.`3' means that C (film 3) and D (film 4) are to be compared. The program refers to the two films as `X' and `Y', but for clarity the scaling process will be described below in terms of A to B scaling. As each singlet is read in from the .ge1 file, the following rejection criteria can be applied: * I_a, I_b must be greater than specified minima, and sigma(I_a), sigma(I_b) > 0. * |I_a|,|I_b| <9000 - This rejects spots which were flagged as being unmeasurable in INTLAUE by having their intensities set to 9999. The above two tests can be ignored by `not rejecting unmeasurable spots'. * lambda_min < lambda < lambda_max. * Reject if 0.486 < lambda < 0.490 or 0.900 < lambda < 0.920 - This rejects spots near the Ag and Br absorption edges. * The `band' rejection option: Reject if | (I_a/I_b)**cos(2*theta) - K*exp(a*lambda**3) | | -------------------------------------------- | > B | K*exp(a*lambda**3) | where Bis user-specified, 'a' is the current value of this parameter. This rejects spots far away from the current Victoreen curve. The program stores I_a, I_b, (I_a/I_b)**(cos(2*theta), (h,k,l), cos(2*theta), d_hkl and the weight 'w' to be used in fitting. 'w' is either 1 (`unit weights') or w = (sigma(I_a)**2/I_a**2 + sigma(I_b)**2/I_b**2) * (I_a**2/I_b**2) The Load Command Load film factors from a victoreen coefficients file (default type = .vc) e.g. as output by the 'Write' command and sets up the initial coefficients for the Victoreen inter-film scaling functions. Alternatively, the user can calculate coefficients from the known absorption curves of aluminium and copper. This is done either by typing in, for each interfilm gap, the type of metal foil (Al or Cu) and its thickness, or by simply using ready-calculated parameters. These ready-calculated parameters (at the moment) are for the sequences: F F 150muAl F 150muAl F 150muAl F 38muCu F F F 200muAl F 200muAl F 200muAl F 38muCu F The Fit Command This calls a routine to find the least-squares minimum of the functions described below. The routine works as follows: it is supplied with a starting vector xand a vector-valued function f(x) = f1(x), f2(x), ..., fm(x) implemented as a Fortran FUNCTION. The routine adjusts xto minimize M F(x) = Sigma [fi(x)]**2 i=1 In AFSCALE's case, xis just the 'a' parameter of the Victoreen function. Normally, the function minimized is: fi(a) = (I_a/I_b)**cos(2*theta) - w*K*exp(a*lambda**3) If `experimental fitting options' are used, the function is: fi(a) = |W(I_a-I_b*K*exp(a*lambda**3)**(1/cos(2*theta))|**p/2 where 'p' is a user-specified `power for each term' and 'W' is either 'w' (i.e. a unit weight or a 1/sigma**2 type weight) or 1/I_a. The Plot Command This command draws graphs of the data, lambda against inter-film intensity ratio, with the current Victoreen function superimposed. Postscript output is avalable to enable hard copy plots to be produced if required The Scale Command AFSCALE's 'Scale' command generates tables of R-factors broken down into intensity, wavelength and resolution bins. The data used for the R-factors is that selected by the most recent 'Define' command. The scaling R-factors in the bins are defined as: R_scale(bin) = Sigma_bin(|Ia - s*I_b|) / Sigma_bin(Iave) where s = (K*exp(a*lambda**3))**(1/cos(2*theta)) There is also an analysis against wavelength of the numbers of spots above and below the current Victoreen curve. The Rsymm Command AFSCALE's 'Rsymm' command generates tables of R-factors broken down into intensity, wavelength and resolution bins. The data used for the R-factors is that selected by the most recent 'Define' command. The symmetry R-factor is based on comparisons between the intensities of symmetry-equivalent points. Because in general such symmetry-equivalent pairs will diffract at different wavelengths, the wavelengths of each pair of spots have to be closer than a limit, the `wavelength mismatch limit' chosen by the user, for the pair to be included in the R-symm statistics. For an R-symm comparison on 'h', the program calculates for each allowed pair(h, k, l) (-h, k, l) Iave = (I(hkl) + I(-hkl))/2 Sigma_bin(|I(hkl)-Iave| + |I(-hkl)-Iave|) Rsymm(bin) = ----------------------------------------- Sigma_bin(Iave) The Output Command For each spot the six intensity and sigma values are re-read from the .GE file and processed in the following way. * If |I_i| = 9999.0 or |sigma(I_i)| = 9999.0 then the intensity is zeroed and sigma set to 1,000,000. * The I_i's are scaled up to the A film by applying inter-film scaling factors of the form K*exp((a*lambda**3)/cos(2*theta)) where 'a' is the refined parameter. * The mean intensity is calculated: Sigma_i(I_i/sigma(I_i)**2) Imean = -------------------------- Sigma_i(1/sigma(I_i)**2) * The scaled-together sigma is evaluated: sigma_mean = max(sigma', sigma'') where sigma' = (sqrt(Sigma_i(1/sigma(I_i)**2)))**-1 and Sigma_i((I_i-Imean)/sigma(I_i)**2)**2) sigma'' = sqrt(----------------------------------------) Sigma_i(1/sigma(I_i)**4) * Both the mean 'I' and mean 'sigma' are finally scaled by k*exp(K_p*t/cos(2*theta)) / LP where 'k' is an arbitary scaling factor, 'K_p' and 't' allow for the absorption due to a thickness of paper (K_p = 0.105, t = 1), and 'LP' is the Lorentz-polarization correction: 1) The Lorentz correction used is: L = 1/sin(theta)**2 2) The polarization correction used is:If y=0 then P=1. Otherwise psi = atan(x/y) P0 = (1 + cos(2*theta)**2)/2 alpha = cos(2*psi*sin(2*theta)**2)/(1 + cos(2*theta)**2) P = P0(1 - tau*alpha) where presently tau=1, and x, y are coordinates on the film. (NB should P = P0 when y=0?) * Intensity and sigma rejection criteria (like those in the 'Define' command) are applied. The Write Command This command is used to write the current (e.g. refined) values of the Victoreen coefficients to a file (default type = .vc).