Dear Gifa users.

A bug has been found recently by Kalle Gehring (Kalle.Gehring@BRI.NRC.CA ) in
Montreal about Hz and ppm computation in Gifa.
Because of this bug, ppm values are slightly wrong by an amount of
(size-1)/size   where size is the number of data-points on the spectral axis.

in version 4.09 and earlier, Hz = specw*(size-index)/(size-1) + offset
whereas it should be         Hz = specw*(size-index+1)/size + offset

This bugs implies that
  - all ppm and Hz coordinates are slightly wrong
    i.e. if you calibrate on one peak, then the farther you go away from this
         peak, the larger the error.
      The maximum error (in Hz) is equal to specw/size
  - peaks are slightly wrong when display in ppm or Hz
  - peak-table files are stored with wrong coordinates.
  - peaks seems to move a little, depending on the zero-filling level.

The current version of Gifa (version 4.10) correct this, of course.

In the mean-time, you may use the following macro which temporary corrects the
  spectral width in order to give correct ppm computation with the incorrect
  internal functions.

I apologize for it, but well, you know, the more user you have, the more
they discover new bugs.

Regards.

M.A.Delsuc.


-------------------- correctppm macro ----------------------------
; to correct the ppm/Hz computation in Gifa
; with version < 4.10
;
; in Gifa version < 4.10 ,  (i.e up to 4.09)
; computation of ppm and Hz is slightly wrong, by a factor (size-1)/size.
; This macro corrects the internal values of specw and offset
; to give a correct computation of ppm and Hz.
; however, ppm definition will shift a little for spectral region at high field.
; so you might want to recalibrate afterward.
; It should be applied only ONCE to a data-set.
;
; Since it modifies the spectral parameters of the data-set,
; this data-set, if wrote onto a file will be wrong when read with
; a corrected version of Gifa.
;
; so the following procedure is proposed :
; Do not touch to your files, version 4.10 should be available by sept. 1996
; Rather read your files, and apply correctppm after reading, so that the
; in-memory file is correct. Do not write it back, at least not on file
; you wish to keep later on.
;
; Note also that peak-files are stored in ppm format
; so peak-tables stored in corrected ppm, will be Ok when read with the
; corrected version of Gifa.
; If you have already peak-tables that you wish to keep,
; and you want to correct the ppm values, do the following :
;   read file         ; get file
;   pkread peaks.old  ; load peaks
;   correctppm        ; peaks won't move because they are internally in index !
;       eventually, recalibrate
;   pkwrite peaks.new ; store corrected peak values.
; next time you use it
;   read file    correctppm   pkread peaks.new   ; is fine

;This version verification line will not work with very old Gifa versions !
if ((head(tail($version))) >= 4.10) then
   print 'This macro is not needed any-more with this version of Gifa'
   exit
endif

if ($dim == 1) then
   offset (%+$specw_1_1d/$si1_1d)
   specw  (%*($si1_1d-1)/$si1_1d)
elsif ($dim == 2) then
   offset (%+$specw_1_2d/$si1_2d) (%+$specw_2_2d/$si2_2d)
   specw  (%*($si1_2d-1)/$si1_2d) (%*($si2_2d-1)/$si2_2d)
elsif ($dim == 3) then
   offset (%+$specw_1_3d/$si1_3d) (%+$specw_2_3d/$si2_3d) (%+$specw_3_3d/$si3_3d)
   specw  (%*($si1_3d-1)/$si1_3d) (%*($si2_3d-1)/$si2_3d) (%*($si3_3d-1)/$si3_3d)
endif
