Ignore:
Timestamp:
07/07/06 11:57:27 (18 years ago)
Author:
navarro
Message:

english and nicer header (1)

File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/SRC/Obsolete/extrait.pro

    r132 r133  
    33;------------------------------------------------------------ 
    44;+ 
    5 ; NAME:extrait 
    65; 
    7 ; PURPOSE:extraction de sous domaines de matrices. Meme si le sous 
    8 ; domaine est "troue". cf. : l''exemple 
    9 ; Par defaut IDL peut faire des extractions de sous domaines: 
     6; @fie-comments  
     7; extractoin of subdomains of matrixes; Even if the subdomain is "pierced" (see the example) 
     8; By default, IDL can make extractions of subdomain: 
    109; 
    1110;      IDL> a=indgen(5,5)  
     
    2423;            15      17 
    2524;            20      22 
    26 ; mais  
     25; but 
    2726;      IDL> print, a[[0,2],[3,4]]  
    2827;            15      22 
    29 ; alors que 
     28; while 
    3029;      IDL> print, extrait(a,[0,2],[3,4])   
    3130;            15      17 
    3231;            20      22 
    3332; 
    34 ; CATEGORY:bidouille avec les matrices 
    3533; 
    36 ; CALLING SEQUENCE:res=extrait(tab,indicex[,indicey[,indicez,[indicet]]]) 
     34; you better use extrac2 
    3735; 
    38 ; INPUTS: 
    39 ;        tab: un tableau 1,2,3 ou 4 d 
     36; @obsolete 
    4037; 
    41 ;        indicex: indicex peut avoir deux formes: 
    42 ;              1)un vecteur contenant les indices des lignes a garder 
    43 ;              2)le string '*' dans ce cas touts les lignes sont 
    44 ;              gardees 
     38; @categories utilities 
    4539; 
    46 ;        indicey/z/t: la meme chose que indicex mais pour les 
    47 ;        dimensions 2,3 et 4. 
     40; @param tab {in}{required} a 1,2,3 or 4 dim table 
    4841; 
    49 ;        rq: il faut autant de vecteurs indice que tab a de dimensions 
     42; @param indicex {in}{required} can have 2 forms: 
     43;              1)a vector containing indexes of lines we want to keep 
     44;              2)the string '*' if we want to keep all lines. 
    5045; 
    51 ; KEYWORD PARAMETERS: 
     46; @param indicey {in}{required} the same thing that indicex but for dim 2. 
    5247; 
    53 ; OUTPUTS: 
    54 ;         res: une matice 1,2,3 ou 4d extraite a partir de tab 
     48; @param indicez {in}{required} the same thing that indicex but for dim 3. 
     49;  
     50; @param indicet {in}{required} the same thing that indicex but for dim 4. 
    5551; 
    56 ; COMMON BLOCKS: 
     52; @returns a matrix 1,2,3 or 4d extract from tab 
    5753; 
    58 ; SIDE EFFECTS:res=-1 en cas d''erreur 
     54; @restrictions res=-1 in case of mistake 
    5955; 
    60 ; RESTRICTIONS: 
    61 ; 
    62 ; EXAMPLE: 
    63 ; j''ai une matrice A de dim 2. je veux en extraire une petite matrice 
    64 ; 2d interscetion de la ligne 2,3 et 7 et de la colonne 0 et 1 
     56;  
     57; @examples I have a dim 2 matrix named A. I want extract a small intersection  
     58;          matrix 2d of the line 2,3 and 7 and of the column 0 and 1: 
    6559;       
    6660;      res=extrait(A,[2,3,7],[0,1]) 
    6761; 
    68 ;autre ex: 
     62;other ex: 
    6963;      IDL> print, a  
    7064;      a b c 
     
    7569;      g i 
    7670; 
    77 ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) 
     71; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 
    7872;                       12/1/1999 
    79 ;                       29/4/1999: correction d''un bug et complement 
    80 ;                       de l''en-tete 
     73;                       29/4/1999: correction of a bug and complement of the heading 
     74; 
     75; @version $Id$ 
     76; 
    8177;- 
    8278;------------------------------------------------------------ 
     
    8884  compile_opt idl2, strictarrsubs 
    8985; 
    90    taille = size(tab) 
    91 ;------------------------------------------------------------ 
    92 ; test du nombre de parametres 
    93 ; et de la nature de indice (pour LE cas 'x') 
    94 ;------------------------------------------------------------ 
    95    if n_params() NE taille[0]+1 THEN $ 
    96     return, report('il faut autant d''indices que de dimension du tableau') 
    97    IF n_params() GE 5 THEN BEGIN  
    98       if size(indicet,/type) EQ 7 then indicet = lindgen(taille[4]) $ 
    99       ELSE indicet = long(indicet) 
    100       nt = n_elements(indicet)  
    101    ENDIF  
    102    IF n_params() GE 4 THEN BEGIN  
    103       if size(indicez,/type) EQ 7 then indicez = lindgen(taille[3]) $ 
    104       ELSE indicez = long(indicez) 
    105       nz = n_elements(indicez)  
    106    ENDIF  
    107    IF n_params() GE 3 THEN BEGIN  
    108       if size(indicey,/type) EQ 7 then indicey = lindgen(taille[2]) $ 
    109       ELSE indicey = long(indicey) 
    110       ny = n_elements(indicey)  
    111    ENDIF 
    112    IF n_params() GE 2 THEN BEGIN  
    113       if size(indicex,/type) EQ 7 then indicex = lindgen(taille[1]) $ 
    114       ELSE indicex = long(indicex) 
    115       nx = n_elements(indicex)  
    116    ENDIF 
    117     
    118 ;------------------------------------------------------------ 
    119 ; construction du tableau d''indice et du resultat suivant la taille 
    120 ; de tab 
    121 ;------------------------------------------------------------ 
    122   case taille[0] of 
    123       1:res = tab[indicex] 
    124       2:BEGIN 
    125          indice = indicex#replicate(1, ny)+taille[1]*replicate(1, nx)#indicey 
    126          res = tab[indice] 
    127       END  
    128       3:BEGIN 
    129          indice = indicex#replicate(1, ny)+taille[1]*replicate(1, nx)#indicey 
    130          indice = temporary(indice[*])#replicate(1, nz) $ 
    131           +taille[1]*taille[2]*replicate(1, nx*ny)#indicez 
    132          res = tab[reform(indice, nx, ny, nz, /over)] 
    133       END  
    134       4:BEGIN 
    135          indice = indicex#replicate(1, ny)+taille[1]*replicate(1, nx)#indicey 
    136          indice = temporary(indice[*])#replicate(1, nz) $ 
    137           +taille[1]*taille[2]*replicate(1, nx*ny)#indicez 
    138          indice = temporary(indice[*])#replicate(1, nt) $ 
    139           +taille[1]*taille[2]*taille[3]*replicate(1, nx*ny*nz)#indicet 
    140          res = tab[reform(indice, nx, ny, nz, nz, /over)] 
    141       END  
    142    endcase 
    143  
    144  
    145 ;------------------------------------------------------------ 
    146 ;------------------------------------------------------------ 
    147    return, res 
     86  case n_params() of 
     87      0:return, extrac2() 
     88      1:return, extrac2(tab) 
     89      2:return, extrac2(tab, indicex) 
     90      3:return, extrac2(tab, indicex, indicey) 
     91      4:return, extrac2(tab, indicex, indicey, indicez) 
     92      5:return, extrac2(tab, indicex, indicey, indicez, indicet) 
     93  endcase 
    14894end 
Note: See TracChangeset for help on using the changeset viewer.