
    >qj/                     :   d dl Z d dlZd dlZd dlmZ d dlmZmZm	Z	m
Z
 d dlmZ d dlmZ d dlmZmZmZmZmZ d dlmZmZ d dlmZ d d	lmZ ej8                  j;                  d
ej<                        Z e
e       G d d             Z  G d d      Z! G d d      Z"y)    N)ComplexWarning)xp_assert_equalxp_assert_closeassert_array_almost_equalmake_xp_test_case)skip_xp_invalid_arg)raises)RegularGridInterpolatorinterpnRectBivariateSplineNearestNDInterpolatorLinearNDInterpolator)_regrid_ndbspline_call_like_bivariate)matrix)_run_concurrent_barriermethodc            
          e Zd Zd Zd Zd Zd Zed        Ze	j                  j                  dg d      d        Ze	j                  j                  d	e ej                  g d
g dg dg      fe ej                  g d      fg      d        Zd Zed        Zd Zd Zd Ze	j                  j                  dg ddfg ddfg ddfg ddfg ddfg      d        Zd Zd  Zd! Zd" Zd# Zd$ Zd% Zd& Ze	j                  j                  dd'd(g      d)        Zd* Zd+ Z e	j                  j                  d,ejB                  ejD                  g      e	j                  j                  d-g d.      e	j                  j                  dd(d'g      d/                      Z#d0 Z$e	j                  j                  d1d2ejJ                  ejL                  g      e	j                  j                  dd(d'g      d3               Z'e	j                  j                  dd'd(g      d4        Z(e	j                  j                  dd'd(g      d5        Z)e	j                  jU                  d6      ee	j                  j                  d7d8d9 fd:d; fd<d= fd>d? fg      d@                      Z+dA Z,edB        Z-e	j                  jU                  d>      edC               Z.ee	j                  j                  dDdEdFg      dG               Z/dH Z0e	j                  j                  d,ejB                  ejD                  ejb                  ejd                  g      e	j                  j                  dIejB                  ejD                  g      dJ               Z3dK Z4dL Z5y2)MTestRegularGridInterpolatorc                    dgdz  }|j                  g d      }|d d t        j                  t        j                  t        j                  f   }|t        j                  d d t        j                  t        j                  f   }|t        j                  t        j                  d d t        j                  f   }|t        j                  t        j                  t        j                  d d f   }||dz  z   |dz  z   |dz  z   }||fS )N              ?      ?   
   d     asarraynpnewaxisselfxppointsvaluesvalues0values1values2values3s           _/opt/rentech/trading_bot/.venv/lib/python3.12/site-packages/scipy/interpolate/tests/test_rgi.py_get_sample_4dz*TestRegularGridInterpolator._get_sample_4d    s    !#L)BJJ

BJJ>?Q

BJJ>?RZZBJJ>?RZZQ>?GbL(7S=87T>Iv~    c                    dgdz  dgdz  z   }|j                  g d      }|d d t        j                  t        j                  t        j                  f   }|t        j                  d d t        j                  t        j                  f   }|t        j                  t        j                  d d t        j                  f   }|t        j                  t        j                  t        j                  d d f   }||dz  z   |dz  z   |dz  z   }||fS Nr      )r         @      $@r   r   r   r   r#   s           r,   _get_sample_4d_2z,TestRegularGridInterpolator._get_sample_4d_2+   s    !#}o&99L)BJJ

BJJ>?Q

BJJ>?RZZBJJ>?RZZQ>?GbL(7S=87T>Iv~r.   c                    dgdz  }|j                  g d      }|d d t        j                  t        j                  t        j                  f   }|t        j                  d d t        j                  t        j                  f   }|t        j                  t        j                  d d t        j                  f   }|t        j                  t        j                  t        j                  d d f   }||dz  z   |dz  z   |dz  z   }||fS )Nr   r   r         ?       @      @      @r   r   r   r   r   r#   s           r,   _get_sample_4d_3z,TestRegularGridInterpolator._get_sample_4d_36   s    56:?@BJJ

BJJ>?Q

BJJ>?RZZBJJ>?RZZQ>?GbL(7S=87T>Iv~r.   c                    dgdz  }|j                  ddg      }|d d t        j                  t        j                  t        j                  f   }|t        j                  d d t        j                  t        j                  f   }|t        j                  t        j                  d d t        j                  f   }|t        j                  t        j                  t        j                  d d f   }||dz  z   |dz  z   |dz  z   }||fS )N)r   r   r   r   r   r   r   r   r   r#   s           r,   _get_sample_4d_4z,TestRegularGridInterpolator._get_sample_4d_4A   s    !S#J'BJJ

BJJ>?Q

BJJ>?RZZBJJ>?RZZQ>?GbL(7S=87T>Iv~r.   c                    | j                  t              \  }}t        j                  g dg dg dg      }t        ||j	                         |      } ||j	                               }t        |||      } ||      }t        ||       y )N)r%   皙?r@   r   ?皙?r@   g?g?r   r   r   r   r   )r;   r!   r    r
   tolistr   )r$   r   r&   r'   sampleinterpv1v2s           r,   test_list_inputz+TestRegularGridInterpolator.test_list_inputL   s    ..".5/1D/1 2 ))/068 FMMO$()/068 F^Br.   r   )cubicquinticpchipc                    | j                        \  }}t        fd|D              }d}t        j                  t        |      5  t        |||       d d d        t        ||      }j                  g dg dg dg      }t        j                  t        |      5   |||       d d d        y # 1 sw Y   ^xY w# 1 sw Y   y xY w)Nc              3   @   K   | ]  }j                  |        y wNr    .0pr%   s     r,   	<genexpr>zDTestRegularGridInterpolator.test_spline_dim_error.<locals>.<genexpr>`        4bjjm4   zpoints in dimensionmatchrE   r?   rB   rD   )r=   listpytestr	   
ValueErrorr
   r    )r$   r   r%   r&   r'   rZ   rH   rG   s     `     r,   test_spline_dim_errorz1TestRegularGridInterpolator.test_spline_dim_error]   s    ..r24V44% ]]:U3 	C#FF6B	C )8/1D/1 2]]:U3 	*6&)	* 	*	C 	C	* 	*s   B3B?3B<?Czpoints_values, sampler?   rB   rD   r@   r@   r3         "@c                      ||       \  }}t        fd|D              j                  |      }}t        ||d      } ||      }t        ||d      } ||      }t        ||       y )Nc              3   @   K   | ]  }j                  |        y wrQ   rR   rS   s     r,   rV   zLTestRegularGridInterpolator.test_linear_and_slinear_close.<locals>.<genexpr>~   s     <bjjm<rX   linearrE   slinear)r[   r    r
   r   )	r$   points_valuesrG   r%   r&   r'   rH   rI   rJ   s	      `     r,   test_linear_and_slinear_closez9TestRegularGridInterpolator.test_linear_and_slinear_closen   sj     'tR0<V<<bjj>P(IF^(	JF^Br.   c                 4   | j                        \  }}t        fd|D              }j                  g dg dg dg      }t        ||d      }t	        t
              5   ||d       d d d        t         ||d	      j                  g d
