smp |
08/06/2008 04:05AM (Read 4846 times)
|
|
|
Status: offline
Registered: 07/27/2008
Posts: 70
|
Hi,I want to write a procedure script for following steps :(1) Accept from user the file name which contains 5 bias frames, 5 flat frames and 5 science frames.
(2) Make a master bias out of 5 bias frames
(3) Subtract it from all science and flat frames.
(4) Then using ccdproc , do overscan correction and trim 5 science frames.
Regards
smp
|
|
|
|
valdes |
08/06/2008 04:05AM
|
|
|
Status: offline
Registered: 11/11/2005
Posts: 728
|
This, writing scripts, that makes IRAF so useful. It requires taking the next step of learning script programming after using IRAF interactively. So, indeed, you can do what you outline. We are not able to write scripts for you but we do try and guide you when necessary. The first thing you have to do is go to the Docs area of the iraf.net site, open the Programming section and read "An Introductory User's Guide to IRAF Scripts". Try some of the examples and make so initial procedure scripts to see how parameters, such as your file names, are passed into scripts.Yours,
Frank Valdes
|
|
|
|
smp |
08/06/2008 04:05AM
|
|
|
Status: offline
Registered: 07/27/2008
Posts: 70
|
Hi FrankI had read the document(I have read sec. 7 also) which you mentioned already. I am trying in that direction.My Data: I have 5 bias frame, 5 flat frames, and 5 science frames.Names of 5 bias frames are listed in a text file : list_b.txt and so on.
The query parameter "bias_list" accepts this file name namely "list_b.txt" and so on.I have written rough script given below:
----------------------------------------------------------------------------------------------
procedure smp(bias_list,flat_list,sci_list)string bias_list
string flat_list
string sci_listbegin string l_bias_list
string l_flat_list
string l_sci_list l_bias_list = bias_list
l_flat_list = flat_list
l_sci_list = sci_list######### MAKE MASTER BIAS USING TASK 'ZEROCOMBINE'
zerocombine(input=l_bias_list,output="mbias.fits",combine="average",reject="minmax",
scale="none",nlow=0,nhigh=1)######### SUBTRACT MASTER BIAS FROM ALL FLAT FRAMES & SCIENCE FRAMES imarith(operand1=l_flat_list,op="-",operand2="mbias.fits",result=l_flat_list) imarith(operand1=l_sci_list,op="-",operand2="mbias.fits",result=l_sci_list)####### MAKE A LIST OF FILE NAMES WITH PREFIX LEFT AND RIGHT
:
:
:
:
end
------------------------------------------------------------------------------------------------------ Now what I want to do after the last comment is this:
I want to cut each science frame (which is master bias subtracted now) into 2 halves.
The fits images I am using have 2 parts( left and right) due to 2 read out mechanisms.So, I want to make images "left_sdss_1.0.fits" and "right_sdss_1.0.fits" from the master bias subtracted image "sdss_1.0.fits".
I want to do this because, I want to subtract left overscan region from "left_sdss_1.0.fits" and subtract right overscan region from "right_sdss_1.0.fits", using task "ccdproc".I know that we can use "imcopy" to achieve this (to cut image into 2 halves). One way is to give command:
eparam("imcopy")and then edit parameters.The 2nd way : I want to add command(s) in the script which will add the prefix "left" and "right" to the file name "sdss_1.0.fits" automatically i.e. without user interference.Please help.Regards
Swapnil
|
|
|
|
valdes |
08/06/2008 04:05AM
|
|
|
Status: offline
Registered: 11/11/2005
Posts: 728
|
Hello,It is common to add image sections in scripts. There are two ways, and I use both depending on the complexity of the string. Suppose imname is the variable containing the root part of the image name and secname is the variable with the section name (the image name followed by the [x1 2,y1:y2] section):[code:1:24d92cc345]
secname = imname // "[1:512,*]" # Concatenate explicit section
printf ("%s[1:512,*]\n", imname) | scan (secname) # Use printf
[/code:1:24d92cc345]The second approach with printf is more versatile since you could do something like[code:1:24d92cc345]
printf ("%s[%d:%d,%d:%d]\n", imname, x1, x2, y1, y2) | scan (secname)
[/code:1:24d92cc345]There are a many ways this stuff can be done. You just need to keep variables and explicit scripts clear in your mind. For you beginning problem you should probably just concatenate the explicit pieces you want. Instead of making a new variable a very simple thing is to do it in the imcopy command:[code:1:24d92cc345]
imcopy (imname//"[1:512,1:1024]", leftside)
imcopy (imname//"[513:1024,1:1024]", rightside)
[/code:1:24d92cc345]where imname, leftside, and rightside are variables.Yours,
Frank Valdes
|
|
|
|
smp |
08/06/2008 04:05AM
|
|
|
Status: offline
Registered: 07/27/2008
Posts: 70
|
hi Frank,thanks for the help. I modified my script according to your previous reply.
It worked.now in the same script , I have following statement:
---------------------------------------------------------------------------------------------
ccdproc(images = *_left.fits, output = "", fixpix = "no", overscan = "yes",
trim = "yes",zerocor = "no",darkcor = "no",flatcor = "no",
biassec = [15:60,*], trimsec = [61:1084,*])
---------------------------------------------------------------------------------------------If I run the script, I get the error:** Syntax error, line 73
**: biassec = [15:60,*], trimsec = [61:1084,*])
^
INTERNAL ERROR on line 82: parser gagged
proc ()
----------------------------------------------------------------------------------------So what would you like to say about this?Regards
Swapnil
|
|
|
|
valdes |
08/06/2008 04:05AM
|
|
|
Status: offline
Registered: 11/11/2005
Posts: 728
|
Hi,You have to quote the sections mentioned in the error message as well as the images template. Booleans (things with yes and no values) are not quoted. 1:F35817A595 Formatted Code
ccdproc(images="*_left.fits", output="", fixpix=no, overscan= yes,
trim=yes, zerocor=no, darkcor=no,f latcor =no,
biassec="[15:60,*]", trimsec="[61:1084,*]")
[/code:1:f35817a595]
When you use the command language interactively you don't have to quote explicit strings (usually). But when you write scripts, especially when using arguments to a task where the arguments are in parenthesis (task (param=value, ...)). The general rule is that if something is not a variable then it must be quoted. The point about booleans is the exception.
Frank
|
|
|
|
| |
|