a
    ߙfbO                     @   s0  d Z ddlZddlZddlZddlZddlmZ ddlZddlZ	ddl
mZmZmZ ddlmZmZ ddlmZmZ ddlmZ ddlmZ G d	d
 d
ZG dd dZdd Zdd Zdd Zdd Zdd Zdd Z dd Z!G dd dZ"G dd dZ#dd  Z$d!d" Z%d#d$ Z&d%d& Z'd'd( Z(d)d* Z)d+d, Z*d-d. Z+d/d0 Z,d1d2 Z-d3d4 Z.d5d6 Z/d7d8 Z0d9d: Z1d;d< Z2d=d> Z3d?d@ Z4dAdB Z5dCdD Z6dEdF Z7dGdH Z8dIdJ Z9dKdL Z:dMdN Z;dOdP Z<dQdR Z=dSdT Z>G dUdV dVZ?dWdX Z@G dYdZ dZZAG d[d\ d\eAZBG d]d^ d^ZCd_d` ZDG dadb dbZEdS )cz$Test the Quantity class and related.    N)Fraction)assert_allcloseassert_array_equalassert_array_almost_equal)
isiterable
minversion)AstropyDeprecationWarningAstropyWarning)units)_UNIT_NOT_INITIALISEDc                   @   st   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd ZdS )TestQuantityCreationc                 C   s*  dt j }t|t jsJ t jd }t|t js4J dt j }t|t jsNJ t jd }t|t jshJ dt j t j }t|t jsJ tt dt j }W d    n1 s0    Y  tt dt j }W d    n1 s0    Y  tt dt j }W d    n1 s0    Y  d S )Nףp=
&@gsh|f@)umeter
isinstanceQuantitysecondpytestraises	TypeError)selfquantity r   @lib/python3.9/site-packages/astropy/units/tests/test_quantity.pytest_1   s     



((zTestQuantityCreation.test_1c                 C   sz   t jdt jd}t dd}t d}|jt dks:J tt" t jt t j	d W d    n1 sl0    Y  d S )Nm&@unitQ5@cm   )
r   r   r   r   Unitr   r   r   objectm)r   _q3r   r   r   test_24   s    
zTestQuantityCreation.test_2c                 C   s<   t t tjddd W d    n1 s.0    Y  d S )Nr   Z
testinggggr   )r   r   
ValueErrorr   r   r   r   r   r   test_3B   s    zTestQuantityCreation.test_3c                 C   s  t jddd}t|jsJ t jddd}t|js<J t jddd}t|jsZJ t d}t|jstJ |jt jksJ t jddd}t|jsJ t jddd}t|jsJ t d	}t|jsJ |jt jksJ t jd
dd}t|js
J t	t
 t jddd}W d    n1 s:0    Y  t	t
 t jddd}W d    n1 st0    Y  d S )Nnanr   r   ZNaNz-nanznan cminfz-infzinf cmZInfinity Zspam)r   r   npZisnanvaluer   r   Zisinfr   r   r   r   qr   r   r   test_nan_infG   s,    

.z!TestQuantityCreation.test_nan_infc                 C   sF   t jdt jd}tt t j|_W d    n1 s80    Y  d S )N&@r   )r   r   r   r   r   AttributeErrorr   r   r   q1r   r   r   test_unit_propertyk   s    z'TestQuantityCreation.test_unit_propertyc           	      C   s  t jdt jt j td}|jtks&J t |}|jtks>J |jt|jksRJ |j|jksbJ t	j
ddgt	jd}t |t j}|j|jksJ t	j
ddgt	jd}t |t j}|j|jksJ t tdt j}|jtksJ t jtdt jtd}|jtksJ dS )zTest that if an explicit dtype is given, it is used, while if not,
        numbers are converted to float (including decimal.Decimal, which
        numpy converts to an object; closes #1419)
           r   dtype      ?       @r9   z10.25N)r   r   r#   sintr9   floatr.   r   r-   arrayZfloat32ZyrZfloat16decimalZDecimalr"   )	r   r5   q2Za3_32Zq3_32Za3_16Zq3_16q4q5r   r   r   test_preserve_dtyper   s     
z(TestQuantityCreation.test_preserve_dtypec                 C   s  t d}tj|tjtj d}|j|us.J tj|tjtj dd}|j|u sTJ t|}||usjJ |j|juszJ tj|dd}||u sJ |j|ju sJ tj||jdd}||u sJ |j|ju sJ tj|tjtj dd}||usJ |j|jusJ d S )N      $@r   F)r   copyrG   )	r-   aranger   r   r#   r=   baser   r   )r   aZq0r5   rB   r%   rC   r   r   r   	test_copy   s"    

zTestQuantityCreation.test_copyc                 C   s   G dd dt j}|tdt j}tt |t ju s<J tt j|dd|u sVJ tt |t jt ju srJ tt j|t jdd|u sJ dS )z>Test subok can be used to keep class, or to insist on Quantityc                   @   s   e Zd ZdS )z;TestQuantityCreation.test_subok.<locals>.MyQuantitySubclassN__name__
__module____qualname__r   r   r   r   MyQuantitySubclass   s   rQ   rF   TZsubokN)r   r   r-   rI   r#   typekm)r   rQ   Zmyqr   r   r   
test_subok   s    zTestQuantityCreation.test_subokc           	      C   s  t jt ddd}tj|tjdd}|jd s4J tj|tjdd}|jd sTJ tj|tjdd}|jd stJ tj|ddjd sJ tj|ddjd sJ tj|ddjd sJ t jt ddd}tj|tjdd}|jd sJ tj|tjdd}|jd sJ tj|tjdd}|jd s4J tj|ddjd sNJ tj|ddjd shJ tj|ddjd sJ dS )	z3Test that order is correctly propagated to np.arrayrF   CorderC_CONTIGUOUSFF_CONTIGUOUSAN)r-   r@   rI   r   r   r#   flags)	r   ZacZqccZqcfZqcaZafZqfcZqffZqfar   r   r   
test_order   s(    zTestQuantityCreation.test_orderc                 C   s   t d}tj|tjdd}|jdkr0|jdks4J tj|tjdd}|jdkrZ|jdks^J tj|tjdd}|jdkr|jdksJ tjtdd	d	ddjdksJ tjtdd
d	ddjdksJ dS )z3Test that ndmin is correctly propagated to np.arrayrF   r    )Zndmin)
      )r    r_      )r    r    r_   r#   r   N)r-   rI   r   r   r#   ndimshape)r   rK   r5   rB   r%   r   r   r   
