+
    0i)                         ^ RI t^ RIHtHt ^ RIt^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHtHtHtHt ]P"                  ! RR7      R	 4       tR
 t ! R R4      tR# )    N)assert_allcloseassert_array_less)stats)sobol_indices)BootstrapResult)BootstrapSobolResult
f_ishigami	sample_AB
sample_A_Bsession)scopec                    Rp RpRV ^,          ^,          ,           V\         P                  ^,          ,          ^,          ,           V^,          \         P                  ^,          ,          ^,          ,           pRV\         P                  ^,          ,          ^,          ,           V^,          \         P                  ^,          ,          ^2,          ,           pV ^,          ^,          p^ p^ pV^,          \         P                  ^,          ,          ^,          ^,          p^ p\         P                  ! W4V.4      V,          p	\         P                  ! RRV.VRV.WxR..4      V,          p
WP                  ^R7      ,           pW3# )zWReference values for Ishigami from Saltelli2007.

Chapter 4, exercise 5 pages 179-182.
g      @g?      ?g        axis)nppiarraysum)abvarv1v2v3v12v13v23s_firsts_seconds_totals               i/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/stats/tests/test_sensitivity_analysis.pyishigami_ref_indicesr#      s'    	AA
1Q,255!8A
%1RUUAXb(8
8C	qz!|	ad255!8mB.	.B	
AaB	
B
C
Q$ruuax-/#
C
Chh|$S(Gxx	R	b#	2  	H
 !,,G    c                    \        V 4      pW3# )zOutput of shape (2, n).r	   xress   & r"   f_ishigami_vecr*   *   s    
Q-C8Or$   c                      a  ] tR t^0t o ]P
                  ! ]P                  ) ^]P                  ,          R7      .^,          tR t	]
P                  P                  ]
P                  P                  R4      ]
P                  P                  R]]
P                   ! ]]
P                  P$                  R7      .RR.R7      R	 4       4       4       tR
 tR tR tR t]
