View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Snow Leopard and scripts

douglas brenner wrote on Sep 13, 2009

I'm having trouble running scripts on Snow Leopard. I ran a script using print and imarith but am having no luck using imexpr and iminsert. I've used imexpr many times previous with earlier versions of Mac OS.

Here is one example of what didn't work.
procedure makemask
begin
imexpr expr = "( (I > -1) && (J > -1) ) ? 0:1", output="/nrm/blank.fits", dims = "256,256", verbose = no
end

Mike Fitzpatrick wrote on Sep 13, 2009

In the "command mode" syntax you use for the IMEXPR line, there should be no commas between the parameters. It is "program mode" where you use braces around the parameters and commas between them. Try e.g.

imexpr (expr="...", output="blank.fits", dims="256,256", .....)


I think this may also explain your other IMINSERT posting, I'll have to check whether this should be producing a syntax error but I don't think it has anything to do with Snow Leopard.

-Mike

douglas brenner wrote on Sep 13, 2009

imexpr expr = "( (I > -1) && (J > -1) ) ? 0:1", output="/nrm/blank.fits", dims = "256,256", verbose = no

imexpr (expr = "( (I > -1) && (J > -1) ) ? 0:1", output="/nrm/blank.fits", dims = "256,256", verbose = no)

imexpr (expr = "( (I > -1) && (J > -1) ) ? 0:1" output="/nrm/blank.fits" dims = "256,256" verbose = no)
imexpr expr = "( (I > -1) && (J > -1) ) ? 0:1" output="/nrm/blank.fits" dims = "256,256" verbose = no

tried them all.
writing in text edit but haven't had much luck with vi either.

Which one should work?

douglas brenner wrote on Sep 13, 2009

procedure makeblank
begin
imexpr (expr = "( (I > -1) && (J > -1) ) ? 0:1", output="/nrm/blank.fits", dims = "2556,256" verbose = no)
end
modified and saved in vi.
no luck

Mike Fitzpatrick wrote on Sep 13, 2009

The second one should work, but I notice you're not specifying an 'a' parameter for the input image, did you set this before running the script?
Your script doesn't have any parameters, are you declaring the task with the '$' before the name to indicate this?

douglas brenner wrote on Sep 13, 2009

Yes, I use the $ and I gave it a parameter a = 0 even though I don't use it but no luck

Mike Fitzpatrick wrote on Sep 13, 2009

The 'I' and 'J' are pixel indices so you need to specify 'a' as an image. If you simply want a blank image, see the MKPATTERN task in ARTDATA.

douglas brenner wrote on Sep 13, 2009

procedure makeblank
begin
imexpr (expr = "( (I > -1) && (J > -1) ) ? 0:1", output="/nrm/blank.fits", a="/nrm/fft.fits", dims = "256,256" verbose = no)
end

no luck.
Will try mkpattern but really need to know what is wrong here and with iminsert. I check my syntax there.

douglas brenner wrote on Sep 13, 2009

procedure preparetofft
begin
iminsert (input1 = "zeros.fits", input2 = "test.fits[1:125,1:125]", output = "prepared.fits", option = "replace", coordfile = "starts/lltour.txt")

end

no luck.

Mike Fitzpatrick wrote on Sep 13, 2009

It looks like it should work, what are the image sizes and what is in the coordfile? Could it be you're moving pixels off the end of the image?

If that same command works from the cl prompt you can try turning on the 'd_trace' flag (just type d_trace to toggle it) to see what's happening and post those results, using d_on/d_off will produce more verbose output.

douglas brenner wrote on Sep 13, 2009

It works on the command line; file sizes (256 x 256) and (125x125) and the coordfile ( 1 131) are not the problem.

preparetofft
----- task cl - line 0 (CALL) -----
0 0+7: call preparetofft
0 7+3: exec
----- exec script preparetofft (/nrm/preparetofft.cl) - line 0 -----
----- task cl - line 0 (END) -----
0 10+3: end

d_on
ecl> preparetofft
parse init (block)...
----- task cl - line 0 (CALL) -----
0 0+7: call preparetofft
run: pc=0, op=CALL
callnewtask: name=preparetofft, currentask=3196DC
0 7+3: exec
run: pc=7, op=EXEC
execnewtask: pc = 10 (line 0)
paramfind() looking down pfile `preparetofft'/359360 for `$nargs'
----- exec script preparetofft (/nrm/preparetofft.cl) - line 0 -----
Returning from execnewtask.yyin, ct_in, nt_in:2076916 2076916 2076916
startblock (1)
startblock: ifseen=0
ÿþpparse init (block)...
received `eof' from `preparetofft'
paramfind() looking down pfile `cl'/31EBD8 for `$errno'
paramfind() looking down pfile `cl'/31EBD8 for `$errmsg'
paramfind() looking down pfile `cl'/31EBD8 for `$errtask'
flushing io for task `preparetofft'
restoring task `cl', tp: 3249884
topd 60276/59896
----- task cl - line 0 (END) -----
0 10+3: end
run: pc=10, op=END
startblock (1)
startblock: ifseen=0
ecl>

douglas brenner wrote on Sep 13, 2009

It seems that I can no longer use text edit. I was able to get scripts working using vi instead.

My knowledge of Unix editors is slim. What editors work with cl?
thanks.

rohit wrote on Sep 13, 2009

I have been using Snow Leopard and creating scripts on TextEdit. When writing scripts make sure you have disable formatting Do not use Rich Text rather plain text.

Alternately, you can use AquaMacs.

Last post on Sep 13, 2009