j                        d       t         ||d      j                  g dj                        d       t         ||d      j                  g dj                        d       y # 1 sw Y   xY w)Nc              3   @   K   | ]  }j                  |        y wrQ   rR   rS   s     r,   rV   z?TestRegularGridInterpolator.test_derivatives.<locals>.<genexpr>   rW   rX   r?   rB   rD   rd   rE      )nu)ri   r   r   r   )r   ri   ri   dtypeV瞯<atol)r   ri   r   r   )r3   r   r   )r   ri   ri   r   )r   r   r   g-=)r-   r[   r    r
   assert_raisesr]   r   float64)r$   r%   r&   r'   rG   rH   s    `    r,   test_derivativesz,TestRegularGridInterpolator.test_derivatives   s    ,,R04V445335 6 )	J:& 	!6a 	! 	v,7

;bjj
A	Ov,7

>
D5	R 	v,7

;bjj
A	O	! 	!s   !DDc                    |dk(  rt        j                  d       | j                        \  }}t        fd|D              }|d|z  z
  }j	                  g dg dg dg      }t        |||      }t        |j                  |      |      }t        |j                  |      |      } ||      }	 ||      d	 ||      z  z   }
t        |	|
       y )
NrN   *pchip does not make sense for complex datac              3   @   K   | ]  }j                  |        y wrQ   rR   rS   s     r,   rV   z;TestRegularGridInterpolator.test_complex.<locals>.<genexpr>   rW   rX                  @r?   rB   rD   rE                 ?)	r\   skipr;   r[   r    r
   realimagr   )r$   r   r%   r&   r'   rG   rH   rinterpiinterprI   rJ   s     `        r,   test_complexz(TestRegularGridInterpolator.test_complex   s    WKKDE..r24V44"V)#/1D/1 2 )G)&"''&/&Q)&"''&/&QF^V_r'&/11Br.   c                 J   |j                  g d      |j                  g d      }}|j                  ||d      \  }} d ||      }t        ||f|d      }t        ||f|d      } |dd	g      }	 |dd	g      }
|j                  |j	                  |	|
z
        d
k        rJ y )N)ri   r1      r   ij)indexingc                     | dz  |dz  z  S )Nr    xys     r,   <lambda>zATestRegularGridInterpolator.test_cubic_vs_pchip.<locals>.<lambda>   s    q!tad{ r.   rL   rE   rN   r7   r1   +=)r    meshgridr
   allabs)r$   r%   r   r   xgygr'   rL   rN   
vals_cubic
vals_pchips              r,   test_cubic_vs_pchipz/TestRegularGridInterpolator.test_cubic_vs_pchip   s    zz,'L)A1QD1B*B3'AwG'AwGC8_
C8_
66"&&j!89EABBBBr.   c                     | j                        \  }}t        fd|D              }t        ||      }j                  g d      }j                  dgj                        }t         ||      |       y )Nc              3   @   K   | ]  }j                  |        y wrQ   rR   rS   s     r,   rV   z?TestRegularGridInterpolator.test_linear_xi1d.<locals>.<genexpr>   rW   rX   r_   H@rk   r4   r[   r
   r    rq   r   r$   r%   r&   r'   rH   rG   wanteds    `     r,   test_linear_xi1dz,TestRegularGridInterpolator.test_linear_xi1d   sh    ..r24V44(8/0VHBJJ7!&.&9r.   c                     | j                        \  }}t        fd|D              }t        ||      }j                  g dg dg dg      }j                  g d      }t	         ||      |       y )Nc              3   @   K   | ]  }j                  |        y wrQ   rR   rS   s     r,   rV   z?TestRegularGridInterpolator.test_linear_xi3d.<locals>.<genexpr>   rW   rX   r?   rB   rD   r   gq@g     \@r-   r[   r
   r    r   r   s    `     r,   test_linear_xi3dz,TestRegularGridInterpolator.test_linear_xi3d   sl    ,,R04V44(8/1D/1 223!&.&9r.   zsample, wanted)r@   r@   rA   rA   g     0@)r@   r@   r@   r@   r   r   r   r   r   r   r   r   r        \@)r@   皙?g333333?rA   g     |@c                     | j                        \  }}t        fd|D              j                  |      }}t        ||d      }j                  |gj                        }t         ||      |       y )Nc              3   @   K   | ]  }j                  |        y wrQ   rR   rS   s     r,   rV   z;TestRegularGridInterpolator.test_nearest.<locals>.<genexpr>   s     =rzz!}=rX   nearestrE   rk   )r-   tupler    r
   rq   r   )r$   rG   r   r%   r&   r'   rH   s      `   r,   test_nearestz(TestRegularGridInterpolator.test_nearest   sj     ,,R0=f==rzz&?Q(	JVHBJJ7!&.&9r.   c                     | j                        \  }}t        fd|D              }t        ||      }j                  g dg dg      }j                  ddg      }t	         ||      |       y )Nc              3   @   K   | ]  }j                  |        y wrQ   rR   rS   s     r,   rV   z@TestRegularGridInterpolator.test_linear_edges.<locals>.<genexpr>   rW   rX   r   r   r   r   r   r   s    `     r,   test_linear_edgesz-TestRegularGridInterpolator.test_linear_edges   sh    ,,R04V44(8-/?@ARK(!&.&9r.   c                    ddg}t        j                  g d      }|d d t         j                  f   }|t         j                  d d f   }||dz  z   }t        t        t
        ||       ddg}t        t        t
        ||       ddg}t        t        t
        ||       g d}t        t        t
        ||       ddg}t        t        t
        ||d       y )	Nr   )r   r   r   r   )r   )r   r   g      ?r   )r   r   r   undefmethodrE   )r!   r    r"   rp   r]   r
   )r$   r&   r'   r(   r)   s        r,   test_valid_createz-TestRegularGridInterpolator.test_valid_create   s    -L)BJJ'Q'GbL(j"966J"L1j"966J#\2j"966J;j"966J-j"966*	,r.   c                    | j                        \  }}t        fd|D              }t        ||      }j                  g dg dg      }t	        t
              5   ||d       d d d        j                  g dg dg      }t	        t
              5   ||       d d d        j                  g dg dg      }t	        t
              5   ||       d d d        y # 1 sw Y   xxY w# 1 sw Y   MxY w# 1 sw Y   y xY w)Nc              3   @   K   | ]  }j                  |        y wrQ   rR   rS   s     r,   rV   z>TestRegularGridInterpolator.test_valid_call.<locals>.<genexpr>   rW   rX   r   r   r   )r   r   r   )r   r   r   )r   r   r   皙?)r-   r[   r
   r    rp   r]   )r$   r%   r&   r'   rH   rG   s    `    r,   test_valid_callz+TestRegularGridInterpolator.test_valid_call   s    ,,R04V44(8-/?@A:& 	*6=)	* \<89:& 	6N	 -/@AB:& 	6N	 		* 	*	 		 	s$   