test_ndmin   s    
"zTestQuantityCreation.test_ndminc                 C   s  G dd dt j}t d}| |}d|_t|}t|tjsJJ |jtj	u sZJ t 
|j|ksnJ t|tj}|jtju sJ t 
|jd| ksJ tj|dd}t 
|j|ksJ d|d	< |d	 d
ksJ |d	 d
ksJ | |}tj	|_tj|tjdd}d|d	< |d	 d
ks0J |d	 dksBJ d|_tt t| W d   n1 st0    Y  dS )z4Test that unit attributes in objects get recognized.c                   @   s   e Zd ZdS )zMTestQuantityCreation.test_non_quantity_with_unit.<locals>.MyQuantityLookalikeNrM   r   r   r   r   MyQuantityLookalike   s   re         @r#        @@FrH   r   r`           r;   ZnonsenseN)r-   ndarrayrI   rG   viewr   r   r   r   r#   allr.   mmr   r   r   )r   re   rK   Zmylookaliker5   rB   r%   rC   r   r   r   test_non_quantity_with_unit   s2    

z0TestQuantityCreation.test_non_quantity_with_unitc                 C   sd  dt j> }t|t jsJ |jt jks*J |jdks8J td}|t jt j > }t|t jsbJ |jt jt j ksxJ t	|j|ksJ d|d< t	|j|ksJ |t j
t j > }t|t jsJ |jt j
t j ksJ t	|j|d ksJ d|d< |d jdksJ ||j> }d|d< t	|j|ks:J tt j |t j>  W d    n1 sh0    Y  | }|t j
t j K }|jt j
t j ksJ t	|j|ksJ t	|j|d ksJ d	|d< |d
> }|jt jt j ksJ t	||ksJ dt j }td}	|	|> }
|
jt |ks@J t	|
t jd|	 ks`J d S )Nr:   rF   rh   	   rg      g     @@         zkm/hrg      >@      @)r   r#   r   r   r   r.   r-   rI   r=   rk   rl   r   r   
UnitsErrorrG   rT   Zhrr   r!   to_value)r   r5   Za2rB   r%   rC   Za2_copyrD   Znot_quite_a_footZa6Zq6r   r   r   test_creation_via_view  sH    


*

z+TestQuantityCreation.test_creation_via_viewc              	   C   s  t tH t jtdd}dtj?  W d    n1 s:0    Y  W d    n1 sX0    Y  t|dksrJ dtj }t tH t jtdd}|tj?  W d    n1 s0    Y  W d    n1 s0    Y  t|dksJ t tJ t jtdd}|tjL }W d    n1 s*0    Y  W d    n1 sJ0    Y  t|dksfJ t tH t jtdd}d|?  W d    n1 s0    Y  W d    n1 s0    Y  t|dksJ d S )Nzis not implementedmatchr    r:   )	r   r   r   warnsr	   r   r#   lenrT   )r   Zwarning_linesr0   r   r   r   test_rshift_warns0  s2    F
FJHz&TestQuantityCreation.test_rshift_warnsN)rN   rO   rP   r   r&   r)   r1   r6   rE   rL   rU   r^   rd   rm   ru   rz   r   r   r   r   r      s   $"/r   c                   @   s   e Zd ZedejZedejZdd Z	dd Z
dd Zd	d
 Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zejjd!d"d#d$ Zd%d& Zd'S )(TestQuantityOperationsr          @c                 C   s   | j | j }|jdksJ |jtjks*J | j| j  }|jdksDJ |jtjksTJ tdtjtdtj	 }|jtjksJ |jdksJ d S )Ng      '@g     @gfffffp@g      +@gL@)
r5   rB   r.   r   r   r   
centimeterr   r#   rT   )r   new_quantitynew_qr   r   r   test_additionH  s    z$TestQuantityOperations.test_additionc                 C   sX   | j | j }|jdksJ |jtjks*J | j| j  }|jdksDJ |jtjksTJ d S )NgGz&@g     r5   rB   r.   r   r   r   r}   r   r~   r   r   r   test_subtractionW  s    z'TestQuantityOperations.test_subtractionc                 C   s   | j | j }|jdksJ |jtjtj ks0J | j| j  }|jdksJJ |jtjtj ks`J d| j  }|jdksxJ |jtjksJ | j d }|jdksJ |jtjksJ d S )Ngףp=
V@      .@gie@r   r   r   r   r   test_multiplicationb  s    

z*TestQuantityOperations.test_multiplicationc                 C   s  | j | j }t|jddd |jtjtj ks2J | j| j  }t|jddd |jtjtj ksdJ tjdtjd}tjdtj	d}|| }t|jd	d
d |jtjtj	 ksJ | j d }|jdksJ |jtjksJ d| j  }|jdksJ |jt
dksJ d S )Ngףp=
?   rA   g-.;j?   r2   r   rF   g=
ףp=?r_   gʡE?r   r:   z1/m)r5   rB   r   r.   r   r   r   r}   r   r   r!   )r   r~   r5   rB   r   r   r   test_divisionw  s&    

z$TestQuantityOperations.test_divisionc                 C   sr   t dd}| jt j t j| j   kr0|ks6n J | jt j t ddksRJ t j| j t ddksnJ dS )zRegression test for issue #587.r   zm*sm/sg-.;j?zs/mN)r   r   r5   r=   )r   r   r   r   r   test_commutativity  s    *z)TestQuantityOperations.test_commutativityc                 C   s`   | j d }t|jddd |jtdks.J | j d }t|jddd |jtd	ks\J d S )
Nr`   g&SM`@r   r   zm^2ra   gkE@rp   zm^3)r5   r   r.   r   r   r!   r   r   r   r   
test_power  s    

