; interactive 
; permits to assign chemical shift to a given point
; will change the offset
;
;see also : UNIT SPECW OFFSET FREQ point

; if ($unit s= 'INDEX' | $unit s= 'SECOND') error 'UNIT should be either PPM or HZ'
if ($unit s= 'INDEX' | $unit s= 'SECOND') unit P
alert "click on the point you want to assign"
refmacro 1
monopoint
if ($dim == 1) then
  dialogbox calib \
     "Enter coordinate of the point :" real calib_c_val 0.0 \
     "Enter unit :" enum 'PPM,Hz' lunit $unit \
     *
  unit $lunit
  if ($unit s= 'PPM') set calib_c_val = ($calib_c_val*$freq_1d)
  set calib_pt_hz = ($specw_1d/($si1_1d-1))  
  offset  ($calib_c_val-(($si1_1d-$pointx[1])*$calib_pt_hz))    
elsif ($dim == 2) then
  dialogbox calib \
     "Enter coordinates of the point" message \
     "In F1 :" real calib_c_val 0.0 \
     "In F2 :" real calib_c_val2 0.0 \
     "Enter unit :" enum 'PPM,Hz' lunit $unit \
     *
  unit $lunit
  if ($unit s= 'PPM') set calib_c_val = ($calib_c_val*$freq_1_2d)
  set calib_pt_hz = ($specw_1_2d/($si1_2d-1))
  if ($unit s= 'PPM') set calib_c_val2 = ($calib_c_val2*$freq_2_2d)
  set calib_pt_hz2 = ($specw_2_2d/($si2_2d-1))
  offset  ($calib_c_val-(($si1_2d-$pointy[1])*$calib_pt_hz))     \
          ($calib_c_val2-(($si2_2d-$pointx[1])*$calib_pt_hz2))
else
  error "Not implemented in 3d"
endif
refmacro 0
exit