C	C)	C5C&)C25C>c                    | j                        \  }}t        fd|D              }t        ||dd       }j                  g dg dg dg dgj                        }j                  g d	j                        }t         ||d
      |       j                  g dj                        }t         ||d      |       y )Nc              3   @   K   | ]  }j                  |        y wrQ   rR   rS   s     r,   rV   zHTestRegularGridInterpolator.test_out_of_bounds_extrap.<locals>.<genexpr>  rW   rX   Fbounds_error
fill_value皙r   r   r   r   r   r   r       @皙ir   r   r   r   rk   )r   r         &@r   r   rE   )gfffff[gfffff@g     grc   )r-   r[   r
   r    rq   r   r   s    `     r,   test_out_of_bounds_extrapz5TestRegularGridInterpolator.test_out_of_bounds_extrap  s    ,,R04V44(e48:13G13IK"$**  . 1D!&	"BFK>bjjQ!&"A6Jr.   c                    | j                        \  }}t        fd|D              }t        ||dd       }j                  g dg dg dg dgj                        }j                  g d	j                        }t         ||d
      |       j                  g dj                        }t         ||d      |       y )Nc              3   @   K   | ]  }j                  |        y wrQ   rR   rS   s     r,   rV   zITestRegularGridInterpolator.test_out_of_bounds_extrap2.<locals>.<genexpr>  rW   rX   Fr   r   r   r   r   rk   )r   r   r   r   r   rE   )g333333(g33333`@g     gyXrc   r   r   s    `     r,   test_out_of_bounds_extrap2z6TestRegularGridInterpolator.test_out_of_bounds_extrap2  s    ..r24V44(e48:13G13IK"$**  . /rzzB!&	"BFK9L!&"A6Jr.   c                    | j                        \  }}t        fd|D              }t        ||dj                        }j	                  g dg dg dg      }j	                  j                  j                  j                  g      }t         ||d      |       t         ||d	      |       j	                  g d
g dg dg      }j	                  g d      }t         ||      |       y )Nc              3   @   K   | ]  }j                  |        y wrQ   rR   rS   s     r,   rV   zFTestRegularGridInterpolator.test_out_of_bounds_fill.<locals>.<genexpr>!  rW   rX   Fr   r   r   r   r   rE   rc   r?   rB   rD   r   )r-   r[   r
   nanr    r   r   s    `     r,   test_out_of_bounds_fillz3TestRegularGridInterpolator.test_out_of_bounds_fill  s    ,,R04V44(e46FF<13G35 6RVVRVVRVV45!&	"BFK!&"A6J/1D/1 223!&.&9r.   c                 l   | j                  t              \  }}t        ||d      }t        j                  | }|D cg c]  }| }}t        j
                  |      }|j                  d      }t        ||      }t        j
                  g dg dg dg      }t         ||       ||             y c c}w )Nr   rE   r?   rB   rD   )	r-   r!   r
   	itertoolsproductr    reshaper   r   	r$   r&   r'   rH   points_qhullrU   values_qhullinterp_qhullrG   s	            r,   test_nearest_compare_qhullz6TestRegularGridInterpolator.test_nearest_compare_qhull.  s    ,,R0(	J ((&1#/0a00zz,/~~b),\<H/1D/1 2!&.,v2FG 1s   	B1c                 h   | j                  t              \  }}t        ||      }t        j                  | }|D cg c]  }| }}t        j
                  |      }|j                  d      }t        ||      }t        j
                  g dg dg dg      }t         ||       ||             y c c}w )Nr   r?   rB   rD   )	r-   r!   r
   r   r   r    r   r   r   r   s	            r,   test_linear_compare_qhullz5TestRegularGridInterpolator.test_linear_compare_qhull:  s    ,,R0(8 ((&1#/0a00zz,/~~b)+L,G/1D/1 2!&.,v2FG 1s   	B/r   rc   c                    t        j                  ddd      }t        j                  ddd      }t        d      }t        ||f||      } |dd	g      }t        ||f|j                  |      } |dd	g      }t        ||d
       y )Nr   r1      ri      r   r   rE   r   ffffff?Fcheck_dtype)r!   linspaceMyValuer
   _vr   )r$   r   r   r   r'   rH   rI   rJ   s           r,   test_duck_typed_valuesz2TestRegularGridInterpolator.test_duck_typed_valuesF  s    KK1a KK1a (!QGS#J(!Q6JS#JBE2r.   c                 2   t         j                  j                  d       t        j                  ddd      }t        j                  ddd      }t         j                  j	                  dd      }t        ||f|d       t        t        t
        ||f|d       y )	N  r   r1   r   ri   r   r   y      ?       @)r!   randomseedr   randr
   rp   r]   )r$   r   r   r'   s       r,   test_invalid_fill_valuez3TestRegularGridInterpolator.test_invalid_fill_valueT  sv    
		tKK1a KK1a 1% 	 A1= 	j"9!ff	7r.   c                     t        j                  dd      }|j                  D cg c]  }t        j                  |       }}t	        ||       t	        ||d       y c c}w )Nr         z>f4rk   r   r   )r!   onesshapearanger
   )r$   r'   nr&   s       r,   test_fillvalue_typez/TestRegularGridInterpolator.test_fillvalue_typea  sL    U3(.51"))A,55/2> 6s   Arl   ndimri   r1   r   c                 4   t        j                  ||      }t        d |D              }t        j                  d|      }t        j                  d|z  |      }t        j                  d|      }|dk(  rt         j
                  n|}	t        |||d|	      }
t        |||d
      }t        j                  |g      }t        j                  |g|	      } |
|       ||      fD ]  }t        ||        |dxx   dz  cc<   t        j                  |g      }t        j                  |g|	      } |
|      }t        ||       t        j                  t        d      5   ||       d d d        t         j                  |d<   t        j                  |g      }t        j                  t         j                  g|	      } |
|      }t        ||       t        j                  t        d      5   ||       d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)Nrk   c              3   H   K   | ]  }t        j                  |g        y wrQ   )r!   r    )rT   xis     r,   rV   zGTestRegularGridInterpolator.test_length_one_axis_all.<locals>.<genexpr>w  s     5Brzz2$'5s    "g$I$I?)ri   )r   r   gaa?rc   Fr   r   r   Tr   r   r   ri   z9^One of the requested xi is out of bounds in dimension 0$rY   )r!   r   r   r    fullrq   r
   r   r\   r	   r]   r   )r$   rl   r   r   x0r&   valr'   fillpromoted_dtypeinterp_fill
interp_errrG   r   results                  r,   test_length_one_axis_allz4TestRegularGridInterpolator.test_length_one_axis_alli  s    YYt5) 5"55 jjE*uTzc: zz$e, (.'9u .F6$
 -F6


 RD!SE8"6*Jv,>? 	,FFF+	, 	1