z!TestQuantityOperations.test_powerc                 C   s   t d}|tj }|| }t ||ks.J || }t ||ksHJ || }t ||tjd  kslJ t g dg dg dgg dg dg dgg dg dg dggtj }|| }t |t ||j|j	 |j	 ksJ d S )Nra   r`   )r:   rh   rh   )rh   r:   rh   )rh   rh   r:   )
r-   Zeyer   r#   rk   r@   r=   matmulr.   r   )r   rK   r0   Zresult1Zresult2Zresult3rB   Zresult4r   r   r   test_matrix_multiplication  s2    


	z1TestQuantityOperations.test_matrix_multiplicationc                 C   s   | j  }|j| j j ksJ |j| j jks.J | j   }|j| j jksJJ |j| j jks\J | j 
 }|j| j jksvJ |j| j jksJ d S N)r5   r.   r   r   r   r   r   
test_unary  s    
z!TestQuantityOperations.test_unaryc                 C   sv   dt j t j }t|}|j|jks(J |j|jks8J dt j t j }t|}|j|j ksbJ |j|jksrJ d S )Nr:   rq   )r   r#   r=   absr.   r   )r   r0   r~   r   r   r   test_abs  s    zTestQuantityOperations.test_absc                 C   sX   t jdt jd}t jdt jd}tt j ||  W d   n1 sJ0    Y  dS )zM When trying to add or subtract units that aren't compatible, throw an error r   r   r   N)r   r   r   r   r   r   rs   )r   r5   rB   r   r   r   test_incompatible_units  s    z.TestQuantityOperations.test_incompatible_unitsc                 C   s   t jdt jd}tt}|ddi  W d    n1 s<0    Y  |jjd ds\J tt |t j  W d    n1 s0    Y  d S )Nr   r   rK   r    r   z*Unsupported operand type(s) for ufunc add:)	r   r   r   r   r   r   r.   args
startswith)r   r5   excr   r   r   test_non_number_type  s    *z+TestQuantityOperations.test_non_number_typec                 C   s  dt j t j }|dt j t j  }|jdks2J |j|jksBJ |d }|jdksXJ |jt jkshJ tt j	* | j
t jdt dd  W d    n1 s0    Y  tt j	* | j
t jdt dd  W d    n1 s0    Y  t jtg dt jt j td	}|tg d
 }|jt jks:J t|jtg d tt" |tg d7 }W d    n1 s0    Y  tg dt j t j }|tg d
7 }|jt jksJ t|jtg dksJ d S )Nrf   r:   g5^I@g?5^I?皙?r,   r   r    r`   ra   r<   )   r      )g/$@g5^I@gPn@)i  i  i  )r   r#   rT   rl   r.   r   dimensionless_unscaledr   r   rs   r5   r   r!   r-   r@   r>   r   r   rk   )r   ZdqZdq1Zdq2r0   rB   r   r   r   test_dimensionless_operations  s*    88"2z4TestQuantityOperations.test_dimensionless_operationsc           
      C   s   ddl m} tdtj}tdtj}|| |jtj }t	|j
ddd tdtjd	 tj tjd
  }ddtj |  tjd tjd  tj }tdtj}tdtj}|| }	t	|	j
ddd |	jtjtj ksJ dS )z! Perform a more complicated test r   )imperialr   g      &@gb(g@r   r   gyдW=ra   r`   r:         @      @g     @S@   N)Zastropy.unitsr   r   r   r   r   toZmilehourr   r.   r#   kgr=   r-   Zpipcr}   r   r   )
r   r   ZdistancetimeZvelocityGr$   Zside1Zside2Zarear   r   r   test_complicated_operation  s    ".z1TestQuantityOperations.test_complicated_operationc              	   C   s(  dt jt j  dt jd  ks"J dt j dt j ks:J dt j dt j ksRJ t jd }d| }||tu svJ ||du sJ ||ksJ dt jd  }||ksJ dt j dkrJ dt j dksJ dt j dt j fD ]<}tjt	dd	 t
| W d    q1 s0    Y  qd S )
Nr    r   d   ra   r:   Trg   zWThe truth value of a Quantity is ambiguous. In the future this will raise a ValueError.rv   )r   r   r#   __eq__NotImplementedrl   r   r   rx   r   bool)r   r   r0   r   r   r   r   test_comparison$  s    "
z&TestQuantityOperations.test_comparisonc           	      C   s:  t dt j}d}d}tt}t| W d    n1 s>0    Y  |jjd |ks\J tt}t	| W d    n1 s0    Y  |jjd |ksJ tt}|
  W d    n1 s0    Y  |jjd |ksJ t dt jt j }t|t|t jksJ t	|t	|t jks8J tt}|
  W d    n1 sb0    Y  |jjd |ksJ t dt j}t|dksJ t	|dksJ tt}|
  W d    n1 s0    Y  |jjd |ksJ t jdt jt	d}t|dks"J t	|dks4J |
 dksFJ t ddgt j}tt}t| W d    n1 s0    Y  |jjd |ksJ tt}t	| W d    n1 s0    Y  |jjd |ksJ tt}|
  W d    n1 s0    Y  |jjd |ks6J d S )	Nr    zGonly dimensionless scalar quantities can be converted to Python scalarszOonly integer dimensionless scalar quantities can be converted to a Python indexr   Gz?r`   r<   r;   )r   r   r#   r   r   r   r?   r.   r   r>   	__index__rT   rt   r   )	r   r5   Zconverter_err_msgZindex_err_msgr   rB   r%   rC   rD   r   r   r   test_numeric_converters?  sL    &&&(((((z.TestQuantityOperations.test_numeric_convertersz/list multiplication only works for numpy <=1.10)reasonc                 C   s.   t jdt jtd}|g d g dks*J dS )z*Test that use of __index__ actually works.r`   r<   )rK   bc)rK   r   r   rK   r   r   N)r   r   r   r>   )r   rC   r   r   r   +test_numeric_converter_to_index_in_practice  s    zBTestQuantityOperations.test_numeric_converter_to_index_in_practicec                 C   sf   t dt j}tt|tdgks.J t g dt j}tt|tg dksbJ d S )Nr   r:   r;   rf   )r   r   r#   r-   rk   r@   r/   r   r   r   test_array_converters  s     z,TestQuantityOperations.test_array_convertersN)rN   rO   rP   r   r   r   r5   r}   rB   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   markZxfailr   r   r   r   r   r   r{   D  s(   	
	
!I
r{   c                  C   s   t jdt jd} | j}|dks"J | t j}|dks:J | t j}|jdksTJ tt j	 | t j
 W d    n1 s0    Y  tt j	 | t j
 W d    n1 s0    Y  d S )Nr   r   g-C6?)r   r   r   r.   rt   	kilometerr   r   r   rs   Zzettastokes)r5   r.   Zvalue_in_kmr~   r   r   r   test_quantity_conversion  s    *r   c                  C   s  t jddgt jd} | j}d|d< t| ddgt j ks>J |  }d|d< t| ddgt j ksjJ | d}d|d< t| ddgt j ksJ | jdd	d
}dt j |d< t| ddgt j ksJ | d}d|d< t| ddgt j ksJ d S )Nr:   r;   r   rh   r   rf   r    r#   FrH   r`   r   )r   r   r   r.   r-   rk   rt   r   )r5   Zv1v2v3rB   Zv4r   r   r   test_quantity_value_views  s     

