Duncan |
05/19/2010 09:14PM (Read 12722 times)
|
|
|
Status: offline
Registered: 05/15/2010
Posts: 13
|
I have been trying to make lists of object images, bias images, and skyflat images so I can run batches. I have been having issues making lists quickly using the header information. Is there a way to sort and/or create a list from information from the image header for example object.list, bias.list, and sky.list from the OBSTYPE field
in the extended header? Thanks,
Duncan
|
|
|
|
fitz |
05/19/2010 09:14PM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
See the CCDLIST task.Otherwise, try something like[code:1:d4e720927c]
cl> hselect *.fits OBSTYPE "OBSTYPE?='object'" > obj.list
[/code:1:d4e720927c]where the '?=' operator is used for string comparison.
|
|
|
|
Duncan |
05/19/2010 09:14PM
|
|
|
Status: offline
Registered: 05/15/2010
Posts: 13
|
Thanks fits. I had tried the CCDLIST task first but it seems to use the short header, and CCDTYPE not OBSTYPE which is where the data is stored in my extended header (nothing is stored in the CCDTYPE short header slot [and doesn't exist for the extended]) if you know how to correct for that it would solve all my problems.I am new to both Linux and IRAF so pardon the potentially sill question but what does this mean?[quote:27dd4372f3]Otherwise, try something like [code:1:27dd4372f3]cl> hselect *.fits OBSTYPE "OBSTYPE?='object'" > obj.list[/code:1:27dd4372f3] where the '?=' operator is used for string comparison.[/quote:27dd4372f3]Thanks,
Duncan
|
|
|
|
AnTaR3s |
05/19/2010 09:14PM
|
|
|
Status: offline
Registered: 10/24/2009
Posts: 58
|
Here is the way you get ccdlist to work:ccdlist requires the Header-keyword IMAGETYP to contain a certain string "" - (the null string) all image types
object - object images
zero - zero level images such as a bias or preflash
dark - dark count images
flat - flat field images
illum - illumination images
fringe - fringe correction images
other - other image types defined in the translation file
none - images without an image type parameter
unknown - image types not defined in the translation file
So a Biasframe for example has to contain the keyword "zero"
To edit the Header, use the task "hedit" in a way similar to this:images = foo* images to be edited
fields = IMAGETYP fields to be edited
value = object value expression
(add = yes) add rather than edit fields
(addonly= yes) add only if field does not exist
(delete = yes) delete rather than edit fields
(verify = no) verify each edit operation
(show = yes) print record of each edit operation
(update = yes) enable updating of the image header
(mode = ql)this will write the string object into the Keyword header information IMAGETYP.now you can list the images with ccdlist like this:images = *.fits CCD images to listed
(ccdtype= object) CCD image type to be listed
(names = yes) List image names only?
(long = yes) Long format listing?
(ccdproc= ) CCD processing parameters
(mode = ql)There you go! cheers
|
|
|
|
Duncan |
05/19/2010 09:14PM
|
|
|
Status: offline
Registered: 05/15/2010
Posts: 13
|
I tried what you suggested AnTaR3s, and was able to add IMAGETYP to the header and to be able to sort it and add the different types of image types I have (bias, flat, and object) I thought I would try what fits suggested:[code:1:03622d8b38]
cl> hselect *.fits OBSTYPE "OBSTYPE?='object'" > obj.list [/code:1:03622d8b38]and it worked I got list with each type of image in it for said list except I got a list with the image type (551 lines with the word object for example) rather than a list of file names.How do I correct that because once I have each image type sorted into lists i can add IMAGETYP and then run ccdproc, which will be much easier than going through 700 images by hand.is there a way to work the files command and hselect command together?
|
|
|
|
fitz |
05/19/2010 09:14PM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
Try[code:1:4916f442fc]cl> hselect *.fits $I "OBSTYPE?='object'" > obj.list[/code:1:4916f442fc]where the '$I' is a builtin operator to print the filename.
|
|
|
|
Duncan |
05/19/2010 09:14PM
|
|
|
Status: offline
Registered: 05/15/2010
Posts: 13
|
Thanks guys it worked flawlessly! Duncan
|
|
|
|
Duncan |
05/19/2010 09:14PM
|
|
|
Status: offline
Registered: 05/15/2010
Posts: 13
|
I ran into a similar problem again, but trying a different line is there something I am not doing right?Here is one of the many headers again:
[code:1:941834f72c]flat0001.fits[1015,2341][real]: Flat
No bad pixels, min=0., max=0. (old)
Line storage mode, physdim [1015,2341], length of user area 2673 s.u.
Created Sun 23:43:25 23-May-2010, Last modified Sun 23:43:23 23-May-2010
Pixel file "flat0001.fits" [ok]
EXTEND = F / File may contain extensions
ORIGIN = 'NOAO-IRAF FITS Image Kernel July 2003' / FITS file originator
DATE = '2010-05-24T06:43:25' / Date FITS file was generated
IRAF-TLM= '2010-05-24T06:43:23' / Time of last modification
OBJECT = 'Flat ' / Name of the object observed
EXPTIME = 15 /
INSTRUME= 'E2V-1' / detector name
XBIN = 2 /
YBIN = 2 /
PIXSIZE = 13.5 / pixel size, microns
CTYPE1 = 'PIXEL ' /15 / axis1 in pixels
CTYPE2 = 'PIXEL ' /15 / axis2 in pixels
CCDTEM = -104.4 /
DATE-OBS= '2010-02-20T14:38:00'/
OBSTYPE = 'flat ' / OBSERVATION TYPE
OBSERVER= 'Nemec '
TELESCOP= '1.8-m' / This telescope
OBSERVAT= 'DAO' / Location
WIND_SPD= 1.7 / Wind speed, m/s
MAX_WND = 5.1 / Max wind speed 10 last min, m/s
WIND_DIR= 67.7 / Wind direction, degrees
WIND_CHL= 2.8 / Wind chill, deg C
OUT_TEMP= 4.1 / Outside temperature, deg C
REL_HUMI= 68.8 / Outside relative humidity, percent
DEWPOINT= -1.0 / Outside dew point, deg C
RA = '13:19:57.60' / AT START OF EXPOSURE
DEC = '17:38:02.00' / AT START OF EXPOSURE
HA = '+03:06:07.3' / AT START OF EXPOSURE
SIDEREAL= '16:26:05.0' / AT START OF EXPOSURE
EQUINOX = 2010.1 / AT START OF EXPOSURE
AIRMASS = 1.51 / AT START OF EXPOSURE
DOMEAZ = 234.60 / AT START OF EXPOSURE
FOCUS = 8720 / Newtonian focus
FILPOS = 3 / Newt. raw filter pos
FILNAME = "V" / Newt. raw filter pos
EXPNUM = 'dao_c182_2010_002145'
RELEASE = '2011-02-20T14:38:53'/
IMAGETYP= 'flat '
WCSDIM = 2
CRPIX1 = -5.
CRPIX2 = -4.
CDELT1 = 1.
CDELT2 = 1.
CD1_1 = 1.
CD2_2 = 1.
LTV1 = -5.
LTV2 = -4.
LTM1_1 = 1.
LTM2_2 = 1.
WAT0_001= 'system=image'
WAT1_001= 'label=pixel'
WAT2_001= 'label=pixel'[/code:1:941834f72c]I am trying to get the different filters seperated so I can batch imcombine the flats with there respective filters. I thought if I used the same code but altered it would work so what I used was (with error):[code:1:941834f72c]ecl> hselect flat*.fits $I "FILNAME?='V'" > vflat.list
ERROR: Impossible type conversion when accessing image header parameter (FILNAME)[/code:1:941834f72c]and[code:1:941834f72c]ecl> hselect flat*.fits $I "FILPOS?='3'" > vflat.list
ERROR: operands have incompatible types[/code:1:941834f72c]I also tried it with "V" and "'V'" but I got a syntax error (as expected) for both of those. Is there something I'm missing for that string or should I have used a different code intirely?Thanks again
Duncan
|
|
|
|
fitz |
05/19/2010 09:14PM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
The keyword is not a valid FITS string, i.e. it needs to be a single quoted value starting in column 12 and not terminating before column 20 (see http://archive.stsci.edu/fits/fits_standard/node31.html#SECTION00921000000000000000) Once you change this then the expression should work.As for FILTPOS, it is not a string value at all and so the '==' operation (rather than the '?=' string comparison) is more appropriate.
|
|
|
|
Duncan |
05/19/2010 09:14PM
|
|
|
Status: offline
Registered: 05/15/2010
Posts: 13
|
Thanks fitz. I thought that might have been the issue, but I'm not sure if there is a way to fix that issue with the double quotes to single quotes. I didn't know that there was a difference between operation between string comparisons.Thanks again fitz I'll try the operation comparison, but is there anyway to fix the double quotes and keep the text between them?DuncanI just tried the operation comparison and it worked as expected - so thanks again fitz.
|
|
|
|
fitz |
05/19/2010 09:14PM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
Because the value is corrupted there doesn't appear to be a one-line command to replace it with HEDIT. The HFIX task can be used to run an arbitrary command on the header so if you're proficient in sed/awk/perl you could write a command to fix it and then use HFIX on each of the images.Otherwise, you'll need to dump the header values, delete the keyword and replace the value, something like:[code:1:8c8f44732d]
hselect *.fits $I,FILNAME yes > "fil.txt" # dump filename and value
list = "fil.txt"
while (fscan (list, s1, s2) != EOF) {
hedit (s1, "FILNAME", del+, ver-) # delete the keyword
hedit (s1, "FILNAME", s2, add+, ver-) # add back the value
}
[/code:1:8c8f44732d]Try this by hand first to make sure it works.
|
|
|
|
Duncan |
05/19/2010 09:14PM
|
|
|
Status: offline
Registered: 05/15/2010
Posts: 13
|
Out of interest is it possible to use the hselect command to name your files from the OBJECT string, so if you were taking images of several different objects throughout the night you would easily be able to separate, and recognize them by name after all your bias reductions and image flattening have been completed?
|
|
|
|
fitz |
05/19/2010 09:14PM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
HSELECT doesn't rename files, however, you can the something like[code]cl> hselect *.fits $I,OBJECT yes [code]to generate a list of the original filename and object name you could use as a basis to rename all the files.
|
|
|
|
StarryEyed |
05/19/2010 09:14PM
|
|
|
Status: offline
Registered: 03/24/2011
Posts: 6
|
[quote:b9b96a4b2f="fitz"]HSELECT doesn't rename files, however, you can the something like[code]cl> hselect *.fits $I,OBJECT yes [code]to generate a list of the original filename and object name you could use as a basis to rename all the files.[/quote:b9b96a4b2f]Fitz,I asked a similar question earlier, and this is my last post on the forum for the day, but my programming skills are weak so I keep on coming up with these questions that seem immature to me. With that final command, are we just opening up the script so we can name each object by hand or are we giving a command to run a complete sweep? I'm having a difficult time understanding some of this. My small business system that i am working on provides business continuity planning software, so everything is running fine, I just need a bit of instruction.
**Telescopic Baby**
|
|
|
|
fitz |
05/19/2010 09:14PM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
This command simply produces a list of image and OBJECT keyword values, one per line. The idea is then that you could write a script to read this list an rename the file to something based on the object name. For this to work reliably you'd need to handle cases where there is a space in the object name, avoid multiple files with the same name, etc. This script code you would need to write yourself, it isn't part of the HSELECT command or any other task.
|
|
|
|