Submit a Story  :  IRAF Links  :  Past Polls  :  Calendar  :  Advanced Search  
     iraf.net
FAQ
 Forum FAQForum FAQ   Forum SearchForum Search   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

hselect difficulty

 
Post new topic   Reply to topic    iraf.net Forum Index -> General IRAF
View previous topic :: View next topic  
Author Message
AndrewS
Active IRAF User


Joined: 10 Oct 2010
Posts: 33
Location: Galway Ireland

PostPosted: Fri Jul 22, 2011 11:33 pm    Post subject: hselect difficulty Reply with quote

hello

I want to use hselect to parse out all images of a given filter.. the relevant header keyword used in these images is FILTER but unfortunately the value assigned to this keyword has an apostrophe as in:

FILTER = u'
FILTER = g'
FILTER = i'
etc.

so when I use what would be the correct command to parse out the images with u filter, the apostrophe creates an error. - command is:

Code:

hselect @list.txt $I "(FILTER ?= 'r'')"


error returned is:
Quote:

ERROR: missing closing quote in string constant


is there an escape character that can be used to get hselect to recognise the apostrophe?
Back to top
View user's profile Send private message
fitz
Site Admin


Joined: 30 Sep 2005
Posts: 3255
Location: Tucson

PostPosted: Sat Jul 23, 2011 1:28 am    Post subject: Reply with quote

Assuming the apostrophe is done properly in the header (i.e. that a value like "O'Hara" is written as "O''Hara"), the you can use either the same double-apostrophe trick or a '\' to escape the value. For example

Code:

ecl> hselect dpix.fits $I,FILTER '(filter?="r''")'
dpix.fits   "        r'"
ecl> hselect dpix.fits $I,FILTER '(filter?="r\'")'
dpix.fits   "        r'"


Note that the "?=" string comparison operator does a substring search, so a simple "filter?='r'" would also work (so long as it is unique).
Back to top
View user's profile Send private message
AndrewS
Active IRAF User


Joined: 10 Oct 2010
Posts: 33
Location: Galway Ireland

PostPosted: Sat Jul 23, 2011 7:15 pm    Post subject: Reply with quote

thanks for your reply - although I realise now that it is not necessary to include the apostrophe....simply:
Code:

hselect @list.txt $I "(FILTER ?= 'r')"

is sufficient to parse out all images with:
[QOUTE]
FILTER = r'
[/QOUTE]

But the problem that was causing this in the first place is that some images in list.txt do not have the keyword FILTER and so when hselect encounters one of these images it returns the error:
Quote:

ERROR: Image header parameter not found (FILTER)

hedit is obviously the task to do remedy this but I am having trouble getting to grips with what each of its parameters actually does..

for example I thought the following command would add a keyword value FILTER with dummy value X to any image who's header currently does not contain the keyword FILTER:
Code:

hedit @list.txt FILTER add+ addonly+  verify- update-

however, the output returned suggested that not only did hselect add keyword FILTER with value X to images that currently did not have that keyword but it also changed the keyword value for all other images that already had the keyword FILTER, here is a sample of the output returned to me:
Quote:

.........
DATE/nov21/full_moon_033.fit,FILTER: u' -> X
add DATE/nov21/bias_001.fit,FILTER = X
add DATE/nov21/bias_050.fit,FILTER = X
DATE/nov21/full_moon_083.fit,FILTER: u' -> X
DATE/nov21/full_moon_015.fit,FILTER: u' -> X
add DATE/nov21/bias_110.fit,FILTER = X
DATE/nov21/full_moon_089.fit,FILTER: u' -> X
add DATE/nov21/bias_134.fit,FILTER = X
add DATE/nov21/bias_158.fit,FILTER = X
add DATE/nov21/bias_116.fit,FILTER = X
....and so on


first off, I only wanted wanted it to add the keyword FILTER if it didn't exist, not to update it if it did already exist!! - that was probably down to my misunderstanding what each of the parameters actually does....
But more surprising than that is that despite the output of hedit as quoted above, if after running hedit I then check the keyword FILTER of any of the images that it supposedly updated, the value for FILTER remains at its old value or if the keyword FILTER did not exist for a particular image it will still not exist although the output of hedit suggests otherwise. For example, from the above output, if I were to check the keyword FILTER of
DATE/nov21/full_moon_089.fit, it would still be FILTER = u'...or if I check FILTER value for DATE/nov21/bias_116.fit, the keyword FILTER will still not exist for this image..
Why is this?
(and apologies for longwinded post!)
Back to top
View user's profile Send private message
fitz
Site Admin


Joined: 30 Sep 2005
Posts: 3255
Location: Tucson

PostPosted: Mon Jul 25, 2011 1:06 pm    Post subject: Reply with quote

I think the magic combination of parameters you need is

Code:
cl> hedit ...... add- addonly+


The 'add+' will override the 'addonly' param and change the value for existing params, otherwise the 'addonly' is used as the only toggle.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    iraf.net Forum Index -> General IRAF All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2009 phpBB Group
 Copyright © 2005-2011 iraf.net
 All trademarks and copyrights on this page are owned by their respective owners.
Powered By Geeklog 
Created this page in 0.27 seconds