View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

imexpr problem

Robert Janusz wrote on Jan 25, 2011

I do a very simple command in IRAF 2.15
imdel f; imexpr "1.0" f dim="1024,1"
imstat f
gives the result
IMAGE      NPIX      MEAN    STDDEV       MIN       MAX
    f      1024  9.447E29  2.787E31        0.  8.889E32
and
prow f 1
does not show constan 1. The command
imdel f; imexpr "I+1.0-I" f dim="1024,1"
is correct.

Mike Fitzpatrick wrote on Jan 25, 2011

It is arguable whether this is a real bug, or just a bad way for the task to behave, but it's been in the task since it was first released. What's happening is that for a scalar expression like "1.0" the task is only ever setting the first pixel in the line, the remainder of the line is undefined and so becomes filled with random values.

For what you're trying to do, a working expression would use the 'repl' function to replicate a value, e.g.

cl> imexpr "repl(1.0,16)" f dim="16,1"


It seems more intuitive to me however that if the expression is a simple constant than the intent is that ALL pixels be set to that value, and so I've modified the task for the next release to do that. Until then, the above expression should do what you want.

Last post on Jan 25, 2011