RD!TF.9V$']]M
 	 v		 1RD!RVVHN;V$']]M
 	 v		 		 		 	s   !	H0	HHHc           
         d }t        j                  ddd      }t        j                  ddd      } |t        j                  ||dd       }t        ||f|ddd	
      }t	         |t        j
                  ddgddgddgg            t        j                  g d      d       t	         |t        j
                  ddgddgddgg            g dd       t	         |t        j
                  ddg            |j                  dddd       d |_        t	         |ddgddgg      ddgd       t	         |ddgddgg      ddgd       t        ||f|ddd 
      }t	         |ddgddgg      t        j                  d d!g      d       y )"Nc                     | |z   S rQ   r   r   s     r,   fz;TestRegularGridInterpolator.test_length_one_axis.<locals>.f  s    q5Lr.   ri   r   r   Tr   sparserc   Fe   r   r   )r8         r   rn   gffffff?333333@)333333@333333@r  r   r  )r   check_shapecheck_0dro   333333?g      '@g?g      )@rm   r7   gffffff?r   g?gffffff@r:   r  )r!   r   r   r
   r   arrayr    r   )r$   r   r   r   datarH   s         r,   test_length_one_axisz0TestRegularGridInterpolator.test_length_one_axis  s   	KK1a KK2r""++aT$?@(!Qh6;M 	rxx!Q!Q!R(ABC

<0"	$
 	rxx!SAs8aW(EFG&"	$
 	rxxc
34))$)uu"	$ !C1d)45d%	1 	c
S$K89d%	1 )!Qi6;Nc
RI67

C8,"	$r.   r   Nc                    |d|d}t        j                  ddt         j                  z  d      }t        j                  |      }t	        |f|d d  fi |}t	        |dgf|d d d f   fi |}t        j                  ddt         j                  z  dz   d      } ||      }	t        j
                  d      }
 |t        j                  ||
g      j                        }t        ||	       t        j                  d      }
 |t        j                  ||
g      j                        }|t        ||	       y t        |t        j                  ||             y )	NFr   r   r   r   r1   r   r   ri   r   )r!   r   pisinr
   zerosvstackTr   r   	full_like)r$   r   r   optionsr   zfafbx1azay1bzbs               r,   test_length_one_axis2z1TestRegularGridInterpolator.test_length_one_axis2  s     ",U#% KK1RUU7B'FF1I$aT1Q4;7;$a!XqDzEWEkk"agai-W hhsm		3*%''(B ggcl		3*%''(B#BR <=r.   c                    t        g dfg ddd|      }t        j                   |t        j                  g            sJ t        j                  j                  d      }|j	                  d      d	z  }|j	                  d      d
kD  }t        j                  ||<   t        j                  d      5   ||      }d d d        t        j                  |         j                         sJ t        ||     |||                 g d}dg}t        j                  d      }t        ||f|dd|      }t        j                  t        j                   |t        j                  dg                  sJ t        j                  t        j                   |dt        j                  g                  sJ y # 1 sw Y   xY w)Nr   r   ri   Fr     lJ r   sizer   r   ignoreinvalid)r   ri   )
r
   r!   isnanr   r   default_rngerrstater   r   r   )	r$   r   r   rngr   iresr   r  s	            r,   test_nan_x_1dz)TestRegularGridInterpolator.test_nan_x_1d  so    $YL,116vGxx266($$$ ii##J/JJCJ "JJCJ 3&vv![[* 	
 A$C	 xxA##%%%QB1aR5* Ewwv#QFDQ16vGvvbhhq"&&!~.///vvbhhq!RVV~.///#	 	s   4	F66F?c                 *   t        j                  g d      t        j                  g d      }}d }t        j                  ||dd      \  }} |||      }t        ||f||d      }t        j                  d	
      5   |dt         j
                  gddgg      }	d d d        t        	d   dd       t        j                  |	d         sJ t         j                  j                  d      }
|
j                  d      dz  dz
  }|
j                  d      dz  }|
j                  d      dkD  }|
j                  d      dkD  }||z  }t         j
                  ||<   t         j
                  ||<   t        j                  ||g      j                  }t        j                  d	
      5   ||      }	d d d        t        j                  |	|         j                         sJ t        |	|     |||          d       y # 1 sw Y   cxY w# 1 sw Y   [xY w)N)r   ri   r1   )ri   r   r   c                     | dz  |dz  z   S Nr1   r   r   s     r,   r   z4TestRegularGridInterpolator.test_nan_x_2d.<locals>.f  s    a4!Q$;r.   r   Tr   Fr   r$  r%  r7   ri   r8   r   rn   r   r!  r   r"  r      r   r   )r!   r  r   r
   r)  r   r   r'  r   r(  r  r   r   )r$   r   r   r   r   r   r   r  rH   r,  r*  i1i2r+  r  s                  r,   test_nan_x_2dz)TestRegularGridInterpolator.test_nan_x_2d  s   xx	"BHHY$71	 QD>BRy(!Q06UL [[* 	23-!Q01C	2A%0xxA ii##J/JJCJ "1$JJCJ "ZZSZ!C'ZZSZ!C'G""HHaV[[* 	
 )C	 xxA##%%%QB1"EB/	2 	2	 	s   >G<&	H	<H	Hr   )ndimsfuncr1   c                 $    d| dz  z  d|dz  z  z   S Nr1   r   r   r   s     r,   r   z$TestRegularGridInterpolator.<lambda>8  s    Q!Va!q&j0 r.   r   c                 *    d| dz  z  d|dz  z  z   |z
  S r8  r   )r   r   r  s      r,   r   z$TestRegularGridInterpolator.<lambda>9  s     AQJQ!V3a7 r.   r   c                 0    d| dz  z  d|dz  z  z   |z
  |z   S r8  r   r   r   r  as       r,   r   z$TestRegularGridInterpolator.<lambda>:  s%    q16zAQJ6:Q> r.   r   c                 6    d| dz  z  d|dz  z  z   |z
  ||z  z   S r8  r   )r   r   r  r<  bs        r,   r   z$TestRegularGridInterpolator.<lambda>;  s)    !a1f*q16z"9A"=A"E r.   c                    |dk\  r|dv rt        j                  d       t        j                  j	                  d      }d}d}|j                  ||d|f      }t        |      D cg c]  }t        j                  ||d	       }	} |t        j                  |	d
dd }
t        |	|
|      } ||      }|	D cg c]
  }|d d d    }} |t        j                  |d
dd }t        |||      } ||      }t        ||       y c c}w c c}w )Nr   >   rL   rM   z-too slow; OOM (quintic); or nearly so (cubic)*   ri   r   r1   r"     r   Tr   rE   r   )r\   rx   r!   r   r(  uniformranger   r   r
   r   )r$   r   r5  r6  r*  
