View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

string substitutions

Nostril585129 wrote on Dec 12, 2008

So I am trying to take a piece of text out of a variable, but seem to be having trouble. I call for a variable n from a list using fscan, which comes out in the form

20080519.0091.fits

I then try and insert it into XYXYMATCH in this way:
xyxymatch (input="b_"//n//"%.fits%%.coo%", reference="b_"//f//".coo", output="b_"//n//"%.fits%%.match%", tolerance=10, xin=x, yin=y, separation=15, matching="triangles", nmatch=35, ratio=8, nreject=15)


Because XYXYMATCH needs a coo file (which is already made), I am trying to feed it the string "b_20080519.0091.coo". Any thoughts on how to parse this string's extension? I know how to add to text to a string, just not take some away.

Thanks

Mike Fitzpatrick wrote on Dec 12, 2008

A simpler approach may just be to create the root part of the filename and concatenate the appropriate extension as needed, e.g.


root = "b_" // substr (n,1,strlen(n)-5)
xyxymatch (input=root // ".coo", ..... )


Depending on how you create your file list, you could also use the '%' operator to strip the root beforehand, e.g.


files ("2008*%.fits%%", > "imglist")


-Mike

Last post on Dec 12, 2008