Welcome to iraf.net Friday, April 19 2024 @ 03:41 AM GMT


 Forum Index > Help Desk > General IRAF New Topic Post Reply
 Pset parameter problem
   
smp
 08/27/2008 09:14AM (Read 6396 times)  
++++-
Regular Member

Status: offline


Registered: 07/27/2008
Posts: 70
Hi,I have written following small procedure script (trial.cl)
-------------------------------------------------------------------------------------
procedure trial (bias_list)string bias_list {prompt = "Give name of file containing bias images" }
struct *flist {prompt = "I want to remove this hidden parameter" }
pset myzero {prompt = "Edit parameters of task myzero " }begin
struct img
flist = bias_list while(fscan(flist,img) != EOF)
print(img) print(myzero.mbname)

end
------------------------------------------------------------------------
'myzero' is a pset parameter. This is my own pset parameter.
This is very similar to task zerocombine of ccdred package.
If I do 'epar myzero' , one can see:PACKAGE = ccdred
TASK = myzerobias_lis= @list_b.txt
mbname = mbias.fits
(combtyp= average)
(rejtype= minmax)
(scalety= none)
(nlow_va= 0)
(nhigh_v= 1)
(mode = ql)
-------------------------------------------------------------------------------------------
Now, I give following commands:
1) cc> epar trialPACKAGE = ccdred
TASK = trialbias_lis= list_b.txt Give name of file containing images
(flist = list_b.txt) I want to remove this hidden parameter
(myzero = ) Edit parameters of task 'myzero' which makes master bias
(mode = ql)2) When cursor is at pset parameter 'myzero', I give following command:
:e
This displays parameters in 'myzero'. I edit them. 3) Then I give command:
ctrl+D
This will save parameters of pset-task 'myzero'. And cursor comes back to
task 'trial' at the same location i.e. at pset name 'myzero'.4) Then second ctrl + D will save updated values of parameters of task 'trial' and come out of the task and control returns to cc> prompt.
-----------------------------------------------------------------------------------------------------This should create the master bias frame. But actually I do not get this frame. [b:43cae69768]Only name[/b:43cae69768] of the master bias frame (which is given at the time of pset parameter editing) is printed as coded in the script 'trial.cl'.Please tell what is going wrong.Regards
smp

 
Profile Email
 Quote
fitz
 08/27/2008 09:14AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
I don't quite understand the problem: The script does only print the name of the file, why are you expecting it would create the image? Does your real script do something different? Could you please post more information, including details on what you expect to happen.-Mike

 
Profile Email
 Quote
smp
 08/27/2008 09:14AM  
++++-
Regular Member

Status: offline


Registered: 07/27/2008
Posts: 70
Hi Mike,I have a script (called trial.cl) i.e. a cl task. (trial.cl is given in my previous post)
It has one pset parameter (called myzero).
So 'myzero' is inside 'trial'. Generation of master bias frame is to be done by 'myzero'. Basically 'myzero' is a again a task (i.e. a cl script) which is given below:
---------------------------------------------------------
procedure myzero (bias_list, mbname)string bias_list
string mbname
string combtype
string rejtype
string scaletype
int nlow_val
int nhigh_valbegin string l_bias_list
string l_mbname l_bias_list = bias_list
l_mbname = mbname zerocombine(input=l_bias_list,output=l_mbname,combine=combtype,
reject=rejtype, scale=scaletype,nlow=nlow_val,nhigh=nhigh_val)end
----------------------------------------------------------------------------------------------------In this 'myzero' script, the call for zerocombine should generate the master bias frame.
But as I told in previous post, only value of the parameter 'mbname' is printed (as per the trial.cl). But actual master bias frame is not created. This is my problem.(Actually, I was not able to incorporate zerocombine task in trial.cl as a pset parameter. Hence I created my own version of zerocombine i.e. 'myzero'. By the way, is there any way to do this?)Regards
smp

 
Profile Email
 Quote
fitz
 08/27/2008 09:14AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
Ahh. Your original message declared 'myzero' as a pset and so when I tried to reproduce the problem I created a 'myzero.par' file to be used as the pset. What you have, is a regular procedure script that behaves like any other task except that by declaring it as a pset you simply access the parameters, not execute the task.A pset is like a global parameter file that can be included in the parameters of a number of tasks in a package. It's like a task in the sense that when you execute it, it brings up 'epar' but that's all. It must, however, be a .par file and not a .cl script file.For the scripts you posted, you need to actually execute the 'myzero' command in order to create the image. Your print statement simply prints the parameter for the task, it doesn't do anything to execute the script. Hope this explains it.Cheers,
-MikeP.S. You might want to see the document ftp://iraf.noao.edu/iraf/docs/pset.ps.Z for more information. I thought it was available here but apparently not....

 
Profile Email
 Quote