sample_lowsample_hightest_points_ascending_pointsascending_valuesascending_interpascending_resultr   descending_pointsdescending_valuesdescending_interpdescending_results                     r,   test_descending_points_ndz5TestRegularGridInterpolator.test_descending_points_nd5  sB    A:&$88KKGHii##B'
kk*kE
kK &+5\3 ! KK
KD 3 3  .>6:48": ; 33C3C:@B ,K80@A"R"XAA "++/@7;59#; < 44E4E;AC .k:(*;<+3 Bs   %D8D
c                    d }t        j                  g d      }t        j                  g d      }||f} |t        j                  |ddd }d}t        j                  t
        |      5  t        ||       d d d        y # 1 sw Y   y xY w)	Nc                 $    d| dz  z  d|dz  z  z   S r8  r   r   s     r,   val_func_2dzJTestRegularGridInterpolator.test_invalid_points_order.<locals>.val_func_2d_  s    qAv:AF
**r.   r   r8   r         @      @r   r8   r:   rU  rV  r   Tr   (must be strictly ascending or descendingrY   )r!   r  r   r\   r	   r]   r
   )r$   rS  r   r   r&   r'   rZ   s          r,   test_invalid_points_orderz5TestRegularGridInterpolator.test_invalid_points_order^  s~    	+ HH*+HH*+Qbkk6D157 8:]]:U3 	4#FF3	4 	4 	4s   ,BBc                     t        t        j                  d      gt        j                  d      |d      }t        j                   |dg            sJ y )Nr  Fr   r   )r
   r!   r   r   r'  )r$   r   rH   s      r,   test_fill_valuez+TestRegularGridInterpolator.test_fill_valuek  s@    ("))A,06ULxxt%%%r.   c                    |dk(  rt        j                  d       dgdz  dgdz  z   }t        j                  j	                  d      }|j                  d      }|j                  d      }t        |||d	
      } ||      }|j                  dk(  sJ |       g }t        d      D ]-  }	t        ||d|	f   |d	
      }|j                   ||             / t        j                  |      j                  ddd      }
t        ||
d|       y NrM   Way too slow.r   r   r   r7   r8   r9   r1   )r   r2   r3         .@r         9@r   )r  r  r  r  r1  )r   r   r   Fr   )r   r   r1  r1  .ri   r   r   ro   err_msg)r\   rx   r!   r   r(  r
   r   rC  appendr  	transposer   )r$   r   r&   r*  r'   rG   rH   vvsjrJ   s              r,   test_nonscalar_valuesz1TestRegularGridInterpolator.test_nonscalar_valuesq  s    YKK( 11A5,9
9  ii##D)O,I&(6;=6Nww)#+V+#q 	&A,VVCF^4::?AF IIfVn%		&
 XXb\##Aq!,2E6:r.   flip_pointsFTc           	         |dv rt        j                  d       g d}|r!|D cg c]  }t        t        |             }}t        j
                  j                  d      }d}|j                  dddd	g|      }|j                  d
      }t        |||d      }	 |	|      }
|
j                  dg|k(  sJ t	        j                  |j                  dd        }t        |j                  d         D ]O  }t        |j                  d         D ]2  }t        ||d||f   |d      }	 |	|      j                         |||f<   4 Q t	        j                  |d      }t        |
|d|       y c c}w )N>   rL   rM   r^  r_  r6   )r   r2   r3   r`  r   ra       A@      B@)	r   r2   r3   r`  r   ra  rm  rn  /   r   r   r1   r  r   r1  	   r   Fr   ri   r   .r   axisr   rb  )r\   rx   r   reversedr!   r   r(  r
   r   emptyrC  itemexpand_dimsr   )r$   r   rj  r&   rU   r*  trailing_pointsr'   rG   rH   rf  rg  r+  rh  rJ   s                  r,   test_nonscalar_values_2z3TestRegularGridInterpolator.test_nonscalar_values_2  sr    ))KK(D 289QeHQK(9F9ii##D) Q1a:/:;A(6;=6N ww1///// XXfll23'(v||B'( 	1A6<<+, 10Q	9J8>>CE "&>..01a4	1	1 ^^BQ'2E6:3 :s   E*c           	      \   d}ddg}t         j                  j                  d      }d}|j                  ddg|      }|j                  d      }t        |||d	
      } ||      }|j                  dg|k(  sJ t        j
                  |j                  dd        }	t        |j                  d         D ]O  }
t        |j                  d         D ]2  }t        ||d|
|f   |d	
      } ||      j                         |	|
|f<   4 Q t        j                  |	d      }t        ||d|       y )Nrc   r_  r6   r   )r   r   r  r   r1   Fr   ri   rr  r   .r   rs  r   rb  )
r!   r   r(  r
   r   rv  rC  rw  rx  r   )r$   r   r&   r*  ry  r'   rG   rH   rf  rg  r+  rh  rJ   s                r,   test_nonscalar_values_linear_2Dz;TestRegularGridInterpolator.test_nonscalar_values_linear_2D  s=   059 ii##D) Q4O45A(6;=6N ww1///// XXfll23'(v||B'( 	1A6<<+, 10Q	9J8>>CE "&>..01a4	1	1 ^^BQ'2E6:r.   xi_dtypec                 X   d }t        j                  ddd      }t        j                  ddd      }t        j                  ||dd	      \  }} |||      }|j                  |      }t	        ||f|      }	t        j
                  d
dgddgg|      }
t         |	|
      ddgddd       y )Nc                 $    d| dz  z  d|dz  z  z   S r8  r   r   s     r,   r   z:TestRegularGridInterpolator.test_float32_values.<locals>.f  s    q!t8a!Q$h&&r.   ri   r   r  r      r   Tr   r   g@ffffff
