Ñò
ÇKc           @   sZ   d  d k  Z  d  d k Z e  i d ƒ d  d k Td d d d d „ Z d „  Z d	 „  Z d S(
   iÿÿÿÿNt   Agg(   t   *t    i    t   rectc   
      C   s²  t  d d ƒ | d j o t |  ƒ } n |  } t | ƒ } | d j o" t | d | d | d d	 ƒ} n t | d | d d	 ƒ} | d j o| t d
 d t |  d ƒ ƒ t d d t |  ƒ ƒ t d d t |  d ƒ d
 g d ƒ t d d t |  ƒ d
 g d ƒ n? t d
 t |  d ƒ d
 g d ƒ t d t |  ƒ d
 g d ƒ | i	 d ƒ t | ƒ d j o t
 | d d ƒn t d d d t ƒ }	 t | d d d ƒt ƒ  d  S(   Nt   figsizei   i   t   hexi    t   vmint   vmaxt
   edgecolorst   Nonei   R   t   fontsizei	   t   orientationt   verticalt	   drawedgess   .pngt   dpiiú   (   i   i   (   R   R   (   R   R   (   R   R   (   R   R   (   t   figuret   convertHexToRectt   arrayt   pcolort   xlimt   lent   ylimt   xtickst   ytickst   set_linewidtht   titlet   colorbart   Falset   savefigt   show(
   t   regArrayt
   fileprefixt   figTitlet   minValt   maxValt   gridt   theArrayt   Zt   Ct   D(    (    s@   /woldlab/castor/data00/home/georgi/commoncode/SOM/mapGraphics.pyt
   saveMapPNG   s*    "%%!c         C   s&   |  | | } | | | } | | f S(   N(    (   t   xorigt   yorigt   dxt   dyt   xmaxt   ymaxt   newxt   newy(    (    s@   /woldlab/castor/data00/home/georgi/commoncode/SOM/mapGraphics.pyt   coordTranslate!   s    c         C   s+  g  } t  |  ƒ } t  |  d ƒ } | d d } xô t | ƒ D]æ } d g | } d g | } | d d j o
 d } n d } xˆ t d d | d ƒ D]p }	 |	 d }
 |  | |
 | | |	 <|  | |
 | | |	 d <|  | |
 | | |	 <|  | |
 | | |	 d <q• W| i | ƒ | i | ƒ q= W| S(   Ni    i   i   g        (   R   t   ranget   append(   R$   t   newArrayt   numRowst   numColst   newColst   rowt   newrow1t   newrow2t   spacert   aColt   oCol(    (    s@   /woldlab/castor/data00/home/georgi/commoncode/SOM/mapGraphics.pyR   '   s*     
 
(   t
   matplotlibt   copyt   uset   pylabR(   R1   R   (    (    (    s@   /woldlab/castor/data00/home/georgi/commoncode/SOM/mapGraphics.pyt   <module>   s
   
	