
     i
                        d dl Zd dlmZmZ d dlZd dlZd dlmZ ddl	m
Z
 ej                            de
j        e
j        g          d             Zej                            dd	d
g          ej                            dg d          dd                        Zej                            dd	d
g          ej                            dd          ej                            d          dd                                    Zd ZdS )    N)assert_equalassert_almost_equal)Grid   )	datafilesinfilec                 l   t          |           }d}t          j        |          }d|d<   d|d<   t          |j        j        |           t          |j        j        |           t          |j        t          j        d                     t          |j        t          j	        g d                     d S )N   gư>   g    .      )g4@g      @g      $)
r   nponesr   gridflatsizedeltaoriginarray)r   gPOINTSrefs       `/srv/www/vhosts/g4struct/public_html/venv/lib/python3.11/site-packages/gridData/tests/test_dx.pytest_read_dxr      s    VAF
'&//CCFCFc"""f%%%"'!**%%%28$4$4$45566666    outfilegrid.dxz
grid.dx.gzznptype,dxtype))float16float)float32r   )float64double)int64int)int32r$   )uint32unsigned int)uint64r'   )int16short)uint16zunsigned short)int8zsigned byte)uint8byted   r   c                    t          j        t           j                            ||f          d          \  }}t          ||          }|j                            |          |_        t          |j                                        |           |                                 5  |	                    |           t          |          }	t          j                            d          }
|
                    |           |
j        d         }|j        }d d d            n# 1 swxY w Y   t!          |j        |	j        d           t!          |j        |	j        dd	           t          ||           d S )
N
   binsr   dataz$written grid does not match original)err_msg   ,deltas of written grid do not match originaldecimalr5   )r   histogramddrandomr   r   astyper   sumas_cwdexportgridDataOpenDXfieldread
componentstyper   r   )tmpdirnptypedxtyper   countsndimhedgesr   g2dxr4   
out_dxtypes                r   test_write_dxrP      s   " ~bi..~>>RHHHHAuQA V]]6""AFv&&&	  	']] _""1%%
}V$Y
                FH H H H	>@ @ @ @
 V$$$$$s   #A-DD #D rG   )	complex64
complex128bool_zignore:array dtype.name =c                    t          j        t           j                            ||f          d          \  }}t          ||          }|j                            |          |_        t          j        t                    5  | 	                                5  |
                    |           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nr1   r2   )r   r:   r;   r   r   r<   pytestraises
ValueErrorr>   r?   )rF   rG   r   rI   rJ   rK   rL   r   s           r   test_write_dx_ValueErrorrX   C   s=    ~bi..~>>RHHHHAuQA V]]6""AF	z	"	"  ]]__ 	 	HHW	 	 	 	 	 	 	 	 	 	 	 	 	 	 	                 s6   CB8,C8B<	<C?B<	 CCCc                 N   t          t          j                  }t          j        g d          dz  |_        |                                 5  |                    d           t          d          }ddd           n# 1 swxY w Y   t          |j        |j        dd           dS )zATest if the delta has been written to the 7th significant figure.)Z   rZ      i  r   N   r7   r8   )	r   r   DXr   r   r   r>   r?   r   )rF   r   rM   s      r   test_delta_precisionr^   R   s    Y\Ah}}}%%+AG	  	)__               	>@ @ @ @ @ @s   %A==BB)r/   r   )numpyr   numpy.testingr   r   rU   gridData.OpenDXr@   r    r   markparametrizer]   DXGZr   rP   filterwarningsrX   r^    r   r   <module>rh      s       ; ; ; ; ; ; ; ;                 IL).#ABB	7 	7 CB	7 Y$=>> + + +  % % %  ?>%< Y$=>>#GHH788	 	 	 98 IH ?>	
@ 
@ 
@ 
@ 
@r   