@g@rk   g Y`@g{,c@gHz>F)ro   rtolr   )r!   r   r   astyper
   r  r   )r$   rl   r}  r   r   r   r   r   r  rH   ptss              r,   test_float32_valuesz/TestRegularGridInterpolator.test_float32_values  s    	' KK1b!KK1b!QD>BRy{{5!(!Q6hhc
c
$+35 	slL%A!%	Ar.   c                 T   t        j                  ddd      }t        j                  ddd      }t        j                  ||dd      \  }}||z   }t        t              5  t        ||f|d        d d d        t        t              5  t        ||f|d	d
        d d d        t        t              5  t        ||f|d	d d       d d d        t        t              5  t        ||f|d	ddi       d d d        y # 1 sw Y   xY w# 1 sw Y   lxY w# 1 sw Y   MxY w# 1 sw Y   y xY w)Nr   r   r   r   Tr   c                     | S rQ   r   r   s    r,   r   z=TestRegularGridInterpolator.test_bad_solver.<locals>.<lambda>  s    1 r.   )solverrd   c                     | S rQ   r   r  s    r,   r   z=TestRegularGridInterpolator.test_bad_solver.<locals>.<lambda>       r.   )r   r  c                     | S rQ   r   r  s    r,   r   z=TestRegularGridInterpolator.test_bad_solver.<locals>.<lambda>
  r  r.   woof)r   r  r  r@  )r   solver_args)r!   r   r   rp   r]   r
   	TypeError)r$   r   r   r   r   r  s         r,   test_bad_solverz+TestRegularGridInterpolator.test_bad_solver  s!   KK1a KK1a QD>BBw :& 	F#QFDE	F 9% 	#AY{	 9% 	#AY{	 9% 	#AYfb\	 		F 	F	 		 		 	s0   C:D2DD:DDDD'c                     | j                  t              \  }}t        j                  g dg dg dg dg      t        ||d      }ddgfd}t	        d	||       y )
Nr?   rB   rD   )r
  r@   rC   r   rd   rE   r   c                 b    |j                   }| dz     } ||       |j                   |u sJ y )Nr1   rE   )_spline)tidrH   spliner   methodsrG   s       r,   	worker_fnz?TestRegularGridInterpolator.test_concurrency.<locals>.worker_fn  s6    ^^FS1W%F6&)>>V+++r.   r   )r-   r!   r  r
   r   )r$   r&   r'   rH   r  r  rG   s        @@r,   test_concurrencyz,TestRegularGridInterpolator.test_concurrency  se    ,,R033335 6 )	J i(	, 	 Iv6r.   )6__name__
__module____qualname__r-   r4   r;   r=   parametrize_rgi_interp_methodsrK   r\   markparametrizer^   r!   r    rf   rr   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   float32rq   r   r  r   r  r  r-  r4  	fail_slowrP  rY  r[  ri  rz  r|  	complex64
complex128r  r  r  r   r.   r,   r   r      s   				 $  $   [[X'DE* F*  [[ 

%&%' zrzz*?@A
	
  O* $  $ "C:: [[!6*!3'!3'!6*!6*	
	:	::,$ KK:
H
H [[X	8'<=3 >37? [[Wrzz2::&>?[[VY/[[X)'<=; > 0 @;z*$X [[\D"&&"%%+@A[[X)'<=> > B>4 [[X	8'<=0 >0< [[X	8'<="C >"CH [[2#[[.	
01	
78	
>?	
EF	1 = $ =B4 $& $&
 [[1#; $ ;: $[[]UDM:'; ; $';R;> [[	RZZr}}= [[Z"**bjj)ABA C	
A087r.   r   c                   *    e Zd ZdZd Zd Zd ZddZy)r   z"
    Minimal indexable object
    c                     d| _         || _        t        j                  t        j                  |            j                  |      | _        y r0  )r   r   r!   r   prodr   r   )r$   r   s     r,   __init__zMyValue.__init__,  s3    	
))BGGEN+33E:r.   c                      | j                   |   S rQ   )r   )r$   idxs     r,   __getitem__zMyValue.__getitem__1  s    wws|r.   c                      y rQ   r   )r$   s    r,   __array_interface__zMyValue.__array_interface__4  s    r.   Nc                     t        d      )NzNo array representation)RuntimeError)r$   rl   copys      r,   	__array__zMyValue.__array__7  s    455r.   )NN)r  r  r  __doc__r  r  r  r  r   r.   r,   r   r   '  s    ;
6r.   r   c                      e Zd Zd Zd Zed        Zd Zd Zd Z	d Z
d Zd	 Zd
 Zd Zed        Zej"                  j%                  d      ed               Zed        Zd Zed        Zd Zd Zej"                  j3                  dddg      d        Zeed               Zd Zd Zd Zd Z d Z!d Z"d Z#ej"                  j3                  d d!d"g      d#        Z$y$)%TestInterpNc           	          t        j                  g d      }t        j                  g d      }t        j                  g dg dg dg dg dg dg      }|||fS )N)r   r8   r:   rU  rV  g      @)ri   r1   ri   r1   ri   ri   )ri   r1   r   r1   ri   ri   )ri   r1   r1   r1   ri   ri   )r!   r  )r$   r   r   r  s       r,   _sample_2d_datazTestInterpN._sample_2d_data<  sR    HH./HH./HH""""""	
 !Qwr.   c           
         | j                         \  }}}t        |||      }t        |||      }t        j                  g dg dg      j
                  }t        t        ||f||d      |j                  |d d df   |d d df                t        t        ||f||d      t        ||d d df   |d d df   d             y )	Nri   ffffff@r  r   r  333333?r   ri   r  r  rU  r2   r   r   	splinef2drE   r   ri   Fgrid)r  r   r   r!   r  r  r   r   evr   r   )r$   r   r   r  lut
lut_customr   s          r,   test_spline_2dzTestInterpN.test_spline_2dK  s    &&(1a!!Q*Q1%
XX668 99: 	!'1a&!R"L"%&&AqD2ad8"<	>A2kB"@&0"QT(Bq!tH+0#2	3r.   c                 F   | j                         \  }}}t        j                  g dg dg      j                  }t	        ||f|||      }t	        |j                         |j                         f|j                         |j                         |      }t        |||       y )Nr  r  rE   )rc  )r  r!   r  r  r   rF   r   )r$   r   r   r   r  r   rI   rJ   s           r,   rK   zTestInterpN.test_list_inputY  s    &&(1aXX668 99: 	aVQ62XXZ$ahhj"))+f
 	B/r.   c           
      f   t        j                  g d      }t        j                  g d      }t        j                  g dg dg dg dg dg      }t        |||      }t        |||      }t        j                  g dg dg      j                  }t        ||f||ddd	
      }|j                  |d d df   |d d df         }d	|dd t        ||       t        ||d d df   |d d df   d      }	d	|	dd t        ||	       d	|	dd t        ||	       t        t        t
        ||f||ddd 
       y )NrW  ri   r1   ri   r1   ri   ri   r1   r   r1   ri   ri   r1   r1   r1   ri   ri   r  r  r   r  r  r   ri   r  r  g      r2   r   r   r  FR?@r   r   ri   r1   r   r  )r!   r  r   r   r  r   r  r   r   r   rp   r]   )
r$   r   r   r  r  r  r   actualexpectedexpected_customs
             r,   test_spline_2d_outofboundsz&TestInterpN.test_spline_2d_outofboundsd  s:   HH*+HH*+HHo%8 9!!Q*Q1%
XX679 ::;! 	!QB{&+@66"QT(Bq!tH-1!&(381a4"QT(8%!0%!0 	j'Aq61b#(T	;r.   c                 "   dgdz  dgdz  z   }t        j                  g d      }|d d t         j                  t         j                  t         j                  f   }|t         j                  d d t         j                  t         j                  f   }|t         j                  t         j                  d d t         j                  f   }|t         j                  t         j                  t         j                  d d f   }||dz  z   |dz  z   |dz  z   }||fS r0   )r!   r    r"   )r$   r&   r'   r(   r)   r*   r+   s          r,   _sample_4d_datazTestInterpN._sample_4d_data  s    !#}o&99L)BJJ

BJJ>?Q

BJJ>?RZZBJJ>?RZZQ>?GbL(7S=87T>Iv~r.   c                     | j                         \  }}t        ||      }t        j                  g dg      }t	        |||d      }t         ||      |       y )Nr_   rc   rE   r  r
   r!   r    r   r   r$   r&   r'   	interp_rgrG   r   s         r,   test_linear_4dzTestInterpN.test_linear_4d  sQ    --/+FF;	012A!)F"3V<r.   c                     | j                         \  }}t        j                  g dg      }t        j                  dg      }t        |||ddd      }t	        ||       y )Nr@   r   g333333$@r`   r  rc   Fr   r  r!   r    r   r   r$   r&   r'   rG   r   r  s         r,   test_4d_linear_outofboundsz&TestInterpN.test_4d_linear_outofbounds  sX    --/234VH%&+@!&&1r.   c                     | j                         \  }}t        ||d      }t        j                  g dg      }t	        |||d      }t         ||      |       y )Nr   rE   r_   r  r  s         r,   test_nearest_4dzTestInterpN.test_nearest_4d  sS    --/+FF9M	012	B!)F"3V<r.   c                     | j                         \  }}t        j                  g dg      }t        j                  dg      }t        |||ddd      }t	        ||       y )Nr  r  r   Fr   r  r  s         r,   test_4d_nearest_outofboundsz'TestInterpN.test_4d_nearest_outofbounds  sX    --/234VH%	&+@!&&1r.   c                     | j                         \  }}t        j                  g d      }t        |||d      }t        |||d d d f   d      }t	        ||       y )Nr_   F)r   )r  r!   r    r   r   r$   r&   r'   rG   rI   rJ   s         r,   
