예제 #1
0
import math as m
import scipy as sc
from scipy import special
from scipy import interpolate
from scipy import ndimage
import matplotlib
import matplotlib.pyplot as pyplot
import matplotlib.ticker as ticker
import matplotlib.cm as cm
from matplotlib import rc
from matplotlib.ticker import NullFormatter
from matplotlib.projections import PolarAxes, register_projection
from matplotlib.transforms import Affine2D, Bbox, IdentityTransform
from mpl_toolkits.mplot3d import Axes3D
from galpy.util.config import __config__
if __config__.getboolean('plot', 'seaborn-bovy-defaults'):
    try:
        import seaborn as sns
    except:
        pass
    else:
        sns.set_style(
            'ticks', {
                'xtick.direction': u'in',
                'ytick.direction': u'in',
                'axes.labelsize': 18.0,
                'axes.titlesize': 18.0,
                'figure.figsize': sc.array([6.64, 4.]),
                'grid.linewidth': 2.0,
                'legend.fontsize': 18.0,
                'lines.linewidth': 2.0,
예제 #2
0
###############################################################################
#
# bovy_conversion: utilities to convert from galpy 'natural units' to physical
#                  units
#
###############################################################################
from functools import wraps
import warnings
import copy
import math as m
from galpy.util import galpyWarning
from galpy.util.config import __config__
_APY_UNITS= __config__.getboolean('astropy','astropy-units')
_APY_LOADED= True
try:
    from astropy import units, constants
except ImportError:
    _APY_UNITS= False
    _APY_LOADED= False
    _G= 4.302*10.**-3. #pc / Msolar (km/s)^2
    _kmsInPcMyr= 1.0227121655399913
    _PCIN10p18CM= 3.08567758 #10^18 cm
    _CIN10p5KMS= 2.99792458 #10^5 km/s
    _MSOLAR10p30KG= 1.9891 #10^30 kg
    _EVIN10m19J= 1.60217657 #10^-19 J
else:
    _G= constants.G.to(units.pc/units.Msun*units.km**2/units.s**2).value
    _kmsInPcMyr= (units.km/units.s).to((units.pc/units.Myr))
    _PCIN10p18CM= units.pc.to(units.cm)/10.**18. #10^18 cm
    _CIN10p5KMS= constants.c.to((units.km/units.s)).value/10.**5. #10^5 km/s
    _MSOLAR10p30KG= units.Msun.to(units.kg)/10.**30. #10^30 kg
예제 #3
0
from __future__ import print_function
import os
import shutil
import warnings
import tempfile
import pickle
import numpy
import scipy.linalg as linalg
from galpy.util.config import __config__
_SHOW_WARNINGS = __config__.getboolean('warnings', 'verbose')


class galpyWarning(Warning):
    pass


# galpy warnings only shown if verbose = True in the configuration
class galpyWarningVerbose(galpyWarning):
    pass


def _warning(message,
             category=galpyWarning,
             filename='',
             lineno=-1,
             file=None,
             line=None):
    if issubclass(category, galpyWarning):
        if not issubclass(category, galpyWarningVerbose) or _SHOW_WARNINGS:
            print("galpyWarning: " + str(message))
    else:
예제 #4
0
파일: bovy_plot.py 프로젝트: iogiul/galpy
import math as m
import scipy as sc
from scipy import special
from scipy import interpolate
from scipy import ndimage
import matplotlib
import matplotlib.pyplot as pyplot
import matplotlib.ticker as ticker
import matplotlib.cm as cm
from matplotlib import rc
from matplotlib.ticker import NullFormatter
from matplotlib.projections import PolarAxes, register_projection
from matplotlib.transforms import Affine2D, Bbox, IdentityTransform
from mpl_toolkits.mplot3d import Axes3D
from galpy.util.config import __config__
if __config__.getboolean('plot','seaborn-bovy-defaults'):
    try:
        import seaborn as sns
    except: pass
    else:
        sns.set_style('ticks',
                      {'xtick.direction': u'in',
                       'ytick.direction': u'in',
                       'axes.labelsize': 18.0,
                       'axes.titlesize': 18.0,
                       'figure.figsize': sc.array([ 6.64,  4.  ]),
                       'grid.linewidth': 2.0,
                       'legend.fontsize': 18.0,
                       'lines.linewidth': 2.0,
                       'lines.markeredgewidth': 0.0,
                       'lines.markersize': 14.0,
예제 #5
0
파일: __init__.py 프로젝트: iogiul/galpy
from __future__ import print_function
import os
import shutil
import warnings
import tempfile
import pickle
import numpy
import scipy.linalg as linalg
from galpy.util.config import __config__
_SHOW_WARNINGS= __config__.getboolean('warnings','verbose')
class galpyWarning(Warning):
    pass
# galpy warnings only shown if verbose = True in the configuration
class galpyWarningVerbose(galpyWarning):
    pass
def _warning(
    message,
    category=galpyWarning,
    filename='',
    lineno=-1,
    file=None,
    line=None):
    if issubclass(category,galpyWarning):
        if not issubclass(category,galpyWarningVerbose) or _SHOW_WARNINGS:
            print("galpyWarning: "+str(message))
    else:
        print(warnings.formatwarning(message,category,filename,lineno))
warnings.showwarning = _warning
def save_pickles(savefilename,*args,**kwargs):
    """
    NAME: