home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / FORTH / 4THPROG.ZIP / README < prev    next >
Encoding:
Text File  |  1985-11-06  |  10.1 KB  |  233 lines

  1. The following are brief descriptions of the programs on this disk
  2. and also instructions for using them.  The program named PLTSPEC
  3. is probably most useful to nuclear engineers, health physicists,
  4. or enviromental engineers who are working with scattered photon
  5. energy spectrums or similar spectra with broad asymmetric peaks
  6. on a sloping background.  The purpose of this program is not to
  7. perform automatic peak-search and identification, however, this
  8. feature can probably be added without having to change any of the
  9. existing code.
  10.  
  11. The set of assembly language routines are some that I've found
  12. usefu∞ fo≥ interfacinτ witΦ DO╙ froφ insidσ FORTRAN«  Routine≤
  13. fo≥ gettinτ thσ date¼ time¼ anΣ day-of-the-weeδ are in 
  14. DAT-TIME.ASM.  Routines for polling the keyboard, retrieving
  15. keystrokes without echoing to the screen, and access to other
  16. DOS functions are in DOSFN.ASM and DOSFUNC.FOR.  DIR_ASM.ASM 
  17. is a routine which lists to the console the names of the files
  18. in the current directory.  I apologize for not writing routines
  19. for IN, OUT, PEEK, and POKE.... perhaps next time.
  20.  
  21. Dave Bodette
  22. Gainesville, Florida
  23.  
  24. PROGRAM PLTSPEC.FOR
  25.  
  26.     This program was written to interactively process gamma-ray
  27.     energy spectrums but is useful in any application where you 
  28.     need to find the area under a peak, remove the background,
  29.     fix lost/erroneous data points, or want to produce graphs
  30.     with labels.
  31.  
  32.     The program is written in MS-FORTRAN and uses the MULTI-HALO
  33.     graphics library extensively.  I've not used any other graphics
  34.     libraries, but it seems that MULTI-HALO provides a level of
  35.     portability between systems with different graphics boards that
  36.     the other libraries don't.  Without having to recompile and link,
  37.     the same program will work with a Hercules or IBM graphics card and
  38.     can take full advantage of the higher resolution modes of the
  39.     Hercules card.
  40.  
  41.     To run PLTSPEC you will need to compile
  42.  
  43.         PLTSPEC  MANSPT  EDITS  PLOT1  PLOT2
  44.  
  45.     and then link these routines with HALODVXX, DOSFN and DOSFUNC and
  46.     the HALOF library.  The link sequence is given in the comments of
  47.     PLTSPEC.  Now you should have an executable version of PLTSPEC.
  48.  
  49.     When PLTSPEC is first run you are presented with a menu of functions.
  50.     Simply typing the letter of the first word describing each function
  51.     chooses that menu item.  The first item to choose is "Read in a 
  52.     spectrum" by pressing 'R'.  You will then be asked the IDentification
  53.     number of the spectrum to read in -- you are able to have upto 10
  54.     spectrums at a time -- enter a number between 1 and 10.  The next 
  55.     question asks for the name of the file - enter the file name.  The 
  56.     program will then read in the data and return you to the main menu.
  57.  
  58.     Once you have read in the data the next step is to "Set the plot 
  59.     limits".  The plotting limits can be determined from the data itself
  60.     or you can enter the numeric values yourself.  Finally, the data is
  61.     able to be plotted to the screen (just choose the "Plot spectrum" 
  62.     item from the menu).
  63.  
  64.     This should be enough information to get you started.  Descriptions
  65.     of the commands to label, determine peak area, etc. are below
  66.  
  67. SUBROUTINE MANSPT.FOR
  68.  
  69.     The following functions can be performed by this subroutine:
  70.  
  71.   *fit the spectrum background to a 2nd order curve
  72.  
  73.    commands-   B   begin fit at current cursor position
  74.                L   set current cursor position as the left
  75.                      side of the peak.
  76.                R   set current cursor position as the right
  77.                      side of the peak.
  78.                E   end fit at current cursor position.
  79.                C   compute a polynomial fit to the data between
  80.                      the points B-L and R-E. The data between L and
  81.                      R are not used.
  82.                X   remove the background from the data between
  83.                      the points B and E and display the
  84.                      corrected data.
  85.                O   overlay the background curve between the 
  86.                      points B and E.
  87.                A   compute the area between the points L and R
  88.                      taking into account the background curve
  89.                      fit.  (Function X does not have to have been
  90.                      done for this to work, however, function C
  91.                      must have been performed.)
  92.  
  93.      The data points between B and E (except those points between
  94.      L and R) are fitted to a 2nd order polynomial
  95.                y= AA*X**2 + BB*X + CC
  96.      using a weighted least squares routine.  The weighting is 
  97.      just 1/(square root of the counts).  NOTE: the fit will fail
  98.      unless B is less than L is less than R is less than E (i.e.
  99.      going from left to right on the screen press BLRE).
  100.  
  101.  *start over with the original data
  102.        command-    '-'  pressing this key erases everything and
  103.                            starts over.
  104.  
  105.  *exit the subroutine
  106.      commands-    Q   quits and returns to main program as if 
  107.                         nothing had been done to the data.
  108.                   F   finish manipulating the data and display-
  109.                       returns to the main program with the screen
  110.                       image intact and with any changes made to the
  111.                       data (e.g. background corrected, etc.).
  112.  
  113.  *obtain printer output
  114.      command-     G   dump screen image to printer
  115.  
  116.  
  117.  *write the data to a disk file
  118.          command-     W   you will be prompted for a file name.
  119.  
  120.  *place labels on the screen image
  121.     commands-
  122.              T   first key to push.  you will be prompted
  123.                  for the text of the label.  NOTE the first and
  124.                  last charachters must be unique:
  125.  
  126.                      \peak area = 19654 counts\
  127.                      !the exclamation points are unique!
  128.  
  129.  
  130.              8   move up          | When the NumLck key
  131.              9   move up fast     | is lit on the IBM
  132.              6   move right       | keyboard this key
  133.              +   move right fast  | arrangement really
  134.              2   move down        | does make some
  135.              3   move down fast   | sense
  136.              4   move left        |
  137.         <RETURN> move left fast   |
  138.  
  139.              L   display the label starting at cursor position.
  140.              E   erase the label. If the label is not displayed
  141.                    the results are unpredictable.
  142.              Z   allows you to change the height, width, writing
  143.                    direction(path), and writing mode.
  144.                    height and width can be 1,2,3 but not 1.5,2.3
  145.                    direction   0   horizontal
  146.                                1   at 90 deg to horizontal
  147.                                2   upside down and backwards
  148.                                3   at 270 deg to horizontal
  149.                    mode 0 or 1     unboxed or boxed.
  150.              Q   quit the labeling routine.
  151.  
  152.  
  153. SUBROUTINE EDITS.FOR
  154.  
  155.   An interactive visual editor for changing the y values 
  156.   of the data by simply moving a cursor around.
  157.  
  158.  
  159.     The following functions can be performed by this subroutine:
  160.  
  161.  
  162.     *start over with the original data
  163.          command-    '-'  pressing this key erases everything and
  164.                            starts over.
  165.  
  166.     *exit the subroutine
  167.          commands-    Q   quits and returns to main program as if 
  168.                             nothing had been done to the data.
  169.                       F   finish manipulating the data and display-
  170.                           returns to the main program with the screen
  171.                           image intact and with any changes made to the
  172.                           data (e.g. background corrected, etc.).
  173.  
  174.      *obtain printer output
  175.          command-     G   dump screen image to printer
  176.  
  177.  
  178.      *write the data to a disk file
  179.          command-     W   you will be prompted for a file name.
  180.  
  181.      *change y values of points on the screen image
  182.          commands-    E   key to push so you will be able to change
  183.                           the y position and value of the point at the 
  184.                           current cursor position.
  185.  
  186.                       8   move up        | With the NumLck key
  187.                       9   move up fast   | is lit on the IBM
  188.                       6   move right     | keyboard this key
  189.                       +   move right fast| arrangement really
  190.                       2   move down      | does make some
  191.                       3   move down fast | sense
  192.                       4   move left      |
  193.                  <RETURN> move left fast |
  194.  
  195.                       Q   quit editing this point.
  196.  
  197. SUBROUTINES  PLOT1.FOR AND PLOT2.FOR
  198.  
  199.        Copies the screen image to an IDS Microprism printer.
  200.        Must be in HALO graphics mode to call this routine.
  201.        Image is IXMX x IYMX (usually 640x200) pixels.
  202.        Thσ  heigh⌠ oµ thσ printeΣ cop∙ appear≤ abou⌠ 1/▓ a≤ higΦ ì
  203.        a≤ thσ screeε image but does not have the "fat" lines
  204.        whicΦ thσ HAL╧ routinσ give≤ t∩ thσ image« Usσ "PLOT2ó iµ ì
  205.        yo⌡ wan⌠ thσ printeΣ cop∙ t∩ havσ thσ samσ aspec⌠ rati∩ a≤ ì
  206.        thσ vide∩ screen.
  207.  
  208.        PLOT2 is a similar graphics dump routine as "PLOT1" except
  209.        the printer image is twice as high.  Every other line of 
  210.        pixels on the printer is blank.  This can be changed
  211.        so that each horizontal line of pixels is printed 
  212.        twice.  The effect of this is to make a 640x200 image
  213.        into a 640hx400v image.
  214.  
  215. PROGRAM EFFIXSP.FOR
  216.  
  217.     The purpose of this program is to correct the spectrum for
  218.     the detector efficiency variation as a function of energy.
  219.     The bulk of this program is just a slightly modified version
  220.     of PLTSPEC.FOR.  The following three functional forms for the
  221.     detector efficiency as a function of energy can be chosen from
  222.  
  223.                          2
  224.           1)    eff = A*E  + B*E + C
  225.  
  226.                          2
  227.           2) ln(eff)= A*E  + B*E + C
  228.  
  229.           3) ln(eff)= A*ln(E) + C
  230.  
  231.     where E is the energy variable and A, B, & C, are the fitting
  232.     constants which you must provide.
  233.