r   c                  C   s   t jdt jd} | jt jt  d}t|d | jt jt  d}t|j| t jdt j	d} | jt j
t  d}| jt j
t  d}|jt jt  d}|jt jt  d}t|d t|j| |jt j
ksJ t|d t|j| |jt jksJ d S )Nr   r   )Zequivalenciesg  \VAg?g(\8yAgK2N{?)r   r   r   rt   Hzspectralr   r   r.   Z	arcsecondZauZparallaxZ	arcminuter   )r5   r   rB   r   r%   r   r   r   #test_quantity_conversion_with_equiv  s     


r   c                     s   G  fdddt j  ddgt jd} | t j}|jt jksDJ |t j}|jt jks`J t|j| j  ddgt jd}|t jt j}|jt jksJ t|j|j d S )Nc                       s,   e Zd Ze Z fddZ fddZdS )zBtest_quantity_conversion_equivalency_passed_on.<locals>.MySpectralc                    s
   |  S r   )rj   )r   objr   
MySpectralr   r   __quantity_view__  s    zTtest_quantity_conversion_equivalency_passed_on.<locals>.MySpectral.__quantity_view__c                    s    |i |S r   r   )r   r   kwargsr   r   r   __quantity_instance__  s    zXtest_quantity_conversion_equivalency_passed_on.<locals>.MySpectral.__quantity_instance__N)rN   rO   rP   r   r   Z_equivalenciesr   r   r   r   r   r   r     s   r       r   )r   r   r   r   Znmr   r   r.   )r5   rB   r%   rC   rD   r   r   r   .test_quantity_conversion_equivalency_passed_on  s    	r   c                   C   s0   t jdt j sJ t jdt j s,J d S )Nr   r    )r   degis_equivalentZradianr   r   r   r   test_self_equivalency  s    r   c                  C   s   dt j t jd  dt j d  } | jjdks2J | jjt jksDJ dt j }|jjdks^J |jjt jkspJ dt j }|jjdksJ |jjdt j ksJ d S )NrF   r`         i@   r_   r    )r   r#   r=   msZsir.   r   r5   r0   r   r   r   test_si  s    "

r   c                  C   s   dt j t jd  dt j d  } | jjdks2J | jjt jksDJ dt j }|jjdks^J |jjt jkspJ dt j }|jjdksJ |jjdt j ksJ dt j }|jjdksJ |jjt j	ksJ d S )	NrF   r`   r   r   r   r_   r    r   )
r   r   r=   r   Zcgsr.   r   r#   ZPaZbaryer   r   r   r   test_cgs  s    "


r   c                   @   s$   e Zd Zdd Zdd Zdd ZdS )TestQuantityComparisonc                 C   s  t jdddt jdddks J t jdddt jdddkr@J t jdt jdt jdt jdkdu shJ t jdt jdt jdt jdkdu sJ t jd	t jdt jd	t jdkdu sJ t d	t jd
ksJ t dt jd
ksJ t dt jtjksJ t tjt jtjksJ d S )Nr   r#   r   r    rT   L  TFr   rh   )r   r   r#   r=   r-   r+   r(   r   r   r   test_quantity_equality  s      (((z-TestQuantityComparison.test_quantity_equalityc                 C   s,  t g dt j}t dt j}||k}||k}t|g dksFJ t||ksXJ t dt j}||k}||k}|du sJ |du sJ |dk}|dk}|du sJ |du sJ |dk}|dk}t|g dksJ t||ksJ tg d}||k}||k}|du sJ |du s(J d S )	N)rh   r:   rg   r:   )FFTFTr   )TFF)r   r:   rg   )r   r   r#   rT   r-   rk   r=   r@   )r   rK   r   eqner   dr   r   r   test_quantity_equality_array  s0    z3TestQuantityComparison.test_quantity_equality_arrayc                 C   sR  t jdt jdt jdt jdks$J t jdt jdt jdt jdk sHJ tt j4 t jdt jdt jdt jdkszJ W d    n1 s0    Y  tt j4 t jdt jdt jdt jdk sJ W d    n1 s0    Y  t jdt jdt jdt jdksJ t jdt jdt jdt jdks4J t jdt jdt jdt jdksZJ t jdt jdt jdt jdksJ tt j6 t jdt jdt jdt jdksJ W d    n1 s0    Y  tt j6 t jdt jdt jdt jdksJ W d    n1 s0    Y  t jdt jdt jdt jdksNJ d S )Nr   r   r    i  r   i  )r   r   r   r   r   r   rs   r   r(   r   r   r   test_quantity_comparison<  s&    $$BB&&&&*Fz/TestQuantityComparison.test_quantity_comparisonN)rN   rO   rP   r   r   r   r   r   r   r   r     s   r   c                   @   s  e Zd ZejddedZejdddZejg dddZee	ddZ
ee	dd	d
 Zee	ddd Zeede	ddd  Zeede	ddd  Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zd d! Zd"d# Zd$d% Zd&S )'TestQuantityDisplayr    r#   r8   g?r   )r    gffffff@g!@r:   r;   gqٙEg(,* Erq   gqٙg yhGra   }   c                 C   sd   t jddd}t jddtd}t| j| dks4J t| j| dksJJ t| j| dks`J d S )	Nr:   m-1r   r    r8   z<Quantity 1.>z<Quantity [1. , 2.3, 8.9]>z<Quantity 1>)r   r   r>   repr
