PRO cafe_data_fitsimg, env, filename, group, subgroup, $ extension, $ help=help, shorthelp=shorthelp ;+ ; NAME: ; data_fitsimg ; ; PURPOSE: ; Read in data set from fits file (image extension) ; ; CATEGORY: ; cafe ; ; SUBCATEGORY: ; data ; ; DATA FORMAT: ; Read the file as an fits file containing the ; data in images. Because images in general are ; multi-dimensional the data set also will contain more than ; one dimension. ; ; Images do not contain x value info. The x values are set ; at the increasing integers starting from 1. ; No error columns are defined. ; ; ; PARAMETER: ; ; (optional) The extension number. If not given the ; extension number 1 is used (first extension). ; ; All parameters are separated with ",". If one ; parameter is not defined (empty string) the default ; column is used. ; ; SIDE EFFECTS: ; Loads file data into environment. ; ; EXAMPLE: ; ; > data, psf.fits[2]:3, fitsimg ; -> loads in image from fits file psf.fits to first ; subgroup in group 3 ; HISTORY: ; $Id: cafe_data_fitsimg.pro,v 1.4 2005/02/16 11:04:09 goehler Exp $ ; ;- ; ; $Log: cafe_data_fitsimg.pro,v $ ; Revision 1.4 2005/02/16 11:04:09 goehler ; new scheme of parameter passing onto data subtask by using cafequotestr ; ; Revision 1.3 2005/01/04 10:56:05 goehler ; fix: make shure all (internal) routines are properly documented ; ; Revision 1.2 2003/12/01 07:53:00 goehler ; change: data sets contain "title" to store information in. ; files remain unmodified when applying modify,file=foo command. ; ; Revision 1.1 2003/10/08 23:34:26 goehler ; read fits images ; ; ; ;; command name of this source (needed for automatic help) name="data_fitsimg" ;; ------------------------------------------------------------ ;; HELP ;; ------------------------------------------------------------ ;; if help given -> print the specification above (from this file) IF keyword_set(help) THEN BEGIN cafe_help,env, name return ENDIF ;; ------------------------------------------------------------ ;; SHORT HELP ;; ------------------------------------------------------------ IF keyword_set(shorthelp) THEN BEGIN print, "fitsimg - fits image data type" return ENDIF ;; ------------------------------------------------------------ ;; READ DATA ;; ------------------------------------------------------------ y = double(readfits(filename,exten_no=extension)) ;; x -> list of indizes: x = dindgen(n_elements(y),size(y,/n_dimensions)) ;; total index: index = lindgen(n_elements(y)) dimensions = size(y,/dimensions) FOR i = 0, n_elements(dimensions)-1 DO BEGIN x[*,i] = index MOD dimensions[i] + 1 index = temporary(index) / dimensions[i] ENDFOR ;; create list: y = reform(y,n_elements(y),/overwrite) (*env).groups[group].data[subgroup].x = PTR_NEW(x) (*env).groups[group].data[subgroup].y = PTR_NEW(y) ;; allocate defined measure point array (default all defined): (*env).groups[group].data[subgroup].def = PTR_NEW(bytarr(n_elements(y),/nozero)) (*(*env).groups[group].data[subgroup].def)[*]=1 ;; allocate selected point array (none selected): (*env).groups[group].data[subgroup].selected = $ PTR_NEW(bytarr(n_elements(x),/nozero)) (*(*env).groups[group].data[subgroup].selected)[*]=0 (*env).groups[group].data[subgroup].file = filename (*env).groups[group].data[subgroup].title = filename ;; ------------------------------------------------------------ ;; STATUS REPORT ;; ------------------------------------------------------------ cafereport,env," File: "+filename cafereport,env," Group: "+strtrim(string(group),2) cafereport,env," Subgroup: "+strtrim(string(subgroup),2) cafereport,env," Datapoints: " +strtrim(string(n_elements(y)),2) RETURN END