P                  P                  R4      R 4       tR tRtV tR# )TestSobolIndiceslocscalec                    \         P                  ! . RO. RO. RO.4      pV^d,           p\         P                  ! . RO. RO. RO.. RO. RO. RO.. RO. RO. RO..4      p\        WR7      p\        WC4       R# )	   ABN)r1         
   )            )      	      )e   h   k   n   )f   i   l   o   )g   j   m   p   )r   r   r
   r   )selfr3   r4   refABs   &    r"   test_sample_ABTestSobolIndices.test_sample_AB6   s~    HH

 Ghh" " "$%

   r$   z!Can't create large array for testfunc)marksscalarvector)idsc                f   \         P                  P                  R 4      p\        VRV P                  VR7      pVP
                  R8X  d%   V^ ,          V^ ,          .V^,          V^,          ..p\        VP                  V^ ,          RR7       \        VP                  V^,          RR7       VP                  e   Q hVP                  ^cR7      p\        V\        4      '       g   Q h\        VP                  \        4      '       g   Q hVP                  P                  P                  P                   ^ ,          ^8X  g   Q hVP                  P                  P                  ^,          P                   VP                  P                   8X  g   Q hVP                  P                  P                  P                   VP                  P                   8X  g   Q hVP                  P                  P                  P                   VP                  P                   8X  g   Q h\#        VP                  P                  P                  VP                  4       \#        VP                  VP                  P                  P$                  4       \#        VP                  P                  P                  VP                  4       \#        VP                  VP                  P                  P$                  4       \        VP                  R^cR	7      \        4      '       g   Q h\        VP                  \        4      '       g   Q hR# )
	   ;m~|W2LE    rQ   ndistsrngr*   {Gz?atolN)n_resamplesg?)confidence_levelr`   )r   randomdefault_rngr   r[   __name__r   first_ordertotal_order_bootstrap_result	bootstrap
isinstancer   r   confidence_intervallowshaper   high)rL   r#   rQ   r\   r)   bootstrap_ress   &&&   r"   test_ishigamiTestSobolIndices.test_ishigamiM   s    ii##$JK**
 ==,,)!,.B1.EF)!,.B1.EF$ 
 	)=a)@tL)=a)@tL$$,,,"5-)=>>>>#//AAAA$$88<<BB1EJJJ$$88<<Q?EE//''( 	( ( ((<<@@FF//''( 	( (((<<@@FF//''( 	( ( 	%%99==s	
 	OO]66JJOO	
 	%%99==s	
 	OO]66JJOO	

 MM3BM? 
 
 	
 
 #//AAAAr$   c                @   \         P                  P                  R 4      pRp\        P                  ! \         P
                  ) ^\         P
                  ,          R7      \        P                  ! \         P
                  ) ^\         P
                  ,          R7      \        P                  ! \         P
                  ) ^\         P
                  ,          R7      .p\        W4VR7      w  rV\        WVR7      pR\        V4      P                  ^R4      R\        V4      P                  ^R4      R\        V4      P                  R4      /p\        WVVR7      p	\        V	P                  V^ ,          R	R
7       \        WVR7      p	\        V	P                  V^ ,          R	R
7       \        \        V4      P                  ^R4      VR,          4       \        \        V4      P                  ^R4      VR,          4       \        \        V4      P                  R4      VR,          4       R# )rW   rX   r-   )rZ   r[   r\   r2   f_Af_Bf_ABrY   r]   r^   )rQ   rZ   r\   N)r<   r1   ru   )r   rb   rc   r   uniformr   r   r
   r	   reshaper   r   re   )
rL   r#   r\   rZ   r[   r3   r4   rN   rQ   r)   s
   &&        r"   test_func_dictTestSobolIndices.test_func_dict   s   ii##$JKMMruufAbeeG4MMruufAbeeG4MMruufAbeeG4
 A4  :a=((B/:a=((B/JrN**:6
 

 	)=a)@tL
 	)=a)@tL 	
1--a4d5kB
1--a4d5kB
2..z:DLIr$   c                R  a R  o\         P                  P                  R4      p\        \        RV P
                  SVR7      p\        VP                  V^ ,          RR7       \        VP                  V^,          RR7       R V3R llp\        \        ^V P
                  VVR7      pR# )	c                0   \         P                  ! W.RR7      pVR\         P                  ! W,
          ^,          RR7      ,          ,
          V,          p\         P                  ! W V,
          ,          RR7      V,          pVP                  VP                  3# )zUJansen for S and Sobol' for St.

From Saltelli2010, table 2 formulations (c) and (e).r   r   ru   )r   ru   )r   r   meanT)rr   rs   rt   r   ssts   &&&   r"   jansen_sobol2TestSobolIndices.test_method.<locals>.jansen_sobol   si     &&#'2Cs277CJ?<<<CADj)3c9B339r$   rW   rX   )rQ   rZ   r[   methodr\   r]   r^   c          
          V ^8  d   QhR\         P                  R\         P                  R\         P                  R\        \         P                  \         P                  3,          /# )r8   rr   rs   rt   return)r   ndarraytuple)formats   "r"   __annotate__2TestSobolIndices.test_method.<locals>.__annotate__   sJ     	0 	0	0"$**	046JJ	02::rzz)*	0r$   c                    < S! WV4      # N )rr   rs   rt   r   s   &&&r"   jansen_sobol_typed8TestSobolIndices.test_method.<locals>.jansen_sobol_typed   s      $//r$   N	r   rb   rc   r   r	   r[   r   re   rf   )rL   r#   r\   r)   r   _r   s   &&    @r"   test_methodTestSobolIndices.test_method   s    		 ii##$JKt**	
 	)=a)@tL)=a)@tL	0 	0
 q**%	
r$   c                    \         P                  P                  R 4      p\        R RV P                  VR7      p\        VP                  V^ ,          RR7       \        VP                  V^,          RR7       R# )rW   c                 &    \        V 4      R ,           # )i  r&   r(   s   &r"   <lambda>5TestSobolIndices.test_normalization.<locals>.<lambda>   s    :a=4/r$   rX   rY   r]   r^   Nr   rb   rc   r   r[   r   re   rf   rL   r#   r\   r)   s   &&  r"   test_normalization#TestSobolIndices.test_normalization   s^    ii##$JK/4**
 	)=a)@tL)=a)@tLr$   c                L   R  p\         P                  P                  R4      p\        VRV P                  VR7      pV^ ,          . ROV^ ,          .V^,          . ROV^,          ..p\        VP                  V^ ,          RR7       \        VP                  V^,          RR7       R# )c                <    \        V 4      pW^ ,          ^
,           V3# )zOutput of shape (3, n).r&   r'   s   & r"   f_ishigami_vec_constETestSobolIndices.test_constant_function.<locals>.f_ishigami_vec_const   s    Q-Ca"c))r$   rW   rX   rY   r]   r^   N)r   r   r   r   )rL   r#   r   r\   r)   ishigami_vec_indicess   &&    r"   test_constant_function'TestSobolIndices.test_constant_function   s    	*
 ii##$JK%**
 &a()5I!5LM%a()5I!5LM 

 	)=a)@tL)=a)@tLr$   c                    \         P                  P                  R 4      p\        \        RV P
                  VR7      p\        VP                  V^ ,          RR7       \        VP                  V^,          RR7       R# )rW   rY   g-C6?r^   Ni   r   r   s   &&  r"   test_more_converged$TestSobolIndices.test_more_converged   s^    ii##$JKu**
 	)=a)@tL)=a)@tLr$   c                    R p\         P                  ! \        VR7      ;_uu_ 4        \        ^ \        RR7       RRR4       \         P                  ! \        VR7      ;_uu_ 4        \        ^ \        R .R7       RRR4       Rp\         P                  ! \        VR7      ;_uu_ 4        \        ^\        \
        P                  ! 4       .R7       RRR4       \         P                  ! \        VR7      ;_uu_ 4        \        R\        \
        P                  ! 4       .R7       RRR4       Rp\         P                  ! \        VR7      ;_uu_ 4        \        ^ \        R	R
7       RRR4       Rp\         P                  ! \        VR7      ;_uu_ 4        \        ^ \        R R
7       RRR4       Rp\         P                  ! \        VR7      ;_uu_ 4        \        ^ \        R7       RRR4       R pRp\         P                  ! \        VR7      ;_uu_ 4        \        ^V\
        P                  ! 4       .R7       RRR4       Rp\         P                  ! \        VR7      ;_uu_ 4        \        ^R. R. /\
        P                  ! 4       .R7       RRR4       \         P                  ! \        VR7      ;_uu_ 4        \        ^R^^.R^.R. RO/R7       RRR4       \         P                  ! \        VR7      ;_uu_ 4        \        ^R^^.R^^.R. RO/R7       RRR4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELF; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL>; i  + '       g   i     EL; i  + '       g   i     R# ; i)z3Each distribution in `dists` must have method `ppf`)matchrv   )rZ   rQ   r[   Nc                     V # r   r   r   s   &r"   r   .TestSobolIndices.test_raises.<locals>.<lambda>      r$   z The balance properties of Sobol'gffffff@z'toto' is not a valid 'method'toto)rZ   rQ   r   z!must have the following signaturec                     V # r   r   r   s   &r"   r   r     r   r$   z1'dists' must be defined when 'func' is a callable)rZ   rQ   c                 &    V P                  R^4      # )r1   ru   )rw   r   s   &r"   func_wrong_shape_output=TestSobolIndices.test_raises.<locals>.func_wrong_shape_output  s    99R##r$   z!'func' output should have a shapezWhen 'func' is a dictionaryrr   rt   rs   )r9   r=   r6   r:   )r9   r=   r6   )pytestraises
ValueErrorr   r	   r   rv   )rL   messager   s   &  r"   test_raisesTestSobolIndices.test_raises   s   H]]:W55AJi@ 6 ]]:W55AJ{mD 6 6]]:W55AJu}}6GH 6 ]]:W55Cj8IJ 6 4]]:W55AJv> 6 7]]:W55AJ{C 6 G]]:W55AJ/ 6	$ 7]]:W551%--/9J 6
 1]]:W555"fb1%--/9J 6
 ]]:W55aVUQCF 6 ]]:W55aVUQFFIF 65_ 655 655 655 655 655 655 655 655 655
 655 655s   L$&L8)'M<'M M4NN#N0('O;O O,$L5	8M		M	 M1	4N	N	N-	0O	O	O)	,O=	r   N)rd   
__module____qualname____firstlineno__r   rv   r   r   r[   rO   r   markxslowxfail_on_32bitparametrizer	   paramr*   slowro   rx   r   r   r   r   r   __static_attributes____classdictcell__)__classdict__s   @r"   r,   r,   0   s      	255&"%%0	
E!. [[[[ CD[[	V\\.8H8HIJx   
1B E 1Bf&JP!
F	MM, [[ CD	M E	M7 7r$   r,   )numpyr   numpy.testingr   r   r   scipyr   scipy.statsr   scipy.stats._resamplingr   !scipy.stats._sensitivity_analysisr   r	   r
   r   fixturer#   r*   r,   r   r$   r"   <module>r      sO     <   % 3 
 i  !8F Fr$   