scalarintqarrqr   rB   r%   r   r   r    test_dimensionless_quantity_repra  s
    z4TestQuantityDisplay.test_dimensionless_quantity_reprc                 C   sd   t jddd}t jddtd}t| j| dks4J t| j| dksJJ t| j| dks`J d S )	Nr:   r   r   r    r8   z1.01z[1.  2.3 8.9])r   r   r>   strr   r   r   r   r   r   test_dimensionless_quantity_strh  s
    z3TestQuantityDisplay.test_dimensionless_quantity_strc                 C   s    t d}t|ddksJ d S )NgQ	@z.2fz3.14)r   r   formatr4   r   r   r   "test_dimensionless_quantity_formato  s    
z6TestQuantityDisplay.test_dimensionless_quantity_formatc                 C   s(   t | jdksJ t | jdks$J d S )N1 m1.3 m)r   r   scalarfloatqr(   r   r   r   test_scalar_quantity_strs  s    z,TestQuantityDisplay.test_scalar_quantity_strc                 C   s(   t | jdksJ t | jdks$J d S )Nz<Quantity 1 m>z<Quantity 1.3 m>)r   r   r   r(   r   r   r   test_scalar_quantity_reprw  s    z-TestQuantityDisplay.test_scalar_quantity_reprc                 C   s   t | jdksJ d S )Nz[1.  2.3 8.9] m)r   r   r(   r   r   r   test_array_quantity_str{  s    z+TestQuantityDisplay.test_array_quantity_strc                 C   s   t | jdksJ d S )Nz<Quantity [1. , 2.3, 8.9] m>)r   r   r(   r   r   r   test_array_quantity_repr~  s    z,TestQuantityDisplay.test_array_quantity_reprc                 C   s@   t | jddksJ t | jddks(J t | jddks<J d S )NZ02dz01 mz.1fr   z.0fr   )r   r   r   r(   r   r   r   test_scalar_quantity_format  s    z/TestQuantityDisplay.test_scalar_quantity_formatc                 C   s>   t dtj}t|ts$J t|td s:J d S )NrF   >)	r-   rI   rj   r   r   r   endswithr   r   )r   Zbad_quantityr   r   r   test_uninitialized_unit_format  s    z2TestQuantityDisplay.test_uninitialized_unit_formatc                 C   s   t dd}t|| ks J d}d|jt jt j d |ksFJ d}d|jdt jt j d |ksnJ d	}|jd
d|ksJ d	}|jd
dd|ksJ d}|jd
dd|ksJ d S )N  Br   z&Quantity as KMS: 150000000000.0 km / szQuantity as KMS: r   z!Quantity as KMS: 1.500e+11 km / sra   )	precisionr   ,$1.5 \times 10^{14} \; \mathrm{\frac{m}{s}}$Zlatex)r   Zinline)r   Zsubfmtz:$\displaystyle 1.5 \times 10^{14} \; \mathrm{\frac{m}{s}}$Zdisplay)r   r   r   Z	to_stringrT   r=   )r   Zqscalarresr   r   r   test_to_string  s    "$z"TestQuantityDisplay.test_to_stringc              
   C   s  ddl m} tdd}| j dks*J | j dks<J | dksLJ | j dks^J | j d	kspJ | j	 d
ksJ | j
 dksJ | j dksJ d| j v sJ tdtj }tdtj }tdd tj }t }|j}ztdd}tg dtj }	tjdd | dks<J |	 dksNJ tjdd | dkslJ |	 dks~J d|_| }
d|
vsJ | }d|v sJ | }d|v sJ d|_| }
d|
vsJ | }d|vsJ | }d|v sJ d|_tjdd | }
d|
v s6J | }d|v sLJ | }d|v sbJ |dsrJ W tjf i | ||_ntjf i | ||_0 tjtj tjgtj }| d ksJ d S )!Nr   )confr   r   z$1 \; \mathrm{m}$z$1.3 \; \mathrm{m}$r   z$[1,~2.3,~8.9] \; \mathrm{m}$z$(1+2i) \; \mathrm{}$z3$(1 \times 10^{25}+2 \times 10^{52}i) \; \mathrm{}$z4$(-1 \times 10^{36}-2 \times 10^{63}i) \; \mathrm{}$ze$[(0-0i),~(-1 \times 10^{36}-2 \times 10^{63}i),~(-2 \times 10^{36}-4 \times 10^{63}i)] \; \mathrm{}$z\dotsr   r   i'  g    eAgo͏X4oA)g8ܘ@g[W4oAr   ro   )r   z1$9.8765432 \times 10^{8} \; \mathrm{\frac{m}{s}}$z6$[7.89123,~1.2345679 \times 10^{8},~0] \; \mathrm{cm}$r`   z+$9.9 \times 10^{8} \; \mathrm{\frac{m}{s}}$z,$[7.9,~1.2 \times 10^{8},~0] \; \mathrm{cm}$i  c   )Z	thresholdz",~1 \times 10^{13}] \; \mathrm{m}$z,$[\infty,~-\infty,~{\rm NaN}] \; \mathrm{m}$)astropy.units.quantityr   r   r   r   Z_repr_latex_r   r   scalar_complex_qscalar_big_complex_qscalar_big_neg_complex_qarr_complex_qbig_arr_complex_qr-   rI   r#   Zget_printoptionsZlatex_array_thresholdr@   r   Zset_printoptionsr   r+   r*   )r   r   Zq2scalarZqmedZqbigZqvbigZpopsZoldlatr0   qaZlsmedZlsbigZlsvbigZqinfnanr   r   r   test_repr_latex  s|    z#TestQuantityDisplay.test_repr_latexN)rN   rO   rP   r   r   r>   r   r   r   complexr   r   r   r-   rI   r   r  r   r   r   r   r   r   r   r   r   r   r  r   r   r   r   r   V  s&   r   c                  C   s4   dt j } |  dt j t j t jd  ks0J d S )Nr   r   )r   N	decomposer   r#   r=   r5   r   r   r   test_decompose  s    
r  c                  C   s   t g dtj dtj  } t |  jt g dks@J t | t g dtj dtj  kslJ t |  jt g dksJ dS )a  
    Regression test for bug #1163

    If decompose was called multiple times on a Quantity with an array and a
    scale != 1, the result changed every time. This is because the value was
    being referenced not copied, then modified, which changed the original
    value.
    r   r;   )gMb@?gMbP?g~jtX?N)r-   r@   r   r#   rT   rk   r  r.   r0   r   r   r   test_decompose_regression  s    	",r
  c                  C   s~  t tdt j} t| jtjs&J | jr0J t	| t	| jksFJ | dd }|j
| j
ksbJ t|t jsrJ t	|dksJ t dt j}|jsJ tt t	| W d   n1 s0    Y  tt |d  W d   n1 s0    Y  t jtdt jtd}|js"J tt t	| W d   n1 sL0    Y  tt |d  W d   n1 s0    Y  t|jtjsJ tjg d	d
tfdtfdtfgd}t |t j}|jrJ |d }|j|d ksJ |j
|j
ks
J t|t jsJ |js(J |d
 }t|j|d
 ksJJ |j