test_xi_1dzTestInterpN.test_xi_1d  sU    --//0VVV%@VVVDF^%HBr.   c                 v   | j                         \  }}t        j                  j                  d       t        j                  j	                  ddd      }t        |||dd      }|j                  dk(  sJ t        |||j                  d	d      dd      }t        ||j                  |j                               y )
Nr   r1   r   r   r   Fr   r1   r   r   )	r  r!   r   r   r   r   r   r   r   r  s         r,   
test_xi_ndzTestInterpN.test_xi_nd  s    --/
		t1a(VVVI"')xx6!!!VVV^^B%:%E;BJJrxx01r.   c                    | j                         \  }}}||f}t        j                  ddd      }t        j                  ddd      }|d d d f   |d d d f   f}t        ||||d      }	|	j                  dk(  sJ t        j
                  ||      \  }
}t        j                  |
j                  j                         |j                  j                         f   }t        ||||d      }t        |	|j                  |	j                               y )Nr   ri   r1   r   Fr   r  )r  r!   r   r   r   r   c_r  ravelr   r   )r$   r   r   r   r'   r&   r   yirG   rI   xxyyrJ   s                r,   test_xi_broadcastzTestInterpN.test_xi_broadcast  s     ++-1fQ[[Aq![[Aq!QW+r$'{+VVVFOxx6!!!R$Brttzz|RTTZZ\12VVV"8BJJrxx01r.   r   c           
         |dk(  rt        j                  d       dgdz  dgdz  z   }t        j                  j	                  d      }|j                  d      }|j                  d      }t        ||||d	
      }|j                  dk(  sJ |       t        d      D cg c]  }t        ||d|f   ||d	
       }}t        j                  |      j                  ddd      }	t        ||	d|       y c c}w r]  )r\   rx   r!   r   r(  r   r   rC  r  re  r   )
r$   r   r&   r*  r'   rG   rf  rh  rg  rJ   s
             r,   ri  z!TestInterpN.test_nonscalar_values  s    YKK( 11A5,9
9  ii##D)O,I&FFF6!&(ww)#+V+# 498=./ ffS!VnfV#(* = =XXb\##Aq!,2E6:	=s   C0c                 H   |dv rt        j                  d       g d}t        j                  j	                  d      }d}|j                  dddd	g|      }|j                  d
      }t        ||||d      }|j                  dg|k(  sJ t        |j                  d         D 	cg c]<  }t        |j                  d         D 	cg c]  }	t        ||d|	|f   ||d       c}	> }
}}	t        |t        j                  |
      j                  d|       y c c}	w c c}	}w )N>   rL   rM   r^  rl  r   rp  r  r   r1  rq  r   Fr   ri   r   rr  .r   rb  )r\   rx   r!   r   r(  r   r   rC  r   r    r  )r$   r   r&   r*  ry  r'   rG   rf  rh  r+  rg  s              r,   rz  z#TestInterpN.test_nonscalar_values_2  s&    ))KK(D
 ii##D) Q1a:/:;AFFF6N ww1///// v||B/02  6;6<<;K5L01 sAqy 16&%*, 2 2
 	2::b>++%H 2s   (DD$DDc                 "   | j                         \  }}t        j                  j                  d       t        j                  j	                  ddddd      }t        j                  j	                  ddd      }t        t        t        |||d       y )	Nr   r   r  r   r  r   r  rE   )r  r!   r   r   r   rp   r]   r   )r$   r&   r'   rG   s       r,    test_non_scalar_values_splinef2dz,TestInterpN.test_non_scalar_values_splinef2d  si    --/
		t1aA.2q)j'666(	*r.   c                 l   |dk(  rt        j                  d       | j                         \  }}}||f}|d|z  z
  }t        j                  g dg dg      j
                  }t        ||||      }t        ||j                  ||      }t        ||j                  ||      }	|d|	z  z   }
t        ||
       y )NrN   rt   rv   r  r  rE   rw   )
r\   rx   r  r!   r  r  r   ry   rz   r   )r$   r   r   r   r'   r&   rG   rI   v2rv2irJ   s              r,   r}   zTestInterpN.test_complex  s    WKKDE++-1fQ"V)#::< ==>Q 	 VVVF;ffkk6&Affkk6&A2c6\Br.   c                    | j                         \  }}}||f}|d|z  z
  }t        j                  g dg dg      j                  }t	        j
                  t        d      5  t        |||d       d d d        y # 1 sw Y   y xY w)Nrv   r  r  ry   rY   rN   rE   )r  r!   r  r  r\   r	   r]   r   r$   r   r   r'   r&   rG   s         r,   test_complex_pchipzTestInterpN.test_complex_pchip/  s    ++-1fQ"V)#::< ==>Q 	]]:V4 	<FFF7;	< 	< 	<s   !A::Bc                    | j                         \  }}}||f}|d|z  z
  }t        j                  g dg dg      j                  }t	        j
                  t              5  t        |||d       d d d        y # 1 sw Y   y xY w)Nrv   r  r  r  rE   )r  r!   r  r  r\   warnsr   r   r  s         r,   test_complex_spline2fdz"TestInterpN.test_complex_spline2fd:  s    ++-1fQ"V)#::< ==>Q 	\\.) 	@FFF;?	@ 	@ 	@s   A88Br   rc   r   c                     t        j                  ddd      }t        j                  ddd      }t        d      }t        ||f|ddg|	      }t        ||f|j                  ddg|	      }t        ||d
       y )Nr   r1   r   ri   r   r   r   r   rE   Fr   )r!   r   r   r   r   r   )r$   r   r   r   r'   rI   rJ   s          r,   r   z"TestInterpN.test_duck_typed_valuesE  sq    
 KK1a KK1a aVVc3Z?aVVYYc