smp
 08/27/2008 09:14AM  
++++-
Regular Member

Status: offline


Registered: 07/27/2008
Posts: 70
hi Mike,Still I am facing the problem. Let me tell you in detail what I did.
As you told, I created myzero.par (just changing extension .cl to .par).
Then gave following commands :
cc> task trial = trial.cl
cc> task myzero = "myzero.par"
This created task 'trial' and pset-task 'myzero@' in the package 'ccdred'.Also, in the trial.cl script, I added the command 'myzero' before the print statement:
----------------------------------
:
:
myzero
print("")
print(myzero.mbname)
print("")
end
-----------------------------------
So when I give command 'epar trial' , parameters for task trial are displayed. When the cursor is at pset parameter 'myzero', I press :e to edit parameters of pset-task 'myzero'. Then following error is displayed: -----------------------------
bad type spec `m' in `procedure myzero (bias_list'
must specify at least name,type,mode for `string bias_list'
must specify at least name,type,mode for `string mbname'
must specify at least name,type,mode for `string combtype'
must specify at least name,type,mode for `string rejtype'
must specify at least name,type,mode for `string scaletype'
must specify at least name,type,mode for `int nlow_val'
must specify at least name,type,mode for `int nhigh_val'
must specify at least name,type,mode for `begin'
must specify at least name,type,mode for `string l_bias_list'
must specify at least name,type,mode for `string l_mbname'
must specify at least name,type,mode for `l_bias_list = bias_list'
must specify at least name,type,mode for `l_mbname = mbname '
bad type spec `o' in `zerocombine(input=l_bias_list'
bad type spec `s' in `reject=rejtype'
must specify at least name,type,mode for `end'
ERROR: cannot read parameter file `myzero.par'
eparam ()
--------------------------------What is wrong then?Regards
smp

 
Profile Email
 Quote
fitz
 08/27/2008 09:14AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
'myzero' is NOT a pset, it is a script task so it must still be called 'myzero.cl'. This also means you cannot edit the parameters while editing the params for the 'trial' task but need to edit them separately.
What you need to do is:[code:1:c59d6592a0]
cl> task trial = trial.cl
cl> task myzero = myzero.cl
cl> epar trial
.....edit those parameters
cl> epar myzero
.....edit these parameters
[/code:1:c59d6592a0]Then your trial.cl script would look something like[code:1:c59d6592a0]
:
:
myzero (bias_list, mbname)
print("")
print(myzero.mbname)
[/code:1:c59d6592a0]Note that 'mbname' is not a parameter to trial but you may need to add it so that you can pass the parameter name to the myzero task. It also means you need to remove the declaration of myzero as a pset from the trial.cl task.
Cheers,
-Mike

 
Profile Email
 Quote
smp
 08/27/2008 09:14AM  
++++-
Regular Member

Status: offline


Registered: 07/27/2008
Posts: 70
Hi Mike,Now I am confused! (1)
My aim is to use 'myzero' as a pset parameter for the task 'trial'.
But you are telling me to remove the declaration of 'myzero' as a pset parameter in 'trial.cl'. Then what is the use of writing 'myzero' . I could have used zerocombine directly in trial.cl.
(As I told in earlier reply, I was not able to use zerocombine as a pset parameter for the trial.cl. Hence I created 'myzero'. Actually I want to do this in future, first I am trying on 'myzero')What I want to do should be similar to the following example:
In Iraf, we have follong:no> digi
apphot. daophot. photcal. ptools. di> daophot
addstar daotest nstar pexamine psf
allstar datapars@ pcalc pfmerge psort
centerpars@ findpars@ pconcat phot pstselect
daoedit fitskypars@ pconvert photpars@ seepsf
daofind group pdump prenumber setimpars
daopars@ grpselect peak pselect substarIn this package (daophot), @'s are pset parameters.
Particularly, fitskypars@ is a pset parameter used in the task 'phot'.
So when we do "epar phot" and edit parameters, then when cursor is at pset parameter 'fitskypars', we give ":e" , then parameter file for 'fitskypars' is opened , we edit parameters, save them by "ctrl+D", then come back to remaining parameters of "phot" for editing.So similarly I want to use 'myzero' as a pset parameter in the task 'trial'. (2)
According to your previous post, I removed declaration of 'myzero' as a pset parameter in 'trial.cl'. Then added commands in trial.cl as : :
:
string mbname
flist = bias_list
:
mbname = "mbias.fits"
myzero(bias_list,mbname) print("")
print(myzero.mbname)
:
But when I edit parameters of 'trial' and execute the task, I get error:
(if I re-execute the trial, I get some different error!)
-----------------------------
cc> trial
Give name of file containing bias images (list_b.txt): bias_1.0.fits
bias_2.0.fits
bias_3.0.fits
bias_3.1.fits
bias_4.0.fitsGive name of file containing bias images (list_b.txt):
Warning: Cannot open image (list_b.txt)
ERROR on line 46: No images to combine
zerocombine (input=list_b.txt, output=mbias.fits, combine=average, reject=minmax, scale=none, nlow=0, nhigh=1)
myzero (bias_list=list_b.txt, mbname=mbias.fits)
trial () ---------------------------------
In Above error message, I am not getting why following statement is being repeated:- Give name of file containing bias images (list_b.txt): Also, if I edit parameters for 'myzero' and execute it , I get following error:
-------------------------------------
cc> myzero
bias_list (@list_b.txt):
mbname (mbias.fits):
Warning: Cannot open file (combine\)
Old format = " reject = minmax, nlow = %d<>, nhigh = %d\n")
ERROR on line 46: Parameter not a legal boolean (try 'yes' or 'no') (verbose)
zerocombine (input=@list_b.txt, output=mbias.fits, combine=average, reject=minmax, scale=none, nlow=0, nhigh=1)
myzero ()
--------------------------------------
Also:
'mbias.fits' is created , but when I use ds9 to view this image, I get the error that this image can not be loaded.

Regards
smp

 
Profile Email
 Quote
fitz
 08/27/2008 09:14AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
[quote:4278f02f12]
My aim is to use 'myzero' as a pset parameter for the task 'trial'.
But you are telling me to remove the declaration of 'myzero' as a pset parameter in 'trial.cl'. Then what is the use of writing 'myzero' . I could have used zerocombine directly in trial.cl. [/quote:4278f02f12]Exactly. If you want myzero to be a pset then you need to write it as a parameter file, NOT as a CL script. E.g. something like[code:1:4278f02f12]
bias_list,s,a,"",,,
mbname,s,a,,,,
combtype,s,h,,,,
rejtype,s,h,,,,
scaletype,s,h,,,,
nlow_val,i,h,,,,
nhigh_val,i,h,,,,
mode,s,h,"ql",,,[/code:1:4278f02f12]But, since you're only using this to pass in the bias_list/mbname params you SHOULD just be calling zerocombine from the trial.cl script. If you look at the psets you mentions like 'datapars' you'll see they are parameter files and do not execute any tasks.[quote:4278f02f12]ERROR on line 46: No images to combine [/quote:4278f02f12]You can search the forums for this error, but basically it means the cctype keyword isn't identifying the images as bias frames. You can set the 'ccdtype' parameter to the task to an empty string to force it to combine images in the list regardless.[quote:4278f02f12]In Above error message, I am not getting why following statement is being repeated:- Give name of file containing bias images (list_b.txt): [/quote:4278f02f12]It's because the bias_list is a query parameter and the value is prompted for every time the variable gets used. If you set a local variable you'll only get one prompt.[quote:4278f02f12]
(Actually, I was not able to incorporate zerocombine task in trial.cl as a pset parameter. Hence I created my own version of zerocombine i.e. 'myzero'. By the way, is there any way to do this?) [/quote:4278f02f12]I'm not quite sure what you mean: Tasks are not psets, psets are tasks that contain only parameters.-Mike

 
Profile Email
 Quote
smp
 08/27/2008 09:14AM  
++++-
Regular Member

Status: offline


Registered: 07/27/2008
Posts: 70
ok Mike,Now I will come back to work on Monday. I will try according to your previous post.regards
smp

 
Profile Email
 Quote
smp
 08/27/2008 09:14AM  
++++-
Regular Member

Status: offline


Registered: 07/27/2008
Posts: 70
Hi Mike,Now what I did is this:(1) I wrote a parameter file called myzero.par as follows:
input,s,a,"",,,
output,s,a,"",,,
combine,s,h,"",,,
reject,s,h,"",,,
scale,s,h,"",,,
nlow,i,h,,,,
nhigh,i,h,,,,
mode,s,h,"ql",,,[b:8271317720]The names of these parameters are exactly the same as those of zercombine parameters.[/b:8271317720](2) Then re-wrote trial.cl as
---------------------------
procedure trial (bias_list)string bias_list {prompt = "Give name of file containing bias images"}
struct *flist {prompt = "I want to remove this hidden parameter"}
pset myzero {prompt = "zerocombine parameters "}begin
struct img
flist = bias_list print("")
while(fscan(flist,img) != EOF)
print(img) zerocombine print("")
print(zerocombine.output)
print("")end
-------------------------------(3) Then I gave commands: cc> unlearn zerocombine cc> task trial = trial.cl
cc> task myzero = "myzero.par" (4) Then following commands:
cc> epar trialPACKAGE = ccdred
TASK = trial
bias_lis= list_b.txt Give name of file containing bias images
(flist = list_b.txt) I want to remove this hidden parameter
(myzero = ) zerocombine parameters
(mode = ql) When cursor was at pset myzero, :ePACKAGE = ccdred
TASK = myzero
input = list_b.txt
output = smp.fits
(combine= average)
(reject = minmax)
(scale = none)
(nlow = 0)
(nhigh = 1)
(mode = ql) Then to save these ctrl+D
So cursor comes back to trial parameters. Again ctrl+D.(5) Then command
cc>trial
Then after printing list of bias frames I get the error:
ERROR on line 46: No images to combine
zerocombine ()
trial ()That means , zerocombine is not getting the parameters of pset myzero.
How to link these two things?(6) In the document "Named External Parameters Sets in the CL", page no. 3, first line, it is written that ---"Binding of a pset parameter to a particular instance of the referenced parameter set occurs when a task is executed..."Does this mean that when I execute the task trial, (and zercombine is executed internally) , the binding of pset-myzero-parameters occurs with zercombine parameters?Regards
smp

 
Profile Email
 Quote
fitz
 08/27/2008 09:14AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
Your call to ZEROCOMBINE must still be done by passing in the parameters for ZEROCOMBINE. It doesn't know that you have some other pset defined or how you are using it, and unless you want to use 'myzero' as a pset for other tasks you don't really even need it.The trial.cl script should look something like[code:1:cf1b528ef4]
procedure trial (bias_list)string bias_list {prompt = "Give name of file containing bias images"}
struct *flist {prompt = "I want to remove this hidden parameter"}
pset myzero {prompt = "zerocombine parameters "}begin
struct img
flist = bias_listwhile(fscan(flist,img) != EOF)
print(img)zerocombine (bias_list, output="mbias.fits", combine=myzero.combine, .....and so on)print(zerocombine.output)end
[/code:1:cf1b528ef4]-Mike

 
Profile Email
 Quote
fitz
 08/27/2008 09:14AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
Your call to ZEROCOMBINE must still be done by passing in the parameters for ZEROCOMBINE. It doesn't know that you have some other pset defined or how you are using it, and unless you want to use 'myzero' as a pset for other tasks you don't really even need it.The trial.cl script should look something like[code:1:2d64c186c0]
procedure trial (bias_list)string bias_list {prompt = "Give name of file containing bias images"}
struct *flist {prompt = "I want to remove this hidden parameter"}
pset myzero {prompt = "zerocombine parameters "}begin
struct img
flist = bias_listwhile(fscan(flist,img) != EOF)
print(img)zerocombine (bias_list, output="mbias.fits", combine=myzero.combine, .....and so on)print(zerocombine.output)end
[/code:1:2d64c186c0]-Mike

 
Profile Email
 Quote
smp
 08/27/2008 09:14AM  
++++-
Regular Member

Status: offline


Registered: 07/27/2008
Posts: 70
I modified trial.cl as per your post.
It did not work.
I get following error:[quote:723e5cd36d]Give name of file containing bias images (@list_b.txt):
ERROR on line 46: No images to combine
zerocombine (input=@list_b.txt, output=smpp.fits, combine=median, reject=minmax, scale=none, nlow=0, nhigh=1)
trial ()[/quote:723e5cd36d](I changed the value of 'combine' parameter to 'median' from previous value 'average' i.e. while editing pset 'myzero' .Error message above shows this change)Ok. let us , for just time being, forget the pset myzero.I write (for checking purpose) following very simple script (trial.cl):[code:1:723e5cd36d]procedure trial (bias_list)
string bias_list {prompt = "Give name of file containing bias images"}begin string l_bias_list
l_bias_list = bias_listzerocombine(input=l_bias_list,output="mbias.fits",combine="average",reject="minmax",
scale="none",nlow=0,nhigh=1) print(zerocombine.output)end[/code:1:723e5cd36d]If run this script I get error:
cc> trial
(I gave @list_b.txt as input in epar trial, as list_b.txt is a list of images)[quote:723e5cd36d]Give name of file containing bias images (@list_b.txt):
ERROR on line 46: No images to combine
zerocombine (input=@list_b.txt, output=mbias.fits, combine=average, reject=minmax, scale=none, nlow=0, nhigh=1)
trial ()[/quote:723e5cd36d]THIS IS VERY MUCH UNEXPECTED FOR ME. Because in another similar script, I was getting masterbias frame successfully.I logged out of iraf and re logged in. But same error occurs.

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