Skip to content

Commit

Permalink
Minor changes to imports to standardize order (stdlib, external [nump…
Browse files Browse the repository at this point in the history
…y,scipy], internal) as much as possible
  • Loading branch information
jobovy committed Nov 22, 2019
1 parent e9736b1 commit 1ebc3f9
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion galpy/actionAngle/actionAngleIsochroneApprox.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
###############################################################################
import warnings
import numpy
import numpy.linalg as linalg
from numpy import linalg
from scipy import optimize
from ..potential import dvcircdR, vcirc, _isNonAxi
from ..potential.Potential import flatten as flatten_potential
Expand Down
2 changes: 1 addition & 1 deletion galpy/df/df.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from ..util import config
_APY_LOADED= True
try:
from astropy import units
except ImportError:
_APY_LOADED= False
from ..util import config
class df(object):
"""Top-level class for DF classes"""
def __init__(self,ro=None,vo=None):
Expand Down
5 changes: 1 addition & 4 deletions galpy/df/diskdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
import numpy
import scipy
numpy.log= scipy.log # somehow, this code produces log(negative), which scipy implements as log(|negative|) + i pi while numpy gives NaN and we want the scipy behavior; not sure where the log(negative) comes from though! I think it's for sigma=0 DFs (this test fails with numpy.log) where the DF eval has a log(~zero) that can be slightly negative because of numerical precision issues
import scipy.integrate as integrate
import scipy.interpolate as interpolate
from scipy import stats
from scipy import optimize
from scipy import integrate, interpolate, stats, optimize
from .surfaceSigmaProfile import surfaceSigmaProfile, expSurfaceSigmaProfile
from ..orbit import Orbit
from ..util.bovy_ars import bovy_ars
Expand Down
4 changes: 2 additions & 2 deletions galpy/df/streamdf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#The DF of a tidal stream
import copy
import numpy
import multiprocessing
import warnings
import numpy
import scipy
from scipy import special, interpolate, integrate, optimize
_SCIPY_VERSION= [int(v.split('rc')[0])
Expand All @@ -19,7 +20,6 @@
from ..util.bovy_conversion import physical_conversion, _APY_UNITS
from ..actionAngle.actionAngleIsochroneApprox import dePeriod
from ..potential import flatten as flatten_potential
import warnings
from ..util import galpyWarning
if _APY_LOADED:
from astropy import units
Expand Down
2 changes: 1 addition & 1 deletion galpy/df/streamgapdf.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# The DF of a gap in a tidal stream
from functools import wraps
import copy
import numpy
import warnings
import multiprocessing
import numpy
from scipy import integrate, interpolate, special
from ..util import galpyWarning, bovy_coords, multi, bovy_conversion
from ..util import _rotate_to_arbitrary_vector
Expand Down
2 changes: 1 addition & 1 deletion galpy/potential/EllipsoidalPotential.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# with m^2 = x^2+y^2/b^2+z^2/c^2
#
###############################################################################
import numpy
import hashlib
import numpy
from scipy import integrate
from ..util import bovy_coords
from ..util import _rotate_to_arbitrary_vector
Expand Down
2 changes: 1 addition & 1 deletion galpy/potential/MN3ExponentialDiskPotential.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# exponential disk potential of Smith et al.
# 2015
###############################################################################
import numpy
import warnings
import numpy
from ..util import galpyWarning
from .Potential import Potential, kms_to_kpcGyrDecorator, _APY_LOADED
if _APY_LOADED:
Expand Down
2 changes: 1 addition & 1 deletion galpy/potential/PowerSphericalPotentialwCutoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# r^\alpha
###############################################################################
import numpy
from scipy import special, integrate
from scipy import special
from .Potential import Potential, kms_to_kpcGyrDecorator, \
_APY_LOADED
if _APY_LOADED:
Expand Down
5 changes: 0 additions & 5 deletions galpy/potential/SpiralArmsPotential.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,12 @@
#
# Phi(r, phi, z) = -4*pi*G*H*rho0*exp(-(r-r0)/Rs)*sum(Cn/(Kn*Dn)*cos(n*gamma)*sech(Kn*z/Bn)^Bn)
###############################################################################

from __future__ import division
from .Potential import Potential, _APY_LOADED
from ..util import bovy_conversion
import numpy

if _APY_LOADED:
from astropy import units



class SpiralArmsPotential(Potential):
"""Class that implements the spiral arms potential from (`Cox and Gomez 2002 <https://arxiv.org/abs/astro-ph/0207635>`__). Should be used to modulate an existing potential (density is positive in the arms, negative outside).
Expand Down

0 comments on commit 1ebc3f9

Please sign in to comment.