6BBE2r.   c                    t        j                  ddd      }t        j                  ddd      }t        t         j                  j	                  dd            }t         j                  j	                  ddd      }t        ||f|||      }t        ||ft        j                  |      ||      }|dk(  rt        ||d	d
       yt        ||       y)z8np.matrix inputs are allowed for backwards compatibilityr   r1   r  ri   r   r   rE   rM   g-C6
?g>)ro   r  N)r!   r   r   r   r   r   r    r   )r$   r   r   r   r'   rG   rI   rJ   s           r,   test_matrix_inputzTestInterpN.test_matrix_inputS  s     KK1a KK1a 		q!,-1a(aVVVF;aVRZZ/GYBD9B#r.   c                 :   t        j                  g dg      }t        j                  ddgddgddgg      }t        dgg df||      }g d}t        ||d	       t        j                  d
dgddgddgg      }t        dgg df||dd       }t        ||d	       y )N)r@   ri   r   ri   g@g	@gffffff@)r1   r   r   )gQ?gffffff@gffffff @rm   rn   r   r7   gffffffFr   )r!   r  r   r   )r$   r'   r   r,  r   s        r,   r  z TestInterpN.test_length_one_axisf  s    
 <.)XX3x!SAs845sI&3 	V%0 XXSzC:c{;<sI&#(T; 	V%0r.   c           	      P   d }t        j                  g d      }t        j                  g d      }t        j                  g d      }t        j                  g d      }||||f} |t        j                  |ddd }dd	t        j                  t        j                  d
dd            t        j                  d
d	d      f}t        |||      }	|d d d   }
|d d d   }|d d d   }|d d d   }|
|||f} |t        j                  |ddd }t        |||      }t        |	|       y )Nc                 0    d| dz  z  d|dz  z  z   |z
  |z
  S r8  r   r;  s       r,   value_func_4dz9TestInterpN.test_descending_points.<locals>.value_func_4d}  s'    qAv:AF
*Q.22r.   )r   ri   r1   r   )r   r   r   r   )r   r@   rC   r
  r   Tr   r@   r
  r   r   r   r   )r!   r  r   re  r   r   r   )r$   r  x1x2x3x4r&   r'   r  correct_result
x1_descend
x2_descend
x3_descend
x4_descendpoints_shuffledvalues_shuffledtest_results                    r,   test_descending_pointsz"TestInterpN.test_descending_points|  s!   	3 XXl#XXo&XXo&XX&'b"b![[&4=?Cbkk!R&;<{{1c1%' 5"X
"X
"X
"X
%z:zJ'[[/DFHoD4r.   c                 t   t        j                  g d      }t        j                  g d      }t        j                  g dg dg dg dg dg      }t        j                  g dg dg      j                  }d}t        j                  t
        |	      5  t        ||f||       d d d        y # 1 sw Y   y xY w)
NrT  rW  r  r  r  r  r  rX  rY   )r!   r  r  r\   r	   r]   r   )r$   r   r   r  r   rZ   s         r,   rY  z%TestInterpN.test_invalid_points_order  s    HH*+HH*+HHo%8 9XX679 ::;! 	 ;]]:U3 	#QFAr"	# 	# 	#s   B..B7c                     dg}ddg}t        j                  d      }d}t        t        |      5  t	        |||       d d d        y # 1 sw Y   y xY w)N)r   ri   r   ri   )ri   ri   r   zaThe requested sample points xi have dimension 3, but this RegularGridInterpolator has dimension 1rY   )r!   r   rp   r]   r   )r$   r&   r'   r   msgs        r,   test_invalid_xi_dimensionsz&TestInterpN.test_invalid_xi_dimensions  sR    QWWY9:S1 	(FFB'	( 	( 	(s   AAc                    t        j                  ddd      }t        j                  ddd      }t        j                  ddd      }|||f}t        j                  d      }t        j                  g d      }|D ]  }d|j                  _         d|j                  _        d|j                  _        t        |||        t        ||      |       y )	Nr   r   r   r  r   r   r  r   Gz@(\@gffffff?Fr!   r   r   r  flags	writeabler   r
   )r$   r   r   r  r&   r'   pointds           r,   test_readonly_gridzTestInterpN.test_readonly_grid  s    KK1a KK1a KK1a Q#+, 	&A %AGG	&!& %&//6r.   c                 r   t        j                  ddd      }t        j                  ddd      }||f}t        j                  d      }t        j                  ddg      }|D ]  }d|j                  _         d|j                  _        d|j                  _        t        |||        t        ||      |       y )	Nr   r   r   r  r   r  r  r  Fr  )r$   r   r   r&   r'   r  r  s          r,   test_2d_readonly_gridz!TestInterpN.test_2d_readonly_grid  s     KK1a KK1a Q$& 	&A %AGG	&!& %&//6r.   c                    t        j                  ddd      }t        j                  |t        j                  |      f      j                  j                         d d df   }|j                  j                  rJ t        j                  ddd      }t        j                  ddd      }|||f}t        j                  d      }t        j                  g d      }t        |||        t        ||      |       y )Nr   r   r   r  r   r  r  )r!   r   r  
empty_liker  r  r  c_contiguousr   r  r   r
   )r$   r   r   r  r&   r'   r  s          r,   test_non_c_contiguous_gridz&TestInterpN.test_non_c_contiguous_grid  s    KK1a IIq"--*+,..335ad;77''''KK1a KK1a Q#+,&//6r.   rl   z>f8z<f8c                    t        j                  ddd|      }t        j                  ddd|      }||f}t        j                  d|      }t        j                  ddg|      }t	        |||        t        ||      |       y )	Nr   r   r   rk   r  r  r  r  )r!   r   r   r  r   r
   )r$   rl   r   r   r&   r'   r  s          r,   test_endiannesszTestInterpN.test_endianness  sw     KK1au-KK1au-Qu-$U3&//6r.   N)%r  r  r  r  r  r  rK   r  r  r  r  r  r  r  r  r  r\   r  r  ri  rz  r  r}   r  r  r  r   r   r  r  r
  rY  r  r  r  r   r"  r   r.   r,   r  r  ;  sX   3 $0 $0;8=2=2 2 $2 $2& [[1#; $ ;0 $I $I@* $  $ $	<	@ [[	93	3 #$ $ $"1,54
#(777 [[Wuen5	7 6	7r.   r  )#r   r\   numpyr!   numpy.exceptionsr   scipy._lib._array_apir   r   r   r   scipy.conftestr   r	   rp   scipy.interpolater
   r   r   r   r   scipy.interpolate._regridr   r   scipy.sparse._sputilsr   scipy._lib._testutilsr   r  r  _ALL_METHODSr  r   r   r  r   r.   r,   <module>r,     s       +  / *L LN ) 9 "(!8!8%22"  *+E7 E7 ,E7P6 6(f7 f7r.   