View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

AwERROR:segmentation violation?

John Ouellette wrote on Nov 21, 1999

Hi,

I'm trying to write a script which, among other things, combines a list
of images using `imcombine'.  The script works fine up to and including
the call to imcombine,but then crashes with the message:

AwERROR:segmentation violation

scrolling up the screen.   The imcombine task exits properly (at least,
the image which is supposed to be created is actually created and looks
fine), but the rest of the script is never reached.   Is this error due
to some sort of problem with parsing?  Anything in particular I should
look for?

For what it's worth, I'll append the script to this message, although I
have been randomly hacking it to find the source of this error, so it is
a bit ugly right now....

TIA,
John Ouellette


procedure cfhcomb (images,outim)
file images {prompt="Images to be combined"}
string outim {prompt="Output image (unscaled)"}
string sect {"[*,*]",prompt="Image section for statistics"}
bool wgt  {no,prompt="Weight averaged images using image mode"}
string *list1
string *list2

begin
  string imname[100]
  real stddev[100],zero[100]
  int nimg,i

  real rtmp1,rtmp2
  string stmp1
  string temproot

  string ftemp1,ftemp2,ftemp3,ftemp4
  string itemp1
  string imgname


  real sumstd,sumzero

  string imsect
  string output
  bool imweight

  output = outim
  imsect = sect
  imweight = wgt

# Root name for temporary files
   temproot = "jao"

#expand image names
   ftemp1 = mktemp(temproot)
   images.imutil.sections(images=images,option="fullname",> ftemp1)

   ftemp2 = mktemp(temproot)
   ftemp4 = mktemp(temproot)

   itemp1 = mktemp(temproot)//".imh"

   sumstd = 0.0
   sumzero = 0.0
   list1 = ftemp1
   nimg = 1
   while (fscan(list1,imgname) != EOF) {
        print(imgname)
        imstat(images=imgname//imsect,fields="mode,stddev",format=no) |
scan(zer
o[nimg],stddev[nimg])
        sumstd = sumstd + stddev[nimg]
        sumzero = sumzero + zero[nimg]

        #print(imgname,"  ",zero[nimg],"  ",stddev[nimg])

        imname[nimg] = mktemp(temproot)//".imh"

#imexpr(expr="(a-b)/c",output=imname[nimg],a=imgname,b=str(zero[nimg]),c

=str(stddev[nimg]))

imarith(operand1=imgname,op="-",operand2=zero[nimg],result=itemp1)

imarith(operand1=itemp1,op="/",operand2=stddev[nimg],result=imname[nimg]

)
        imdelete(image=itemp1)

        print(imname[nimg],>> ftemp2)
        print(zero[nimg],>> ftemp4)
        nimg = nimg + 1
        print("done")
   }

   ftemp3 = mktemp(temproot)//".imh" # needs to be ".imh" to work around
FITS bu
g
   if (imweight == yes) {
        i=nimg/2
        imcombine(input="@"//ftemp2,output=ftemp3,plfile="",sigma="", \
                  combine="average",reject="sigclip",scale="none", \

zero="none",weight="@"//ftemp4,statsec=imsect,mclip=yes, \
                  lsigma=3,hsigma=3,nkeep=i)

        sumzero = sumzero/(nimg-1)
        sumstd = sqrt(sumzero)
        imarith(operand1=ftemp3,op="*",operand2=sumstd,result=itemp1)
        imarith(operand1=itemp1,op="+",operand2=sumzero,result=output)
        imdelete(image=itemp1)
        imdelete(image=ftemp3)
   } else {
        i = nimg/2

         imcombine(input="@"//ftemp2, output=ftemp3, plfile="",
sigma="", \
         combine="median", reject="sigclip", offsets="none",
scale="none", \
         zero="none", weight="none", statsec=imsect, lthresh=INDEF, \
         hthresh=INDEF, nkeep=int(i), \
         mclip=yes, lsigma=real(2.5), hsigma=real(2.5))

        sumzero = sumzero/(nimg-1)
        sumstd = sumstd/(nimg-1)
        imarith(operand1=ftemp3,op="*",operand2=sumstd,result=itemp1)
        imarith(operand1=itemp1,op="+",operand2=sumzero,result=output)
        imdelete(image=itemp1)
        imdelete(image=ftemp3)

   }


   imdelete(images="@"//ftemp2)
   delete(files=ftemp1,verify=no)
   delete(files=ftemp2,verify=no)
   delete(files=ftemp4,verify=no)

end

Last post on Nov 21, 1999