|j
ks\J t|t jsnJ |jrzJ |d
 d }|j
|j
ksJ t|t jsJ |jsJ |d d
 }	|	jsJ |	|ksJ t ttdt j} t| jtjsJ t| d jtdd  t| d jtdd  tt j* t| d jtdd  W d   n1 sx0    Y  tt j* t| d jtdd  W d   n1 s0    Y  tdt j }
t jtd }t| |
ksJ t|
|ksJ tt t|  W d   n1 s<0    Y  tt t|  W d   n1 sp0    Y  dS )z0
    Test using quantites with array values
    r_   r`   r   ra   rF   Nr   r<   )r   r   rr   g      @)r   r|   g      "@xyzr    )r   r   r-   rI   r   r   r.   ri   Zisscalarry   r   r   r   r   r@   r>   numbersZIntegralr?   kpcrk   listranger   rs   )ZqsecZ	qsecsub25ZqsecnotarrayZqseclen0arrayrK   ZqkpcZqkpc0ZqkpcxZqkpcx1Zqkpc1xZqsec2Zqsec3r   r   r   test_arrays  s|    

&&((
::(r  c                  C   sV   t g dtj } | d dtj ks*J t | dd tddgtjksRJ d S )Nr   r   r:   r`   r;   )r-   r@   r   r#   rk   r   r	  r   r   r   test_array_indexing_slicingS  s    r  c                  C   sT   t g dtj } t dgtj | dd< t | t g dtj ksPJ d S )Nr   g      y@r    r`   )r:   r   rf   )r-   r@   r   r#   r   rk   r	  r   r   r   test_array_setsliceY  s    r  c                  C   s   t dt jt j } | d }d|  }| td }|jdks@J |jt jt j ksVJ |jdksdJ |jt jt j kszJ |jdksJ |jt jt j ksJ dS )z)
    Regression test from issue #679
    r   r`   r;         ?N)r   r   r   r   r-   r@   r.   r   )r0   ZqotZtoqZnpqotr   r   r   test_inverse_quantity_  s    r  c                  C   s   t dt jt j t j } tt d| _W d    n1 s@0    Y  tt t j| _	W d    n1 sr0    Y  d S )Ng#@ra   )
r   r   r   r   r   r   r3   r.   r   r   r	  r   r   r   test_quantity_mutabilityr  s
    $r  c                  C   s   t dt j} t | t j}|jdks*J t | |gt j}|d jdksNJ |d jdks`J t || g}|j|jks~J |d jdksJ |d jdksJ d S )N<   r    r   )r   r   r   Zminuter.   r   r5   rB   r%   rC   r   r   r   'test_quantity_initialized_with_quantity|  s    r  c                  C   sZ   dt j d } | jdksJ | jt jt j ks2J | d }|jt jt j t j ksVJ d S )Nr:   r=   r    r#   )r   r#   r.   r   r=   r5   rB   r   r   r   test_quantity_string_unit  s
    r  c                   C   s8   t t dtj  W d    n1 s*0    Y  d S )Nfoor   r   r'   r   r#   r   r   r   r   !test_quantity_invalid_unit_string  s    r   c                  C   s<   t dt j} d| _t| jd t| jd t| jd d S )Nr:   Tr   gm̋<)r   r   r    _include_easy_conversion_membersr   r}   r   parsecr	  r   r   r   test_implicit_conversion  s
    r#  c                  C   s   t dt j} d| _d| _t| }d|v s.J d|v s:J d|v sFJ d|v sRJ d|v s^J d	|v sjJ d
|v svJ tt | j	 W d    n1 s0    Y  d S )Nr:   T*   r}   r   r"  r  r   r.   __setattr__)
r   r   r   r!  r  dirr   r   r3   l)r0   attrsr   r   r   %test_implicit_conversion_autocomplete  s    r)  c                  C   sV   ddgt j } t| sJ tt| }|dt j ks8J t|rDJ ttt| dS )zRegressiont est for issue #878.

    Scalar quantities should not be iterable and should raise a type error on
    iteration.
    r   g      1@N)r   r#   r   nextiterr   r   r   r  r   r   r   test_quantity_iterability  s    r,  c                  C   s<  t jtg dg dgt jd} |  }t| j|jks@J | j|jksPJ | j	|j	ks`J | j|juspJ | jdd}|j
d sJ t| j|jksJ | j|jksJ | j	|j	ksJ | j|jusJ | jdd}|j
d sJ t| j|jksJ | j|jksJ | j	|j	ks&J | j|jus8J d S )	Nr   r  r   rZ   rW   r[   rV   rY   )r   r   r-   r@   r#   rG   rk   r.   r   r9   r]   r  r   r   r   rL     s$    "rL   c                  C   s~   t jtg dt jd} t| }t|t js4J t| j	|j	ksJJ | j
|j
ksZJ | j|jksjJ | j	|j	uszJ d S )Nr   r   )r   r   r-   r@   r#   rG   deepcopyr   rk   r.   r   r9   r  r   r   r   test_deepcopy  s    
r.  c                   C   sF   ddt j ksJ tddt j ks*J dt j tdksBJ dS )z
    A regression test to ensure that numpy scalars are correctly compared
    (which originally failed due to the lack of ``__array_priority__``).
    r_   rF   N)r   r#   r-   Zint64r   r   r   r   test_equality_numpy_scalar  s    r/  c                  C   s\   t dtj } tt| }t | j|jks6J | j	
|j	sHJ | j	|j	ksXJ dS )z+
    Testing pickleability of quantity
    r_   N)r-   rI   r   r#   pickleloadsdumpsrk   r.   r   r   r  r   r   r   test_quantity_pickelability  s
    r3  c                  C   s  t d} | jt jksJ | jdks(J t d} | jt jt j ksHJ | jdksVJ t | t dksnJ t d} | t dt jksJ t d} | t dt jksJ t d	} | t dt jksJ t d
} | t dt jksJ t d} | t dt jksJ t dt j} | t dt jks6J t dt j} | jdksTJ | jt jksfJ t d} | t dt j	ksJ t
t t d W d    n1 s0    Y  t
t t d W d    n1 s0    Y  t
t t d W d    n1 s 0    Y  t
t t d W d    n1 sV0    Y  t
t t d W d    n1 s0    Y  t
t t d W d    n1 s0    Y  t
t t dg W d    n1 s0    Y  t
t" t tdg W d    n1 s80    Y  t
t t d W d    n1 sn0    Y  t
t t d W d    n1 s0    Y  d S )Nr   r:   z1.5 m/s      ?z.5 mr  z-1e1kmiz-1e+1kmz+.5kmz+5e-1km5rr   z5 kmg     @Z5Emr,   r#   z	1.2.3 degz1+degz1-2degz
1.2e-13.3mZ5Ez5 foo)r   r   r   r   r.   r#   r=   r!   rT   ZEmr   r   r   r-   r@   r'   r	  r   r   r   (test_quantity_initialisation_from_string  sX    







