View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Problem with hselect?

Philip Massey wrote on Feb 10, 2006

We think we may have found a bug in HSELECT's string comparison operator "?=" .

Consider the following:

cl> hselect *.fit $I,i_title yes
img01.fit Tr14
img02.fit Tr14
img03.fit Tr14
img04.fit Tr16
img05.fit Tr16
img06.fit Tr16
img07.fit NGC3603
img08.fit NGC3603
img09.fit NGC3602
img10.fit NGC3602
cl>
cl> hselect *.fit $I,i_title "(i_title ?= '*16*')"
img01.fit Tr14 ***** wrong
img02.fit Tr14 ***** wrong
img03.fit Tr14 ***** wrong
img04.fit Tr16
img05.fit Tr16
img06.fit Tr16
cl>
cl> hselect *.fit $I,i_title "(i_title ?= '*03*')"
img07.fit NGC3603
img08.fit NGC3603
img09.fit NGC3602 ***** wrong
img10.fit NGC3602 ***** wrong

The substring comparison (as detailed in the HEDIT help page) is only
comparing the first character of the substring, and not the whole substring.

Mike Fitzpatrick wrote on Feb 10, 2006

Hi Phil,

We think we may have found a bug in HSELECT's string comparison operator "?="


Actually, you found something like 4 bugs. The problem is first that the pattern matching buffer wasn't properly initialized and the second is that the wrong buffer was being used to create the pattern. This affects both the evexpr and evvexpr expression code (2bug times 2 files = 4).

Since the '?=' operator basically already does a substring search the workaround is to simply remove the '*' from both sides of your string and you should get the proper headers.

The code change is trivial but requires a recompile of the system. Email if you want the change but otherwise it'll be fixed in the next release (i.e. the upcoming intel port).

-Mike

bruzzone wrote on Feb 10, 2006

Hi! I'm having strange issues with hselect.
Consider the followng:

hselect("Zy*%.fits%%","$I","(filterid='"//filt//"' &&((i_title ?='SKY')||(i_title ?='Sky')||(i_title ?='sky')||(i_title ?='even')||(i_title ?= 'twi')||(i_title ?='Twi')||(i_title ?='morn')))",>"skys")

This seems to work, extracted from a script of Massey (y4kflat)
Now, I'm trying to use
hselect("@lista", "$I","(IMAGETYP ='zero' && (lectura = '100khz')  )" , > 'bias_list')
       hselect("@lista","$I","(IMAGETYP ='object'&& (lectura='100khz' ))" , > 'object_list')
        hselect("@lista","$I","(IMAGETYP ='flat'&& (lectura = '100khz' ))",  > 'domeflat_list')
	hselect("@lista","$I","(IMAGETYP ='skyflat' && (lectura='100khz')) ",  > 'skyflat_list')

and what I get is:

ERROR: Image header parameter not found (lectura)
"hselect("@lista", "$I","(IMAGETYP ='zero' && (lectura = '100khz') ) ..."
line 8: select.cl
called as: `select ()'

And the bias_list file is written with the correct images on it. So it "works".
the field lectura (frecuency reading format, related to readout noise) is present in all images.
Suggestions?

Thanks in advance
Seba

Mike Fitzpatrick wrote on Feb 10, 2006

Try using the string comparison operator '?=' instead of just '='. Can you run hselect to select just on the lectura keyword, i.e.

hselect @list $I "lectura ?= '100khz'"


-Mike

bruzzone wrote on Feb 10, 2006

Sure, I will filter images in two steps, I was trying to select them using one single hselect sentence.
I wil try the ?= operator instead.
Thank you
seba

bruzzone wrote on Feb 10, 2006

I'm afraid that I must keep asking about this,

hselect("*.fit","$I"," BIN ?=1", > "bin_lista1")

returns:
ERROR: Image header parameter not found (BIN)
"hselect("*.fit","$I"," BIN ?=2", > "bin_lista2")"
line 126: hedit_casleo_K.cl
called as: `hedit_casleo_K ()'

with a correct list of images but it stops,
BUT:

  hselect("*.fit","$I, BIN ?=1", > "bin_lista1")

returns all the images, not filtering them by bin factor with no "ERROR" output. So it doesn't work
Bin is defined as an integer in my cl script

An extract from the image header looks like:

Biask3.fit[1340,1310][short]:
No bad pixels, min=0., max=0. (old)
Line storage mode, physdim [1340,1310], length of user area 1215 s.u.
Created Sun 18:45:43 05-Apr-2009, Last modified Sun 18:55:26 05-Apr-2009
Pixel file "Biask3.fit" [ok]
EXTEND = F / File may contain extensions
ORIGIN = 'NOAO-IRAF FITS Image Kernel July 2003' / FITS file originator
DATE = '2009-04-05T20:45:43' / Date FITS file was generated
IRAF-TLM= '18:55:26 (05/04/2009)' / Time of last modification
EXPTIME = 0.00 / exposure time - seconds
OBSERVAT= 'CASLEO ' / observatory
DATE-OBS= '2009-04-04 ' / date (yyyy-mm-dd) of obs.
UT = 21:33:26 / universal time
ST = 05:53:08 / sidereal time
HA = +00:00:00 / hour angle
RA = 05:53:08 / right ascension
DEC = -31:47:57 / declination
EPOCH = 2000 / epoch of ra and dec
ZD = 0.0 / zenith distance
AIRMASS = 1.0 / airmass
IMAGETYP= 'zero ' / object, dark, zero, etc.
INSTRUME= 'Direct CCD '
OBSERVER= 'Tancredi '
COMMENT = 'CCD Roper , sin R Focal, rueda de filtros con V y R '
COMMENT = ' '
FILTER01= '(3) V ' / Filter wheel No.1 (Lower)
FILTER02= '(2) Libre ' / Filter wheel No.2 (Upper)
LECTURA = '100khz '
BIN = 1

thank you 'again' in advance
seba

Mike Fitzpatrick wrote on Feb 10, 2006

The '?=' is a string comparison, if BIN is an integer you should be using simply the '=' comparison. Also, your message had a space before the keyword, was that a typo or does something else happen if you don't include the space?

-Mike

bruzzone wrote on Feb 10, 2006

well, I keep trying

     hselect("*.fit","$I,BIN=1", > "bin_lista1")


"spits" every single image


       hselect("*.fit","$I","BIN=1", > "bin_lista1")

"spits" the right ones but with "ERROR".

It space before the keyword was a mistake.

Mike Fitzpatrick wrote on Feb 10, 2006

Does *every* image have a BIN/LECTURA keyword? What I'm thinking is that you're getting the right list because those images have the keywords with the proper value, but you're getting the error message from those image that don't have the keyword at all.

For an image you know should work, run the command on a single image. If the input list is "*.fit" and you get errors then that is a clue and we should look at how '*.fit' expands into a list of files and which of those images is causing the problem.

-Mike

bruzzone wrote on Feb 10, 2006

I'm sorry that it took me some days to wirte back. I've got sick and today I started working again. Yes, there was a problem with the keywords not being present at all imagens. (actually just one of them got the missing keywords, one in 500)
Now it works properly.
Thank you.
sebastian

Last post on Feb 10, 2006