Welcome to iraf.net Friday, May 17 2024 @ 06:35 PM GMT


 Forum Index > Help Desk > General IRAF New Topic Post Reply
 problem in script
   
ranisb
 09/22/2008 06:18AM (Read 5205 times)  
++---
Junior

Status: offline


Registered: 05/26/2008
Posts: 17
Hi,
I am writing procedure script to make master bias using ZEROCOMBINE and subtract master bias from all the images using 'CCDPROC'
But I am getting following error , generally what this means,
cc> biasred
The biasframes to be combined (biasimage_lis): biasimage_lis
The images to be reduced (image_lis): image_lis
ERROR on line 103: Cannot open device (node!imtool,,2048,2048)
biasred ()Also want to include the following loop,
i = strlen (img)
if (substr (img, i-2, i) == ".fits") {
img = substr (img, 1, i-3)
}
;How this loop and functions are working?Kindly write me as early as possible.Thanks !

Regards,
Rani
Frown

 
Profile Email Website
 Quote
fitz
 09/22/2008 06:18AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
[quote:3d7fbdae9f]
But I am getting following error , generally what this means,
cc> biasred
The biasframes to be combined (biasimage_lis): biasimage_lis
The images to be reduced (image_lis): image_lis
ERROR on line 103: Cannot open device (node!imtool,,2048,2048)
biasred ()[/quote:3d7fbdae9f]The error means you are trying to display an image but don't have a display server running. You must start DS9 or XImtool yourself before running the script. [quote:3d7fbdae9f]
Also want to include the following loop,
i = strlen (img)
if (substr (img, i-2, i) == ".fits") {
img = substr (img, 1, i-3)
}
;
[/quote:3d7fbdae9f]The code apparently tries to get the root filename by checking for a specific extension and then stripping it off. However, the indices are wrong, the code should be[code:1:3d7fbdae9f]
if (substr (img, i-4, i) == ".fits") {
img = substr (img, 1, i-4)
}
[/code:1:3d7fbdae9f]
-Mike

 
Profile Email
 Quote
ranisb
 09/22/2008 06:18AM  
++---
Junior

Status: offline


Registered: 05/26/2008
Posts: 17
Thanks Mike......it works
Smile
I like to ask , in the following code what is the significance of indices?if (substr (img, i-4, i) == ".fits") {
img = substr (img, 1, i-4)
} Also I like to ask you one more query, I wrote the following code but I am not getting exact significance of 'MKTEMP' and 'SECTION".The code is,
projimg = images
if (projimg != "") {
imgfile = mktemp ("tmp$red")
sections (projimg, option = "fullname", > imgfile)
}I tried to understand through their help pages but things are not clear to me that much.
Kindly write me.
Thanking youRegards,
Rani
Frown

 
Profile Email Website
 Quote
fitz
 09/22/2008 06:18AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
[quote:082c3066f8]
I like to ask , in the following code what is the significance of indices? [/quote:082c3066f8]The substring function creates a substring of the first argument based on the 'start' and 'end' indices given as the 2nd and 3rd arguments. Strings are one-indexed, so for example "substr ('aabbcc',3,4)" is the substring 'bb'.[quote:082c3066f8]Also I like to ask you one more query, I wrote the following code but I am not getting exact significance of 'MKTEMP' and 'SECTION".The code is, [/quote:082c3066f8]The MKTEMP function creates a string that can be used as a unique temporary filename, i.e. you supply some root name (in this case it is a file that begins with 'red' in the 'tmp$' logical directory) and some string of numbers is appended, the result is a filename which does not exist at the time the function was called (be sure to delete it when done). The SECTIONS task (see the help page) expands a filename template like "*.fits" into an expanded list of filenames. Your code is simply expanding the list into the temp filename. Cheers,
-Mike

 
Profile Email
 Quote
ranisb
 09/22/2008 06:18AM  
++---
Junior

Status: offline