******,2*r6  c                  C   sJ   t dtj } tt t | |  W d    n1 s<0    Y  d S )Nr_   )r-   rI   r   r#   r   r   r   Zbitwise_andr  r   r   r   test_unsupported4  s    r7  c                  C   s   dt j } | jt ju sJ d S )Nr:   )r   r   r   r	  r   r   r   test_unit_identity;  s    
r8  c                  C   sH   t ddgtj } | tj}| jd dks2J |jd dksDJ d S )Nr   r   r   r    )r-   r@   r   r#   r   rT   r.   r  r   r   r   test_quantity_to_view@  s    r9  c                   C   s<   t t dtj d  W d    n1 s.0    Y  d S )Nrr   )r    r`   r  r   r   r   r   test_quantity_tuple_powerG  s    r:  c                  C   sJ   dt jd  tdd } | jdks&J | jt jks6J | jjdksFJ d S )Ng      9@r`   r    rr   f)r   r#   r   r.   r   r9   kindr	  r   r   r   test_quantity_fraction_powerL  s    r=  c                  C   s  ddl m}  | tdtdgddgd}tj|d _t|d }|jtjksVJ t|j	|d  t|d }|jtj
ksJ t|j	|d  t|d tj}|jtjksJ t|j	|d d  t|d tj}|jtjksJ t|j	|d  ttjtjd  |d _t|d }|jttjtjd  ksHJ t|j	|d  tj|d d	d
}t|tjs|J |jttjtjd  ksJ t|j	|d  ttj t|d  W d   n1 s0    Y  dS )z
    Checks that units from tables are respected when converted to a Quantity.
    This also generically checks the use of *anything* with a `unit` attribute
    passed into Quantity
    r   )Tabler   rK   r   )datanamesr   r`   TrR   N)astropy.tabler>  r-   rI   r   r  r   r   r   r.   r   r   dexr   r=   Dexr   r   r   UnitTypeError)r>  tr  ZqbZqapZqbpZfqZfq2r   r   r   test_quantity_from_tableU  s2     ""rF  c                  C   s   ddl m} m} |tdtjd}t|}|d d |d d< |  }tdtj |d< tdtj |d< t	|d |u sJ t
|d |d gjtj }g d	}||df j|d | jksJ |d | ||df< d S )
Nr   )r>  ColumnrF   r   r`   r_   r  r  )r   r`   r   )rA  r>  rG  r-   rI   r   rl   r   onesrS   ZvstackTr   )r>  rG  r   r0   rE  ZxyZiir   r   r   $test_assign_slice_with_quantity_like  s    
 rJ  c                  C   s  ddgt j } | ddt j }t|jg dks8J |jt ju sHJ |jj	dksXJ t
tdr| dddgt j }t|jg dksJ |jt ju sJ tt j" | ddt j  W d	   n1 s0    Y  ddgd
dggt j } | jdddgt j dd}t|jddgddgd
dggks6J | jdddgt j dd}t|jg dg dgksrJ | jddt j dd}t|jg dg dgksJ d	S )z
    Test Quantity.insert method.  This does not test the full capabilities
    of the underlying np.insert, but hits the key functionality for
    Quantity.
    r    r`   r   )r   r    r`   r;  z1.8.0)r    r   r   r`   r4  Nra   r   r_      )Zaxis)r    r_   r`   )ra   rK  r   )ra   r_   r   )r   r#   insertrT   r-   rk   r.   r   r9   r<  r   r   r   rs   r=   )r0   rB   r   r   r   test_insert  s2    
0rM  c                  C   sB   t jdtj dtj gtd} t| dks.J t| dks>J dS )z
    Test print/repr of object arrays of Quantity objects with different
    units.

    Regression test for the issue first reported in
    https://github.com/astropy/astropy/issues/3777
    r    r`   r<   z7array([<Quantity 1. m>, <Quantity 2. s>], dtype=object)z![<Quantity 1. m> <Quantity 2. s>]N)r-   r@   r   r#   r=   r"   r   r   )rK   r   r   r   test_repr_array_of_quantity  s    	rN  c                   @   s,   e Zd Zdd Zdd Zdd Zdd Zd	S )
TestSpecificTypeQuantityc                 C   sH   G dd dt j}G dd d|}G dd d|}|| _|| _|| _d S )Nc                   @   s   e Zd ZejZdS )z.TestSpecificTypeQuantity.setup.<locals>.LengthN)rN   rO   rP   r   r#   Z_equivalent_unitr   r   r   r   Length  s   rP  c                   @   s   e Zd ZejZdS )z/TestSpecificTypeQuantity.setup.<locals>.Length2N)rN   rO   rP   r   r#   _default_unitr   r   r   r   Length2  s   rR  c                   @   s   e Zd ZejZdS )z/TestSpecificTypeQuantity.setup.<locals>.Length3N)rN   rO   rP   r   r#   _unitr   r   r   r   Length3  s   rT  )r   ZSpecificTypeQuantityrP  rR  rT  )r   rP  rR  rT  r   r   r   setup  s    zTestSpecificTypeQuantity.setupc                 C   s  |  tdtj }t|| j u s(J ttj& |  tdtj	  W d    n1 s`0    Y  ttj  |  td W d    n1 s0    Y  | 
td}t|| j
u sJ |j| j
ju sJ ttj  | td W d    n1 s0    Y  d S )NrF   rr   )rP  r-   rI   r   rT   rS   r   r   rD  r   rR  rQ  rT  )r   r'  l2r   r   r   test_creation  s    4.z&TestSpecificTypeQuantity.test_creationc                 C   s   t dtj | j}t|| ju s*J ttj	( t dtj
 | j W d    n1 sd0    Y  t d| j}t|| ju sJ |jd u sJ t d| j}t|| ju sJ |j| jju sJ d S )Nrr   )r`   r`   )r-   rI   r   rT   rj   rP  rS   r   r   rD  r=   rS  rH  rT  r   )r   r'  vl3r   r   r   	test_view  s    6z"TestSpecificTypeQuantity.test_viewc                 C   s   |  tdtj }|dtj  }t|| j u s6J dtj | }t|| j u sVJ || }t|| j u spJ |dtj  }t|tju sJ || }t|tju sJ d S )Nrr   r:   )	rP  r-   rI   r   r   r#   rS   rT   r   )r   r'  Zsum1Zsum2Zsum3Zres1Zres2r   r   r   &test_operation_precedence_and_fallback  s    z?TestSpecificTypeQuantity.test_operation_precedence_and_fallbackN)rN   rO   rP   rU  rW  rZ  r[  r   r   r   r   rO    s   rO  c                  C   sh   G dd dt j} t dt j}| |_t d|}t|t ju sDJ t jd|dd}t|| u sdJ d S )Nc                   @   s   e Zd ZdS )z,test_unit_class_override.<locals>.MyQuantityNrM   r   r   r   r   
