# Path: ugali/utils/projector.py
# def celToGal(ra, dec):
#     """
#     Converts Celestial J2000 (deg) to Calactic (deg) coordinates
#     """
#     dec = np.radians(dec)
#     sin_dec = np.sin(dec)
#     cos_dec = np.cos(dec)
# 
#     ra = np.radians(ra)    
#     ra_gp = np.radians(192.85948)
#     de_gp = np.radians(27.12825)
# 
#     sin_ra_gp = np.sin(ra - ra_gp)
#     cos_ra_gp = np.cos(ra - ra_gp)
# 
#     lcp = np.radians(122.932)    
#     sin_b = (np.sin(de_gp) * sin_dec) \
#             + (np.cos(de_gp) * cos_dec * cos_ra_gp)
#     lcpml = np.arctan2(cos_dec * sin_ra_gp,
#                           (np.cos(de_gp) * sin_dec) \
#                           - (np.sin(de_gp) * cos_dec * cos_ra_gp))
#     bb = np.arcsin(sin_b)
#     ll = (lcp - lcpml + (2. * np.pi)) % (2. * np.pi)
#     return np.degrees(ll), np.degrees(bb)
# 
# Path: ugali/utils/logger.py
# class SpecialFormatter(logging.Formatter):
#     FORMATS = {'DEFAULT'       : "%(message)s",
#                logging.WARNING : "WARNING: %(message)s",
#                logging.ERROR   : "ERROR: %(message)s"}
#     def format(self, record):
# def file_found(filename,force):


import healpy
import pylab as plt
import numpy
import ugali.utils.skymap
from ugali.utils.projector import celToGal
from ugali.utils.logger import logger
    from optparse import OptionParser
#!/usr/bin/env python


default_kwargs = dict( xytext=(5,5),textcoords='offset points',
                       ha="left",va="center",
                       color='w', size=8, weight='bold', 
                   )

TARGETS = dict(
bootes_I          = ["Boo I"   ,dict(default_kwargs,xytext=(2,7)),             ], 
bootes_II         = ["Boo II"  ,dict(default_kwargs,xytext=(5,0)),             ], 
bootes_III        = ["Boo III" ,dict(default_kwargs,xytext=(3,-8),ha='right'), ], 
canes_venatici_I  = ["CVn I"   ,dict(default_kwargs,xytext=(-3,-6),ha='right'),], 
canes_venatici_II = ["CVn II"  ,dict(default_kwargs,xytext=(-4,-2),ha='right'),], 
canis_major       = ["CMa"     ,default_kwargs,                                ], 
carina            = ["Car"     ,default_kwargs,                                ], 
coma_berenices    = ["Com"     ,dict(default_kwargs,xytext=(5,-1)),            ], 
draco             = ["Dra"     ,default_kwargs,                                ], 
fornax            = ["For"     ,default_kwargs,                                ], 
hercules          = ["Her"     ,default_kwargs,                                ], 
leo_I             = ["Leo I"   ,dict(default_kwargs,xytext=(4,-3),ha='left'),  ], 
leo_II            = ["Leo II"  ,dict(default_kwargs,xytext=(-4,0),ha='right'), ], 
leo_IV            = ["Leo IV"  ,dict(default_kwargs,xytext=(5,-1),ha='left'),  ], 
leo_T             = ["Leo T"   ,dict(default_kwargs,xytext=(4,5),ha='left'),   ], 
leo_V             = ["Leo V"   ,dict(default_kwargs,xytext=(4,5),ha='left'),   ], 
lmc               = ["LMC"     ,default_kwargs,                                ], 

# Path: ugali/utils/projector.py
# def celToGal(ra, dec):
#     """
#     Converts Celestial J2000 (deg) to Calactic (deg) coordinates
#     """
#     dec = np.radians(dec)
#     sin_dec = np.sin(dec)
#     cos_dec = np.cos(dec)
# 
#     ra = np.radians(ra)    
#     ra_gp = np.radians(192.85948)
#     de_gp = np.radians(27.12825)
# 
#     sin_ra_gp = np.sin(ra - ra_gp)
#     cos_ra_gp = np.cos(ra - ra_gp)
# 
#     lcp = np.radians(122.932)    
#     sin_b = (np.sin(de_gp) * sin_dec) \
#             + (np.cos(de_gp) * cos_dec * cos_ra_gp)
#     lcpml = np.arctan2(cos_dec * sin_ra_gp,
#                           (np.cos(de_gp) * sin_dec) \
#                           - (np.sin(de_gp) * cos_dec * cos_ra_gp))
#     bb = np.arcsin(sin_b)
#     ll = (lcp - lcpml + (2. * np.pi)) % (2. * np.pi)
#     return np.degrees(ll), np.degrees(bb)
# 
# Path: ugali/utils/logger.py
# class SpecialFormatter(logging.Formatter):
#     FORMATS = {'DEFAULT'       : "%(message)s",
#                logging.WARNING : "WARNING: %(message)s",
#                logging.ERROR   : "ERROR: %(message)s"}
#     def format(self, record):
# def file_found(filename,force):


# Path: ugali/scratch/PlotAllSkyHealpix.py
import healpy
import pylab as plt
import numpy
import ugali.utils.skymap
from ugali.utils.projector import celToGal
from ugali.utils.logger import logger
    from optparse import OptionParser

#!/usr/bin/env python


default_kwargs = dict( xytext=(5,5),textcoords='offset points',
                       ha="left",va="center",
                       color='w', size=8, weight='bold', 
                   )

TARGETS = dict(
bootes_I          = ["Boo I"   ,dict(default_kwargs,xytext=(2,7)),             ], 
bootes_II         = ["Boo II"  ,dict(default_kwargs,xytext=(5,0)),             ], 
bootes_III        = ["Boo III" ,dict(default_kwargs,xytext=(3,-8),ha='right'), ], 
canes_venatici_I  = ["CVn I"   ,dict(default_kwargs,xytext=(-3,-6),ha='right'),], 
canes_venatici_II = ["CVn II"  ,dict(default_kwargs,xytext=(-4,-2),ha='right'),], 
canis_major       = ["CMa"     ,default_kwargs,                                ], 
carina            = ["Car"     ,default_kwargs,                                ], 
coma_berenices    = ["Com"     ,dict(default_kwargs,xytext=(5,-1)),            ], 
draco             = ["Dra"     ,default_kwargs,                                ], 
fornax            = ["For"     ,default_kwargs,                                ], 
hercules          = ["Her"     ,default_kwargs,                                ], 
leo_I             = ["Leo I"   ,dict(default_kwargs,xytext=(4,-3),ha='left'),  ], 
leo_II            = ["Leo II"  ,dict(default_kwargs,xytext=(-4,0),ha='right'), ], 
leo_IV            = ["Leo IV"  ,dict(default_kwargs,xytext=(5,-1),ha='left'),  ], 
leo_T             = ["Leo T"   ,dict(default_kwargs,xytext=(4,5),ha='left'),   ], 
leo_V             = ["Leo V"   ,dict(default_kwargs,xytext=(4,5),ha='left'),   ], 
lmc               = ["LMC"     ,default_kwargs,                                ], 

pisces_II         = ["Psc II"  ,default_kwargs,                                ], 