;+ ; NAME: MYALIAS ; ; NB : This is CIA's ALIAS procedure modified to allow its use ; outside the CIA environment ; ; !!! SEE BELOW FOR ORIGINAL ALIAS DOCUMENTATION AND CREDITS !!! ; ; 15 Apr 2008 - Adapted from ALIAS (Mattia Vaccari) ; ; PURPOSE: ; provides a lot of useful aliases to quit, delete, ... for a variety of ; operation systems ; CATEGORY: I-4 user ; CALLING SEQUENCE: ; look at the example section for the various functions ; INPUTS: none ; OPTIONAL INPUT PARAMETERS: none ; KEYED INPUTS: none ; OUTPUTS: none ; OPTIONAL OUTPUT PARAMETERS: none ; KEYED OUTPUTS: none ; EXAMPLE: ; quit ; ; logout ; ; bye ; ; delete, filename ; ; ls ; ; h ; ; hs, structure ; ; hh, structure ; ; pstat ; ; pwd ; ; lut, table ; ; luts ; ; display, image ; ; disp, window=window ; ; load, image ; ; frame, cube, i ; ; diso, im ; ; load_cube, cube ; ; clear ; ; xblink, a, b, rate ; ; spec, vector ; ; eval, statement ; ; pause, seconds ; ; abort ; ; top ; ; man, command ; ; info, table ; ; setps ; ; endps ; ; ALGORITHM: straightforward ; DEPENDENCIES: ; none ; COMMON BLOCKS: ; none ; SIDE EFFECTS: none ; RESTRICTIONS: some commands are not supported under Mac OS Classic but ; only under Mac OS X ( identified as !version.os='darwin' ) ; CALLED PROCEDURES AND FUNCTIONS: ; quit ; logout ; bye ; delete ; ls ; h ; hs ; hh ; pstat ; pwd ; lut ; luts ; display ; disp ; load ; frame ; diso ; load_cube ; clear ; xblink ; spec ; eval ; pause ; abort ; top ; man ; info ; setps ; endps ; widget_olh ; SEE ALSO: none ; MODIFICATION HISTORY: ; 13-Sep-1996 SO taken from anonymous unix source --- thanks! ; 28-JUL-1997 SO dealiased blink to avoid clash with generice blink function ; 05-Sep-1997 SO ciainfo as alias for widget_olh ; 25-mar-1998 SO put ciainfo as seperate routine ; ; COPYRIGHT: ; ; This routine belongs to the ISOCAM Interactive Analysis Package CIA. ; ; CIA is a joint development by the ESA Astrophysics Division and the ISOCAM ; Consortium led by the ISOCAM PI, C. Cesarsky, Direction des Sciences de la ; Matiere, C.E.A., France. ; Contributing ISOCAM Consortium institutes are Service d'Astrophysique (SAp, ; Saclay, France) and Institut d'Astrophysique Spatiale (IAS, Orsay, France) ; ; When publishing ISOCAM Data reduced with this analysis package, please ; mention this in the acknowledgement the following way: ; "The ISOCAM data presented in this paper was analysed using "CIA", ; a joint development by the ESA Astrophysics Division and the ISOCAM ; Consortium led by the ISOCAM PI, C. Cesarsky, Direction des Sciences de la ; Matiere, C.E.A., France. " ; ; Its use and distribution to authorised sites are free, as long as this header ; text is not removed, or changed. ; ; No warranties for installation/ support/ maintenance are given. ;- ;;;---------------------------------------------------------------------------- ;;; Get out of IDL by all possible means. ;;;---------------------------------------------------------------------------- ;------------------ QUIT -------------- pro quit ;; An alias for IDL's EXIT command. exit return end pro logout ;; An alias for IDL's EXIT command. exit return end pro bye ;; An alias for IDL's EXIT command. exit return end ; ---------------- delete ------------- pro delete, filename case !version.os of 'vms': cmd = 'delete' 'windows': cmd = 'del' 'MacOS': goto, notsup else: cmd = '\rm -f' endcase cmd = cmd + ' ' + filename spawn, cmd goto, DONE NOTSUP: print, "This operation is not supported under Mac OS Classic' DONE: end ;------------------ LS ---------------- pro ls case !version.os of 'vms': cmd = 'dir' 'windows': cmd = 'dir' 'MacOS': goto, notsup else: cmd = 'ls' endcase if !version.os NE 'vms' then spawn, cmd, /noshell $ else spawn, cmd goto, DONE NOTSUP: print, "This operation is not supported under Mac OS Classic' DONE: end ;--------------- HISTORY---------------- pro h help, /RECALL_COMMANDS end pro hs, x help, /struct, x end pro hh, x help, x end ;-------------- MEMORY------------------ pro pstat help, /MEMORY end ;---------------- PWD ------------------ pro pwd case !version.os of 'vms': cmd = 'show def' 'windows': cmd = 'pwd' 'MacOS': goto, notsup else: cmd = 'pwd' endcase if !version.os NE 'vms' then spawn, cmd, /noshell $ else spawn, cmd goto, DONE NOTSUP: print, "This operation is not supported under Mac OS Classic' DONE: end ;--------------- LUT ----------------- pro lut, i ;; An alias for IDL's LOADCT command. loadct, i return end pro luts ;; Loop through all look-up tables. ;; Actually this is not an alias but a new command. for i = 0, 15 do begin loadct, i wait, 2 endfor return end ;------------- min, max, sgn ----------------- function my_max, a, b ;; Return maximum of two numbers. if (a gt b) then begin return, a endif else begin return, b endelse end function my_min, a, b ;; Return minimum of two numbers. if (a lt b) then begin return, a endif else begin return, b endelse end function sgn, x ;; Returns the sign of an array. result = 0*x pos_supp = where(x gt 0, pos_cnt) if (pos_cnt gt 0) then result(pos_supp) = +1 neg_supp = where(x lt 0, neg_cnt) if (neg_cnt gt 0) then result(neg_supp) = -1 return, result end ;;;---------------------------------------------------------------------------- ;;; Image display. ;;;---------------------------------------------------------------------------- pro display, image ;; An alias for IDL's TVSCL command. tvscl, image return end pro disp, window=window if not keyword_set(window) then w = 0 else w = window window, w, xsize=512, ysize=512 return end function bgdisp, dat n = size(dat) & Nc = n(1) & Nl = n(2) Coefx = 512. / float(Nc) Coefy = 512. / float(Nl) Coef = my_min (Coefx, Coefy) if Coef LT 1. then Coef = my_max (Coefx, Coefy) Nlb = Nl*Coef Ncb = Nc*Coef return, congrid(dat, Ncb, Nlb) end pro load, image tvscl, bgdisp(image) return end pro frame, cube, i a = cube[*,*,i] a = reform(a,/overwrite) tvscl, congrid(a, 256,256) end pro diso, im tvscl, congrid(im, 256,256) end pro load_cube, cube imax = (size(cube))(3) window, 1, xsize=256, ysize=256 for i = 0, imax-1 do begin print, i a = cube[*,*,i] a = reform(a,/overwrite) tvscl, congrid(a, 256,256) ; load, a endfor end pro clear ;; An alias for IDL's erase command. erase return end pro xblink, a, b, rate ;; An alias for IDL User Library's FLICK command. ; flick, a, b, rate flick, a*(255/max(a)), b*(255/max(b)), rate return end pro spec, s plot, s, /YNOZERO end ;;;---------------------------------------------------------------------------- ;;; Evaluator ;;;---------------------------------------------------------------------------- pro eval, statement ;; Evaluates an IDL statement. An alias for IDL's EXECUTE function. e = execute(statement) return end ;; eval, "help" ;;;---------------------------------------------------------------------------- ;;; Miscellaneous. ;;;---------------------------------------------------------------------------- pro pause, seconds ;; An alias for IDL's WAIT command. wait, seconds return end pro abort ;; An alias for IDL's retall retall return end pro top ;; An alias for IDL's RETALL command. retall return end pro man, cmd doc_library, cmd end ;;;---------------------------------------------------------------------------- ;;; Math functions ;;;---------------------------------------------------------------------------- function re, x return, float(x) end function im, x return, imaginary(x) end function mean, array ;; Return the average of a 1D or 2D data array. npix = size(array) return, total(array) / N_ELEMENTS(array) end pro info, Tab print, "Min = ", min(Tab) print, "Max = ", max(Tab) print, "mean = ", mean(Tab) print, "sigma = ", sigma(Tab) end ;============================== function mygauss, idim, jdim, sigma, pos=pos ;----------------- ; parameters check ;----------------- IF N_PARAMS() LT 1 THEN BEGIN PRINT, $ 'CALLING SEQUENCE: GAUSS= GAUSS( idim, jdim, sigma, pos=pos)' GOTO, CLOSING ENDIF if n_elements( pos) eq 0 then begin pos= make_array( 2, /float) pos(0)= FLOAT(IDIM)/2.0 pos(1)= FLOAT(JDIM)/2.0 endif if n_elements( pos) eq 1 then begin print, 'Give 2 numbers for POS' goto, closing endif GAUSS= EXP(-(( FINDGEN( IDIM)#REPLICATE( 1.0, IDIM)- POS(0))^2+$ (REPLICATE( 1.0, JDIM)#FINDGEN( JDIM)- POS(1))^2)/(2.*SIGMA^2)) return, gauss closing: end ;============================== pro setps set_plot, 'PS' device, filename='idl.ps', /landscape end pro endps device, /close set_plot, 'X' end function xy, i, array ;; Transforms a 1D-index int array into its 2D-equivalent n = size(array) result = intarr(2) result(0) = my_mod(i, n(1)) result(1) = (i - result(0))/n(1) return, result end function xyz, i, array ;; Transforms a 1D-index int array into its 3D-equivalent n = size(array) result = intarr(2) result(0) = my_mod(i, n(1)) result(1) = (i - result(0))/n(1) return, result end ;==============================