MyQuantity  s   r\  Zmy_degr:   TrR   )r   r   r!   r   Z_quantity_classrS   )r\  Zmy_unitr5   rB   r   r   r   test_unit_class_override  s    r]  c                   @   s   e Zd Zdd Zdd ZdS )QuantityMimicc                 C   s   || _ || _d S r   )r.   r   )r   r.   r   r   r   r   __init__  s    zQuantityMimic.__init__c                 C   s   t | jS r   )r-   r@   r.   r(   r   r   r   	__array__  s    zQuantityMimic.__array__N)rN   rO   rP   r_  r`  r   r   r   r   r^    s   r^  c                   @   s   e Zd Zdd Zdd ZdS )QuantityMimic2c                 C   s   t | j| j|S r   )r   r   r.   r   r   r   r   r   r   r   r     s    zQuantityMimic2.toc                 C   s   t | j| j|S r   )r   r   r.   r   rt   rb  r   r   r   rt     s    zQuantityMimic2.to_valueN)rN   rO   rP   r   rt   r   r   r   r   ra    s   ra  c                   @   sL   e Zd ZdZejdeefdd Z	ejdeefdd Z
dd Zd	S )
TestQuantityMimicsz5Test Quantity Mimics that are not ndarray subclasses.Mimicc                 C   s~   t d}||tj}t|}|jtjks0J t |j|ksDJ t|tj}|jtjksbJ t |jd| kszJ d S )NrF   r   )	r-   rI   r   r#   r   r   rk   r.   r   )r   rd  r.   mimicr0   rB   r   r   r   test_mimic_input%  s    

z#TestQuantityMimics.test_mimic_inputc                 C   sv   |ddgt j}t tdt j}||dd < t|d d jtdksRJ t|dd  jddgksrJ d S )Nr:   r;   rF   ro   r|   g      Y@r   )r   r#   r   r-   rI   r   rk   r.   )r   rd  re  r0   r   r   r   test_mimic_setting0  s
    "z%TestQuantityMimics.test_mimic_settingc                 C   s  t ddgttjtjd  }t|}t|tjs:J |jttjtjd  ksZJ t	|j
ddgksrJ tj|dd}t|tjsJ |jttjtjd  ksJ t	|j
ddgksJ ttj t| W d    n1 s0    Y  d S )Nr:   r;   r`   TrR   )r^  r   rB  r   r=   rC  r   r   r-   rk   r.   r   r   r   rD  )r   re  r   r0   r   r   r   test_mimic_function_unit8  s     
  z+TestQuantityMimics.test_mimic_function_unitN)rN   rO   rP   __doc__r   r   Zparametrizer^  ra  rf  rg  rh  r   r   r   r   rc  #  s   


rc  c                  C   s2   t jjg dtj g dd} t|  t|  dS )z5Ensure we don't break masked Quantity representation.)r    r`   ra   r   )TFTF)maskN)r-   Zmar@   r   r   r   r   )Zmasked_quantityr   r   r   test_masked_quantity_str_reprF  s
    rk  c                   @   s(   e Zd Zedd Zdd Zdd ZdS )!TestQuantitySubclassAboveAndBelowc                 C   sP   G dd dt j}|| _tdtj|ftdd| _td|tjftdd| _d S )Nc                       s   e Zd Z fddZ  ZS )z>TestQuantitySubclassAboveAndBelow.setup_class.<locals>.MyArrayc                    s.   t  j}|d ur|| t|dr*|j| _d S )Nmy_attr)super__array_finalize__hasattrrm  )r   r   Zsuper_array_finalize	__class__r   r   ro  T  s
    
zQTestQuantitySubclassAboveAndBelow.setup_class.<locals>.MyArray.__array_finalize__)rN   rO   rP   ro  __classcell__r   r   rq  r   MyArrayS  s   rt  MyQuantity1r   )rm  MyQuantity22)	r-   ri   rt  rS   r   r   dictru  rv  )r   rt  r   r   r   setup_classQ  s    z-TestQuantitySubclassAboveAndBelow.setup_classc                 C   s|   |  dtj}t|| j sJ |jdks,J |jtju s<J | dtj}t|| jsZJ |jdkshJ |jtju sxJ d S Nr_   r   rw  )ru  r   r#   r   rm  r   rv  )r   mq1mq2r   r   r   
test_setupa  s    z,TestQuantitySubclassAboveAndBelow.test_setupc                 C   s   |  dtj}| |}t|| js(J t|| j r8J |jdksFJ |jtju sVJ | dtj}|  |}t|| j s~J t|| jrJ |jdksJ |jtju sJ d S rz  )ru  r   r#   rv  r   rm  r   )r   r{  Zmq12r|  Zmq21r   r   r   test_attr_propagationk  s    

z7TestQuantitySubclassAboveAndBelow.test_attr_propagationN)rN   rO   rP   classmethodry  r}  r~  r   r   r   r   rl  P  s   

rl  )Fri  rG   r0  rA   r  Z	fractionsr   r   Znumpyr-   Znumpy.testingr   r   r   Zastropy.utilsr   r   Zastropy.utils.exceptionsr   r	   Zastropyr
   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,  rL   r.  r/  r3  r6  r7  r8  r9  r:  r=  rF  rJ  rM  rN  rO  r]  r^  ra  rc  rk  rl  r   r   r   r   <module>   s|     -  WG U
		
0	,';	#
