next up previous contents
Next: Numerical problem solving Up: Example command files Previous: Example command files   Contents


Remove a spectrum from an average

!-------------------------------------------------- 
!         unaverage.spx
!   Routine to remove spectrum in stack register x from
!   average (assumed stored in stack-register y)
!-------------------------------------------------- 

print  ' Unaverage -- assumes average is now in Y'
print  ' and spectrum to be removed from average is in X'
print ' '

declare intime_2  i4
declare intime_av i4
declare tsys_2_sq r4
declare tsys_av   r4
declare w1        r4


!  get integration time and system temperature from average spectrum

xy-interchange
intime_av = int_time
tsys_av   = tsys(1)
xy-interchange

!  compute new integ time and system temperature

intime_2  = intime_av - int_time
tsys_2_sq = intime_2/(intime_av/tsys_av^2 - int_time/tsys(1)^2)
w1        = int_time*tsys_2_sq/(int_time*tsys_2_sq + intime_2*tsys(1)^2)

!  compute new spectrum

multiply-spectrum w1
subtract
divide-spectrum 1.-w1

!  update the header parameters

int_time = intime_2
tsys(1) = SQRT(tsys_2_sq)

return



Jamie Leech 2004-08-16