Welcome to iraf.net Wednesday, May 01 2024 @ 11:44 PM GMT


 Forum Index > Help Desk > Applications New Topic Post Reply
 Unwanted prompt for list-directed parameter
   
JanRap
 06/01/2010 10:01AM (Read 1848 times)  
+----
Newbie

Status: offline


Registered: 09/14/2009
Posts: 11
HiI am suddenly getting prompts for my list-directed structs. Does this have anything to do with the tasks being in a package? Below is the relevant code:[code:1:32d189bccf]# The main task for the pipeline, from which
# other tasks are calledprocedure main (imagenames)# PROMPTS #string imagenames {prompt="file containing filenames of FITS frames"}#---------## LIST-DIRECTED STRUCTS #struct *imagenames_list#-----------------------#begin# DECLARATIONS #string dummy, filename#--------------#imagenames_list = imagenames
dummy = fscan(imagenames_list, filename)
display(filename,1)end
[/code:1:32d189bccf]When running main the following happens:$wium> main
file containing filenames of FITS frames (list.txt):
imagenames_list: <---- NOO, WHY?list.txt contains the name of one FITS frame and the file + the frame itself is in the same directory as the main task. The task definition in the extern.pkg file reads:
[code:1:32d189bccf]reset wium = /iraf/extern/wium/
task $wium.pkg = wium$wium.cl[/code:1:32d189bccf]and wium.cl contains:
[code:1:32d189bccf]
# Package script task for WIUM package# Load the neccesary packages noao
astutil
imred
ccdred
ccdtest
vtel
digiphot
daophot
photcal
ptools
obsutil
images
imutilset wium = "/iraf/extern/wium/"package $wium # Define packagetask main = "wium$main.cl"
task prepare = "wium$prepare.cl"
task do_daoedit = "wium$do_daoedit.cl"
task getsources = "wium$getsources.cl"clbye()[/code:1:32d189bccf]Thanks in advance for any help.
-Daniel

 
Profile Email
 Quote
fitz
 06/01/2010 10:01AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
Basically you get the list prompt when there's nothing that can be read from the file. If I had to guess, I'd say 'list.txt' is in the directory where the script lives, but isn't in the directory where you're running the task.

 
Profile Email
 Quote
JanRap
 06/01/2010 10:01AM  
+----
Newbie

Status: offline


Registered: 09/14/2009
Posts: 11
Thanks. "list.txt" was in the correct folder. I simply ran the main task again and didn't get the prompt (I must be going crazy :shock: ) However, I immediately ran into another problem. I am calling another task, getsources, which is in the same package, from the 'main' task. First I got the "Error: Cannot read paramater file..." error I asked about last week, so I added a "$" in front of the task definition for getsources in wium.cl. That works fine. However, in the next line, when I try to access a variable declared in getsources (getsources.daoeditfile), I get "Error: task 'getsources' has no param file". Here's the code: [code:1:751e991e37]# The main task for the pipeline, from which
# other tasks are calledprocedure main (imagenames)# PROMPTS #string imagenames {prompt="file containing filenames of FITS frames"}#---------## LIST-DIRECTED STRUCTS #struct *imagenames_list#-----------------------#begin# DECLARATIONS #string dummy, filename#--------------#imagenames_list = imagenames # Makes the list of image names list-directed
dummy = fscan(imagenames_list, filename) # Assigns the first image name to filename
display(filename,1) # Displays the frame with name filename in ds9getsources()print (getsources.daoeditfile)end[/code:1:751e991e37][code:1:751e991e37]procedure getsources()beginstring wcs, key, command, sourcefile, daoeditfile
real x, ysourcefile = mktemp("tmp$source") # Prepares the file containing the sources of interest
daoeditfile = mktemp("tmp$daoedit") # Prepares the daoedit.icommands file

while (fscan (imcur, x, y, wcs, command) != EOF)
{
key = substr (command, 1, 1)
if ((key == "t") || (key == "c") || (key == "s"))
{
print(x," ",y," ",wcs," ",command, >> sourcefile)
print(x," ",y," ",wcs," ","a", >> daoeditfile)
}
else if (key == "q")
break
else
beep
}end[/code:1:751e991e37]- Daniel

 
Profile Email
 Quote
fitz
 06/01/2010 10:01AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
Since your getsources() task has no parameters (i.e. nothing declared in the procedure statement or before the 'begin'), declaring it with the '$' is the correct thing to do.However, the 'getsources.daoeditfile' is the syntax used to reference a parameter of the given task, it cannot be used to access a variable in the script (which no longer exists once the task completes anyway). You'll need to save the value to a parameter (and then declare without the '$') in order to access it from another script.

 
Profile Email
 Quote
JanRap
 06/01/2010 10:01AM  
+----
Newbie

Status: offline


Registered: 09/14/2009
Posts: 11
Thank you. I should have known that Oops! I struggled a bit and finally got it working yesterday. Unfortunately I decided to change the name of the 'daoeditfile' variable/parameter, and got an error. I then changed it back to the way it was when it worked, and got the same error. Unlearning the parameters for the tasks involved didn't fix it either. Below is the code and the error message:[code:1:646a1b7a4e]# The main task for the pipeline, from which
# other tasks are calledprocedure main (imagenames)# PARAMETER DECLARATIONS #string imagenames {prompt="file containing filenames of FITS frames"}# LIST-DIRECTED STRUCTS #struct *imagenames_list#-------------------------------------------------------#begin# VARIABLE DECLARATIONS # string dummy, filename, sourcefile, daoeditfile#-------------------------------------------------------# imagenames_list = imagenames # Makes the list of image names list-directed
dummy = fscan(imagenames_list, filename) # Assigns first image name to filename
display(filename,1) # Displays the frame with name filename in ds9 sourcefile = mktemp("tmp$source")
daoeditfile = mktemp("tmp$daoedit") getsources(sourcefile,daoeditfile)
daoedit.icommands = daoeditfile#-------------------------------------------------------## DELETE TEMPORARY FILES # delete(sourcefile, ver-, >& "dev$null")
delete(daoeditfile, ver-, >& "dev$null")end
[/code:1:646a1b7a4e][code:1:646a1b7a4e]# Task getsources allows the user to select
# sources of interest through ds9 and to
# assign a flag to each one, indicating whether
# it is a target, comparison or standard. In
# the 'daoeditfile', the flags are replaced
# with an 'a', allowing this file to be passed
# to daoedit.icommandsprocedure getsources(sourcefile,daoeditfile)begin# VARIABLE DECLARATIONS # string wcs, key, command
real x, y#----------------------------------------------------------#

while (fscan (imcur, x, y, wcs, command) != EOF)
{
key = substr (command, 1, 1)
if ((key == "t") || (key == "c") || (key == "s"))
{
print(x," ",y," ",wcs," ",command, >> sourcefile)
print(x," ",y," ",wcs," ","a", >> daoeditfile)
}
else if (key == "q")
break
else
beep
}end
[/code:1:646a1b7a4e]$wium> main
file containing filenames of FITS frames (list.txt):
z1=2325.564 z2=8213.384
ERROR: Required parameter 'daoeditfile' not defined.
"getsources(sourcefile,daoeditfile)"
line 31: wium$main.cl
called as: 'main ()'
$wium>

 
Profile Email
 Quote
fitz
 06/01/2010 10:01AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
If you declare a script parameter, run the script, and then delete the parameter, the CL might still be using the parameter file from the uparm directory. You need to unlearn the task to reset the parameters. Anything declared in the procedure statement must be declared before the 'begin', your getsources script appears to be passing in parameters that aren't defined.

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