Registered: 05/26/2008
Posts: 17
Thanks Mike......feeling good as getting help from you very quick.
LOL
Yaah !......things are little clear now...I am practising on that.Again I stuck up , I am using CCDPROC for zerocorrection or one can say subtract biasmaster from all images. But it is not updating my files. I called CCDPROC in the following way, # Call CCDPROC
if (access (img // ".fits")) {
# ccdproc (img, ccdtype = "", fixpix-, overscan=overscan, trim=trim, biassec="image", trimsec="image", zerocor+, darkcor-, flatcor-, flatcor-, illum-, fringe-, zero=biasmaster)
}
;Also as CCDPROC is not working , I used IMARITHMATIC to subtract biasmaster from all images.
imarith(operand1=img, op="-", operand2="biasmaster.fits", result=rslt_tst)But this also didn't work. where I am wrong or do u have any suggestion?One more thing I like to ask ,If you will help me this will be great. I am using ZEROCOMBINE to make bias master as following,
zerocombine ("@"//bslist, output = biasmaster, ccdtype = "", combine='average', reject='pclip', process-) Here I have given all parameters, but i want to use zerocombine as parameter i.e. when I type :e infront of it , it will display its parameters and then I give the required parameters and output (masterbias) should pass to next step or task( ccdproc or imarith). Can you please tell me how to write parameter file for zerocombine and in the script where it should declare? I read document on PSET 'Named External Parameter Sets in the CL' but there is no such good explanation in this which clear my query?Do this is good to use PSET or have any other thing to work on this problem?Kindly help me and write.
Frown
Thanking youRegards,
Rani

 
Profile Email Website
 Quote
fitz
 09/22/2008 06:18AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
Rani,[quote:6bc96a87a1]
f (access (img // ".fits")) {
# ccdproc (img, ccdtype = "", fixpix-, overscan=overscan, trim=trim, biassec="image", trimsec="image", zerocor+, darkcor-, flatcor-, flatcor-, illum-, fringe-, zero=biasmaster)
}
; [/quote:6bc96a87a1]Do you actually have a '#' in front of the ccdproc call? If so, it isn't executing because '#' is used to start a comment. I'm not sure why the IMARITH would fail, do you get an error message or just no image?
Here I have given all parameters, but i want to use zerocombine as parameter i.e. when I type :e infront of it , it will display its parameters and then I give the required parameters and output (masterbias) should pass to next step or task( ccdproc or imarith). [/quote]This just isn't possible in the way you describe. The only option is to epar ZEROCOMBINE before you run your script top set the parameters. This means you wouldn't need to set them explicitly in the script but you would still need to set the query parameters (e.g. the input file list) in the call. Note, you can just put "epar zerocombine" in the script.....-Mike


 
Profile Email
 Quote
ranisb
 09/22/2008 06:18AM  
++---
Junior

Status: offline


Registered: 05/26/2008
Posts: 17
Dear Mike,
Sorry this is my copy-paste mistake.Actually # is not infront of ccdproc.
My script is not showing any error till end. I have added on else loop to find out problem in the following way,
if (proccess) {
while (fscan (imglist, img) != EOF) { # Scan through imagelist
# Get rid of the ".fits" extention
i = strlen (img)
if (substr (img, i-4, i) == ".fits") {
img = substr (img, 1, i-5)
}
;
print ("It is ok 4.1")
# Call CCDPROC
if (access (img // ".fits")) {
print ("It is ok 4.2")
ccdproc (img, ccdtype = "", fixpix-, overscan-, trim-, zerocor+, darkcor-, flatcor-, illum-, fringe-, zero=biasmaster)
# imarith(operand1=img, op="-", operand2="biasmaster", result=rslt_tst)
print ("It is ok 4.3")
}
else {
print("No image to reduce")
}
;
print ("It is ok 4.4")
}
;
print ("It is ok 5")
}
;And output getting in both the cases (ccdproc and imarithmatic),
cc> biasred
It is ok 1
The biasframes to be combined (biasimage_lis): biasimage_lis
It is ok 2
The images to be reduced (image_lis ): image_lis
It is ok 3
z1=2421.5 z2=2539.667
It is ok 4
Process images (yes): yes
It is ok 4.1
No image to reduce
It is ok 4.4
It is ok 5
It is ok 6
It is ok 7

It shows that there is problem of accessing imagefile from image list, so how to solve this?As per your suggestion zerocombine may use as query parameter and just define "epar zerocombine" in the script, did it means like following :procedure biasred (biasframes, images, proccess)
string biasframes {prompt="The biasframes to be combined"}
string images {prompt="The images to be reduced"}
bool proccess = "yes" {prompt="Process images"}struct *bslist
struct *imglist
epar zerocombine
begin
.
.
.
.
endIf this is so, how to put/use output (masterbias) of zerocombine in the loop?
Confused
Do I use Pset task or parameter in the script?I am little confused, write me.Thanking you.Regards,
Rani

 
Profile Email Website
 Quote
fitz
 09/22/2008 06:18AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
[quote:4c8385d51f]
if (substr (img, i-4, i) == ".fits") {
img = substr (img, 1, i-5)[/quote:4c8385d51f]You want the last index in the substr() to be "i-4", right now you're stripping off too many characters and producing a filename that probably doesn't exist (hence, "no images to reduce").[quote:4c8385d51f]
As per your suggestion zerocombine may use as query parameter and just define "epar zerocombine" in the script, did it means like following : [/quote:4c8385d51f]No, what I meant was[code:1:4c8385d51f]
procedure biasred(...)
:
begin
:
epar zerocombine
zerocombine (......)
end
[/code:1:4c8385d51f]That lets you interactively edit the params, otherwise just specify them when you call zerocombine in the script. Forget about psets, they will not help you in this case.-Mike

 
Profile Email
 Quote
ranisb
 09/22/2008 06:18AM  
++---
Junior

Status: offline


Registered: 05/26/2008
Posts: 17
Hi Mike,
sorry for late reply.}
;}
; But still it is not accessing my image from image list.Help me then how to write this? ( still output shows 'no images to reduce')Also I tried with 'epar zerocombine' ,It is working . Again the same problem I want to give output of this step to ccdproc,I didn't understand how to write it?If pset task or parameter is not useful in this case.........where I can use it?I am sorry as my question somewhat repeating ,but still I am having some confusion
Confused
Write me please.regards,
Rani

 
Profile Email Website
 Quote
fitz
 09/22/2008 06:18AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
[quote:c482af1774]But still it is not accessing my image from image list.Help me then how to write this? ( still output shows 'no images to reduce')[/quote:c482af1774]You'll have to repost the entire script or check it yourself by printing out the image name to be sure you're trimming the extension as intended. Note the tasks are happy to take an image name with the extension so you can skip this step entirely unless you need the root for something else.[quote:c482af1774]Also I tried with 'epar zerocombine' ,It is working . Again the same problem I want to give output of this step to ccdproc,I didn't understand how to write it?[/quote:c482af1774]When you call zerocombine you'll need to pass in the image name either as a script variable or a literal string. Using epar means you might not need to pass in hidden params, but you could just as well set those params before you run your script. The only reason you might edit the params *each* time you run the script is if you reset some parameter, but the only thing likely to change is the input image name. In that case you pass it in anyway from the script so epar isn't necessary.[quote:c482af1774]If pset task or parameter is not useful in this case.........where I can use it?[/quote:c482af1774]Psets are use when you have a set of parameter common to several tasks or want to group large numbers of related params. There's no point in making a pset of the zerocombine parameters, the zerocombine task already defines those params! If you want to pass in a value to zerocombine, just define it as a param in your script.-Mike

 
Profile Email
 Quote
   
Content generated in: 0.34 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