Welcome to iraf.net Sunday, May 12 2024 @ 02:03 PM GMT


 Forum Index > Help Desk > General IRAF New Topic Post Reply
 Problem with Findgain in cl script
   
piverson
 10/17/2007 04:25PM (Read 5318 times)  
+++--
Chatty

Status: offline


Registered: 07/10/2007
Posts: 42
Mike-I have written a script that utilizes [i:36cd83ebb1]Findgain[/i:36cd83ebb1] to calculate an average gain and rdnoise for a night. I have been utilizing 5 sections of each bias and flat and have begun having some problems. On some nights my script works fine. On others, however, it inexplicably has the following error: [i:36cd83ebb1]Can't compute gain and readout noise[/i:36cd83ebb1]. As you can see the error code does not give me much to go on in terms of debugging. Interestingly the error seems to change where it occurs in the script when applying the script to different nights. So far I have tried the following:1. I thought I might be using sections too close to the edges (I don't know what difference this would make but suddenly it began working for one particular night) but the problem has remained for other nights.2. I tried tinkering with the parameters of findgain but to no effect.What is going on?Thanks,
PaulP.S. I have included a portion of the script below
[size=9:36cd83ebb1][color=red:36cd83ebb1]#ap_gain_rdnoise_collector_v_1.cl by Paul Iverson#variable declarations
int f1
int f2
int b1
int b2
int xlen
int ylen
int x1, x2, x3, x4, x5, x6
int y1, y2, y3, y4, y5, y6
int numflatU
int numflatB
int numflatV
int numflatR
int numflatI
int numflatN
int numflatW
int numbias
string flat1
string flat2
string bias1
string bias2hselect("*.fit", "$I,FILTER", yes, >>"datalist1")
sections @datalist1
if (sections.nimages == 0){
hselect ("*.FIT", "$I,FILTER", yes, >>"datalist1")
}
;match ("FLAT","datalist1",>>"datalistflat")
sections @datalistflat
if (sections.nimages == 0){
match ("flat","datalist1",>>"datalistflat")
}
;
match ("U$","datalistflat",>>"datalistflatU")
match ("B$","datalistflat",>>"datalistflatB")
match ("V$","datalistflat",>>"datalistflatV")
match ("R$","datalistflat",>>"datalistflatR")
match ("I$","datalistflat",>>"datalistflatI")
match ("N$","datalistflat",>>"datalistflatN")
match ("W$","datalistflat",>>"datalistflatW")match ("BIAS","datalist1",>>"datalistbias")
sections @datalistbias
if (sections.nimages == 0){
match ("zero","datalist1",>>"datalistbias")
}
;clearsections @datalistflatU
numflatU = sections.nimagessections @datalistflatB
numflatB = sections.nimagessections @datalistflatV
numflatV = sections.nimagessections @datalistflatR
numflatR = sections.nimagessections @datalistflatI
numflatI = sections.nimagessections @datalistflatN
numflatN = sections.nimagessections @datalistflatW
numflatW = sections.nimagessections @datalistbias
numbias = sections.nimagesif (numflatU > 0) {
for (f1=1;f1<=numflatU-1;f1+=1){
for (f2=f1+1;f2<numflatU;f2+=1){
for (b1=1;b1<=numbias-1;b1+=1){
for (b2=b1+1;b2<numbias;b2+=1){
tabpar ("datalistflatU",1,f1)
flat1 = tabpar.value imgets.param.p_mode = "h" imgets (flat1, param="i_naxis1")
xlen = int(imgets.value)
imgets (flat1, param="i_naxis2")
ylen = int(imgets.value) x1 = 50
x2 = 150
x3 = xlen - 150
x4 = xlen - 50
if ((xlen % 2) == 0){
x5 = (xlen/2)-50
x6 = (xlen/2)+50
}
;
if ((xlen % 2) == 1){
x5 = ((xlen - 1)/2)-50
x6 = ((xlen - 1)/2)+50
}
;

y1 = 50
y2 = 150
y3 = ylen - 150
y4 = ylen - 50
if ((ylen % 2) == 0){
y5 = (ylen/2)-50
y6 = (ylen/2)+50
}
;
if ((ylen % 2) == 1){
y5 = ((ylen - 1)/2)-50
y6 = ((ylen - 1)/2)+50
}
;

tabpar ("datalistflatU",1,f2)
flat2 = tabpar.value
tabpar ("datalistbias",1,b1)
bias1 = tabpar.value
tabpar ("datalistbias",1,b2)
bias2 = tabpar.value

findgain.section = "["//x1//":"//x2//","//y1//":"//y2//"]"
findgain (flat1,flat2,bias1,bias2,>>"gainrdnoiseU.info")
findgain.section = "["//x1//":"//x2//","//y3//":"//y4//"]"
findgain (flat1,flat2,bias1,bias2,>>"gainrdnoiseU.info")
findgain.section = "["//x3//":"//x4//","//y1//":"//y2//"]"
findgain (flat1,flat2,bias1,bias2,>>"gainrdnoiseU.info")
findgain.section = "["//x3//":"//x4//","//y3//":"//y4//"]"
findgain (flat1,flat2,bias1,bias2,>>"gainrdnoiseU.info")
findgain.section = "["//x5//":"//x6//","//y5//":"//y6//"]"
findgain (flat1,flat2,bias1,bias2,>>"gainrdnoiseU.info")
}
}
}
}
}
;[/color:36cd83ebb1][/size:36cd83ebb1]

 
Profile Email
 Quote
