Commit cf4b9c0a2a9ac64e3fbbb705bb038adf4454bbeb
1 parent
daef5684
Exists in
master
removed redundant files from idl_misc
Showing
1 changed file
with
0 additions
and
121 deletions
Show diff stats
src/idl_misc/integral.pro deleted
... | ... | @@ -1,121 +0,0 @@ |
1 | -function integral,tab_1,tab_2,v1,v2,silent=silent,double=double | |
2 | - | |
3 | -;+ | |
4 | -; NAME: | |
5 | -; integral | |
6 | -; CALLING SEQUENCE: | |
7 | -; res=integral(tab_1,tab_2,v1,v2) | |
8 | -; PURPOSE: | |
9 | -; integrate into tab3(tab2) from v1 to v2 | |
10 | -; INPUTS: | |
11 | -; tab_1 = array (1D) of x values | |
12 | -; tab_2 = array (1D) of y values | |
13 | -; v1 = inf value of the integral | |
14 | -; v2 = sup value of the integral | |
15 | -; OPTIONAL INPUT: | |
16 | -; silent = if set routine behaves silently | |
17 | -; OUTPUTS: | |
18 | -; result of the integral | |
19 | -; PROCEDURE AND SUBROUTINE USED | |
20 | -; SIDE EFFECTS: | |
21 | -; None | |
22 | -; MODIFICATION HISTORY: | |
23 | -; written JPB 09-08-92 | |
24 | -; modified July 22nd 1994 to handle intervals < point separations | |
25 | -; modified DJM June 10th 2010 to perform calculation in double | |
26 | -;- | |
27 | - | |
28 | -IF N_PARAMS(0) EQ 0 THEN begin | |
29 | - print,'Calling Sequence: res=integral(x,y,x1,x2)' | |
30 | - print,'Accepted Key-words: /silent' | |
31 | - goto,sortie | |
32 | -endif | |
33 | - | |
34 | -IF keyword_set(double) then half=0.5D else half=0.5 | |
35 | -;the aim is to integrate into tab3(tab2) from v1 to v2 | |
36 | -;integral in perform linearily | |
37 | - | |
38 | -if keyword_set(double) then begin | |
39 | - tab1=double(tab_1) | |
40 | - tab2=double(tab_2) | |
41 | -endif else begin | |
42 | - tab1=tab_1 | |
43 | - tab2=tab_2 | |
44 | -endelse | |
45 | -si1=size(tab1) | |
46 | -si1=si1(3) | |
47 | -si2=size(tab2) | |
48 | -si2=si2(3) | |
49 | -if si1 ne si2 then begin | |
50 | - print,'pb with array dimensions' | |
51 | - goto,sortie | |
52 | -endif | |
53 | -mi=min(tab1) | |
54 | -ma=max(tab1) | |
55 | -IF keyword_set(double) then coef=1.D else coef=1. | |
56 | -IF tab_1(0) GT tab_1(1) THEN BEGIN | |
57 | - IF n_elements(silent) EQ 0 THEN BEGIN | |
58 | - print,'Array in decreasing order was reordered' | |
59 | - ENDIF | |
60 | - for i=0,si1-1 do tab1(i)=tab_1(si1-i-1) | |
61 | - for i=0,si1-1 do tab2(i)=tab_2(si1-i-1) | |
62 | -ENDIF | |
63 | -if v1 lt mi or v1 gt ma then begin | |
64 | - IF n_elements(silent) EQ 0 THEN BEGIN | |
65 | - message,'first value out of range' | |
66 | - ENDIF | |
67 | - goto,sortie | |
68 | -endif | |
69 | -if v2 lt mi or v2 gt ma then begin | |
70 | - message,'second value out of range' | |
71 | - goto,sortie | |
72 | -endif | |
73 | -if v1 gt v2 then begin | |
74 | - a=v2 | |
75 | - v_2=v1 | |
76 | - v_1=a | |
77 | -IF keyword_set(double) then coef=-1.D else coef=-1. | |
78 | -endif | |
79 | -if v1 le v2 then begin | |
80 | - v_2=v2 | |
81 | - v_1=v1 | |
82 | - IF keyword_set(double) then coef=1.D else coef=1. | |
83 | -endif | |
84 | -ind=where(tab1 lt v_2 and tab1 ge v_1,count) | |
85 | -IF count NE 0 THEN BEGIN | |
86 | - a1=tab2(ind) | |
87 | - IF keyword_set(double) then a1(*)=0.D else a1(*)=0. | |
88 | - a1=(tab1(ind+1)-tab1(ind))*(tab2(ind)+half*(tab2(ind+1)-tab2(ind))) | |
89 | - sia1=size(a1) | |
90 | - sia1=sia1(3) | |
91 | - I3=total(a1)-a1(sia1-1) | |
92 | - mi_tab1=min(tab1(ind)) | |
93 | - ma_tab1=max(tab1(ind)) | |
94 | - mi_tab2=tab2(where(tab1 eq mi_tab1)) | |
95 | - ma_tab2=tab2(where(tab1 eq ma_tab1)) | |
96 | - IF keyword_set(double) then truc = dblarr(1) else truc=fltarr(1) | |
97 | - truc(0)=v_1 | |
98 | - tab2_v1=INTERPOL(TAB2,TAB1,V_1) | |
99 | - truc(0)=v_2 | |
100 | - tab2_v2=interpol(tab2,tab1,v_2) | |
101 | - I1=(mi_tab1-v_1)*(tab2_v1+half*(mi_tab2-tab2_v1)) | |
102 | - I2=(v_2-ma_tab1)*(ma_tab2+half*(tab2_v2-ma_tab2)) | |
103 | - Integ=I1+I2+I3 | |
104 | -; stop | |
105 | -ENDIF ELSE BEGIN | |
106 | - ind=where(tab_1 LT v_1) & vv_1=max(tab_1(ind)) | |
107 | -; ind=where(tab_1 gT v_2) & vv_2=min(tab_1(ind)) | |
108 | - ind=where(tab_1 GE v_2) & vv_2=min(tab_1(ind)) | |
109 | - yy_1=tab_2(where(tab_1 EQ vv_1)) & yy_2=tab_2(where(tab_1 EQ vv_2)) | |
110 | - a=(yy_2-yy_1)/(vv_2-vv_1) & b=yy_1-a*vv_1 | |
111 | - Integ=half*a*(v_2^2-v_1^2)+b*(v_2-v_1) | |
112 | -ENDELSE | |
113 | - | |
114 | - | |
115 | - | |
116 | -return,integ | |
117 | -sortie: | |
118 | - | |
119 | - | |
120 | -end | |
121 | - |