Program OVN_add ! Addition of a set of images ! The images must have the same size Implicit None Character(Len=80) Ifs,Image_Add,Mouch,String,Ife Character(Len=60) Comment Character(Len=100) paramoption(50) Integer Lu,Status,BP,Nc,Nl,Npix,Ip,Is,Ns,err,i,nkeys,Ios Integer Nodef Real Xd,Yd,Dx,Dy Real, allocatable::Ims(:),Ime(:) Image_Add="dummy" Ifs="dummy" mouch='mouch.lis' call getline(nkeys,paramoption) if (nkeys.eq.0) then Write(*,*) 'Syntax : -n Image_names -o Image_Add -l logfile' Write(*,*) 'Co-addition of an image set' Write(*,*) '-n Image_names file of the names of the processed images (required)' Write(*,*) '-o Image_Add name of the co-added image (required)' Write(*,*) '-l logfile : name of the log file (mouch.lis)' Stop endif Do i=1,Nkeys,2 If(paramoption(i).eq.'-n') Image_add =paramoption(i+1) If(paramoption(i).eq.'-o') Ifs =paramoption(i+1) If(paramoption(i).eq.'-l') Mouch =paramoption(i+1) Enddo If(Image_Add.eq."dummy") Stop "No file for image names" If(Ifs.eq."dummy") Stop "No out co-add image" Call Debut('OVN_add',Mouch) Call WC('Co-addition of an image set') open(51,File= Image_Add,Status='old') Call WC('File of names :'//Trim(Image_Add)) Ns=0 D1: Do read(51,*,IOstat=Ios) Ife If(Ios.ne.0) Exit D1 Ns=Ns+1 Write(String,"(I3,1x,a)") Ns,Trim(Ife) Call WC(String) Call OFits(52,Ife,Bp,String,Nc,Nl,Dx,Dy,Xd,Yd) If(BP.ne.-32) Stop 'This program processes only real data' If(Ns.eq.1) Then Npix=Nc*Nl Allocate(Ime(Npix),stat=err) ; If(err/=0) Stop "Allocation problem" Allocate(Ims(Npix),stat=err) ; If(err/=0) Stop "Allocation problem" Ims=0 Else If(Nc*Nl/=Npix) Stop "The images have not the same size" Endif Status=0 Call FTGPVE(52,0,1,Npix,0,Ime,Nodef,Status) Call FtClos(52,Status) Ims=Ims+Ime Enddo D1 Close(51) Call WC('Co-added Image: '//Ifs) Comment='sum of the images' Call CFits(Ifs,52,Comment,Nc,Nl,Dx,Dy,Xd,Yd,BP) Status=0 Call FTPPRE(52,0,1,Npix,Ims,Status) Call FTClos(52,Status) CALL LAFIN('OVN_add') End