valdes
 10/17/2007 04:25PM  
+++++
Active Member

Status: offline


Registered: 11/11/2005
Posts: 728
Hello Paul,You should look at the output from findgain in gainrdnoiseU.info. Findgain is a fairly simple task so you could take a look at it at obsutil$src/findgain.cl. From the code[code:1:35a35d578a]
err = NO
if (fscan (fd, m_f1, junk) != 2) {
printf ("WARNING: Failed to compute statisics for %s\n", lf1)
err = YES
}
if (fscan (fd, m_f2, junk) != 2) {
printf ("WARNING: Failed to compute statisics for %s\n", lf2)
err = YES
}
if (fscan (fd, m_b1, junk) != 2) {
printf ("WARNING: Failed to compute statisics for %s\n", lz1)
err = YES
}
if (fscan (fd, m_b2, junk) != 2) {
printf ("WARNING: Failed to compute statisics for %s\n", lz1)
err = YES
}
if (fscan (fd, junk, s_fd) != 2) {
printf ("WARNING: Failed to compute statisics for %s - %s\n",
lf1, lf2)
err = YES
}
if (fscan (fd, junk, s_bd) != 2) {
printf ("WARNING: Failed to compute statisics for %s - %s\n",
lz1, lz2)
err = YES
}
fd = ""; delete (statsfile, verify-) if (err == YES)
error (1, "Can't compute gain and readout noise")
[/code:1:35a35d578a]So you see the error message has something to do with computing statistics and there should be a message with more details about what failed. Write back if you still can see the problem.Yours,
Frank Valdes

 
Profile Email
 Quote
piverson
 10/17/2007 04:25PM  
+++--
Chatty

Status: offline


Registered: 07/10/2007
Posts: 42
Frank -Thanks for the quick reply.I re-ran my script on one of the nights that is stalling and I found this warning in my gainrdnoiseV.info file.[i:0fd023a149]WARNING: Failed to compute statistics for zero.00000001.BIAS.FIT - zero.00000002.BIAS.FIT[/i:0fd023a149]I have made a cursory study of both bias frames and nothing seems to be amiss. Any ideas?Thanks- Paul

 
Profile Email
 Quote
valdes
 10/17/2007 04:25PM  
+++++
Active Member

Status: offline


Registered: 11/11/2005
Posts: 728
Hi,Do your file names really have so many zeros? ConfusedWhat I would do is copy the findgain script to my current directory and make a simple edit to have it print out the imstat results.[code:1:125a52142f]
obsutil> copy obsutil$src/findgain.cl .
obsutil> redefine findgain = findgain.cl
obsutil> ed findgain.clAfter the imstat call add:concat (statsfile)
[/code:1:125a52142f]Another thing you can do is type "d_trace" right before running your script. This will be very verbose in dumping stuff to the terminal window. What you would want to do is look back for the imstat call to see the exact command being executed and then you could try the command manually. One way to capture the trace info if what you want is too far back to scroll is set the terminal to capture the output (in xgterm you use control-leftbutton to get the menu and select logging. Note you type d_trace again to turn this output off.A mix of the two is if you modify a local copy of findgain you can put d_trace before and after the command to limit the trace to the region of interest though it is often easier to do other things if you have control of the script.Frank

 
Profile Email
 Quote
piverson
 10/17/2007 04:25PM  
+++--
Chatty

Status: offline


Registered: 07/10/2007
Posts: 42
Frank - CCDSoft, the imaging software we use up at WMO (I don't really like it since you can't do palindromes very well but it works well with TheSky and the Paramounts), puts tons of extra little tidbits, including all those zeros, into the image titles.I don't really have the option to modify any IRAF packages since our local copy is on a server that everyone uses (I believe my professors would take issue with that) and I am not conversant enough with IRAF to understand exactly what I am looking for in the output from d_trace.I see where the imstat seems to be called but am not sure what everything else means. Is there some way that I could upload the results or a screenshot so that you could help guide me through? The error occurs relatively fast so the results are not large.Thanks-Paul

 
Profile Email
 Quote
valdes
 10/17/2007 04:25PM  
+++++
Active Member

Status: offline


Registered: 11/11/2005
Posts: 728
Hi Paul,What I described was making a local copy of the findgain script and then using the redefine command to excute your copy instead of the system copy. So there is no problem with modifying the system. So try and follow my directions for making a local copy and modifying it for your needs. This is a fairly easy script to look at and understand and so I think it will make a good learning experience for IRAF scripting as well as helping you solve the problem.Frank

 
Profile Email
 Quote
piverson
 10/17/2007 04:25PM  
+++--
Chatty

Status: offline


Registered: 07/10/2007
Posts: 42
Frank -I didn't change a thing and yet, inexplicably, it now works. I am at a loss.Thanks for your help. I learned you could do several things that I had no idea were possible.- Paul

 
Profile Email
 Quote
   
Content generated in: 0.13 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content 
dog allergies remedies cialis 20 mg chilblain remedies


Privacy Policy
Terms of Use

User Functions

Login