Changeset 133 for trunk/SRC/Obsolete
- Timestamp:
- 07/07/06 11:57:27 (18 years ago)
- Location:
- trunk/SRC/Obsolete
- Files:
-
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Obsolete/extrait.pro
r132 r133 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:extrait6 5 ; 7 ; PURPOSE:extraction de sous domaines de matrices. Meme si le sous8 ; domaine est "troue". cf. : l''exemple9 ; 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: 10 9 ; 11 10 ; IDL> a=indgen(5,5) … … 24 23 ; 15 17 25 24 ; 20 22 26 ; mais25 ; but 27 26 ; IDL> print, a[[0,2],[3,4]] 28 27 ; 15 22 29 ; alors que28 ; while 30 29 ; IDL> print, extrait(a,[0,2],[3,4]) 31 30 ; 15 17 32 31 ; 20 22 33 32 ; 34 ; CATEGORY:bidouille avec les matrices35 33 ; 36 ; CALLING SEQUENCE:res=extrait(tab,indicex[,indicey[,indicez,[indicet]]])34 ; you better use extrac2 37 35 ; 38 ; INPUTS: 39 ; tab: un tableau 1,2,3 ou 4 d 36 ; @obsolete 40 37 ; 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 45 39 ; 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 48 41 ; 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. 50 45 ; 51 ; KEYWORD PARAMETERS:46 ; @param indicey {in}{required} the same thing that indicex but for dim 2. 52 47 ; 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. 55 51 ; 56 ; COMMON BLOCKS:52 ; @returns a matrix 1,2,3 or 4d extract from tab 57 53 ; 58 ; SIDE EFFECTS:res=-1 en cas d''erreur54 ; @restrictions res=-1 in case of mistake 59 55 ; 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: 65 59 ; 66 60 ; res=extrait(A,[2,3,7],[0,1]) 67 61 ; 68 ; autreex:62 ;other ex: 69 63 ; IDL> print, a 70 64 ; a b c … … 75 69 ; g i 76 70 ; 77 ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)71 ; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 78 72 ; 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 ; 81 77 ;- 82 78 ;------------------------------------------------------------ … … 88 84 compile_opt idl2, strictarrsubs 89 85 ; 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 148 94 end -
trunk/SRC/Obsolete/zeroun.pro
r132 r133 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:zeroun 5 ; @file_comments 6 ; Send back a vector or a matrix constituate of 0 and 1 in alternation 6 7 ; 7 ; PURPOSE:renvoie un vecteur ou une matrice constitue de o et de 1 en 8 ; alternance 8 ; you better use zero_one 9 9 ; 10 ; CATEGORY:function, matrices10 ; @obsolete 11 11 ; 12 ; CALLING SEQUENCE:resultat=zeroun(n1 [,n2])12 ; @categories function, matrixes 13 13 ; 14 ; INPUTS: 15 ; n1=nombre d'elements dans la premiere dimension 16 ; n2=nombre d'elements dans la deuxieme dimension 14 ; @param n1 {in}{required} number of elements in the first dimension 15 ; @param n2 {in}{required} numbre of elements in the second dimension 17 16 ; 18 ; KEYWORD PARAMETERS: 17 ; @returns resultat 18 ; 19 ; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 20 ; 1/12/98 19 21 ; 20 ; OUTPUTS:resultat22 ; @version $Id$ 21 23 ; 22 ; COMMON BLOCKS:23 ;24 ; SIDE EFFECTS:25 ;26 ; RESTRICTIONS:27 ;28 ; EXAMPLE:29 ;30 ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr)31 ; 1/12/9832 24 ;- 33 25 ;------------------------------------------------------------ … … 38 30 compile_opt idl2, strictarrsubs 39 31 ; 40 CASE N_PARAMS() OF 41 1:return, findgen(n1) mod 2 42 2:BEGIN 43 if fix(n1/2) EQ n1/2. then BEGIN ;nombre pair de colonnes 44 res = findgen(n1+1,n2) mod 2 45 return, res[0:n1-1, *] 46 ENDIF ELSE return, findgen(n1,n2) mod 2 ;nombre impair de colonnes 47 END 48 else: return, report('Mauvais nombre de parametre dans l''appel de ZEROUN') 49 endcase 32 case n_params() of 33 0:return, zero_one() 34 1:return, zero_one(n1) 35 2:return, zero_one(n1, n2) 36 endcase 37 50 38 end
Note: See TracChangeset
for help on using the changeset viewer.