Trim script error
Elden Paul Iverson wrote on Nov 30, 2007
I have been encountering the error "Undefined local variable 'x1'" error while using the following trim script.
[size=9:3ca5a6763b]#ap_subtrim_v_1.cl by Paul Iverson
#the purpose of this script is to remove possible bad pixels at the edges of the images
procedure ap_subtrim_v_1 (xsmall,xlarge,ysmall,ylarge)
string xsmall {prompt = "Minimum x value"}
string xlarge {prompt = "Maximum x value"}
string ysmall {prompt = "Minimum y value"}
string ylarge {prompt = "Maximum y value"}
begin
string x1
string x2
string y1
string y2
end
#variable declarations
int n = 1
int xlen, ylen
string s1 = ""
string dimfile
struct *list1
sections ("*obj*fits", opt="fullname", > "datalist1")
match ("sub","datalist1",stop+,>"datalistfile")
del datalist1
tabpar ("datalistfile",1,1)
dimfile = tabpar.value
imgets.param.p_mode = "h"
imgets (dimfile, param="i_naxis1")
xlen = int(imgets.value)
imgets (dimfile, param="i_naxis2")
ylen = int(imgets.value)
print ("Maximum x value of frame ",xlen)
x1 = xsmall
x2 = xlarge
print ("")
print ("Maximum y value of frame ",ylen)
y1 = ysmall
y2 = ylarge
imcopy ("obj-*["//x1//":"//x2//","//y1//":"//y2//"]","obj-*//.sub")
del data*
[/size:3ca5a6763b]
Interestingly enough, I have used this syntax to call a prompt in another script and it works fine.
Any ideas?
[size=9:3ca5a6763b]#ap_subtrim_v_1.cl by Paul Iverson
#the purpose of this script is to remove possible bad pixels at the edges of the images
procedure ap_subtrim_v_1 (xsmall,xlarge,ysmall,ylarge)
string xsmall {prompt = "Minimum x value"}
string xlarge {prompt = "Maximum x value"}
string ysmall {prompt = "Minimum y value"}
string ylarge {prompt = "Maximum y value"}
begin
string x1
string x2
string y1
string y2
end
#variable declarations
int n = 1
int xlen, ylen
string s1 = ""
string dimfile
struct *list1
sections ("*obj*fits", opt="fullname", > "datalist1")
match ("sub","datalist1",stop+,>"datalistfile")
del datalist1
tabpar ("datalistfile",1,1)
dimfile = tabpar.value
imgets.param.p_mode = "h"
imgets (dimfile, param="i_naxis1")
xlen = int(imgets.value)
imgets (dimfile, param="i_naxis2")
ylen = int(imgets.value)
print ("Maximum x value of frame ",xlen)
x1 = xsmall
x2 = xlarge
print ("")
print ("Maximum y value of frame ",ylen)
y1 = ysmall
y2 = ylarge
imcopy ("obj-*["//x1//":"//x2//","//y1//":"//y2//"]","obj-*//.sub")
del data*
[/size:3ca5a6763b]
Interestingly enough, I have used this syntax to call a prompt in another script and it works fine.
Any ideas?
Mike Fitzpatrick wrote on Nov 30, 2007
Quick guess: The 'end' statement following the 'string' variable declarations instead of being the last line in the script.
-Mike
-Mike
Elden Paul Iverson wrote on Nov 30, 2007
The problem was actually in my login.cl.
Last post on Nov 30, 2007