Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion hyperion/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from __future__ import print_function, division

from .version import __version__
8 changes: 4 additions & 4 deletions hyperion/conf/conf_files.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from __future__ import print_function, division

import warnings
import numpy as np
from astropy import log as logger
import six
import logging

from ..util.functions import FreezableClass, bool2str, str2bool, is_numpy_array
from ..filter import Filter

logger = logging.getLogger(__name__)


class OutputConf(FreezableClass):

Expand Down Expand Up @@ -89,7 +89,7 @@ def set_propagation_check_frequency(self, frequency):
How often the photon position and cell should be double-checked (1
is always, 0 is never).
'''
if not np.isscalar(frequency) or isinstance(frequency, six.string_types):
if not np.isscalar(frequency) or isinstance(frequency, str):
raise TypeError("frequency should be a scalar value")
if frequency < 0. or frequency > 1.:
raise ValueError("frequency should be between 0 and 1")
Expand Down
1 change: 0 additions & 1 deletion hyperion/conf/tests/test_conf_io.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Test that parameters are preserved when written out and read in again

from __future__ import print_function, division

from itertools import product

Expand Down
8 changes: 4 additions & 4 deletions hyperion/densities/alpha_disk.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from __future__ import print_function, division

import numpy as np
from astropy import log as logger
import six
import logging

from ..dust import SphericalDust
from ..util.constants import pi, G
Expand All @@ -12,6 +10,8 @@

from .core import Disk

logger = logging.getLogger(__name__)


class AlphaDisk(Disk):
r'''
Expand Down Expand Up @@ -350,7 +350,7 @@ def dust(self):

@dust.setter
def dust(self, value):
if isinstance(value, six.string_types):
if isinstance(value, str):
self._dust = SphericalDust(value)
else:
self._dust = value
Expand Down
4 changes: 1 addition & 3 deletions hyperion/densities/ambient_medium.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from __future__ import print_function, division

import numpy as np
import six

from ..dust import SphericalDust
from ..grid import SphericalPolarGrid
Expand Down Expand Up @@ -128,7 +126,7 @@ def subtract(self, value):

@dust.setter
def dust(self, value):
if isinstance(value, six.string_types):
if isinstance(value, str):
self._dust = SphericalDust(value)
else:
self._dust = value
Expand Down
8 changes: 4 additions & 4 deletions hyperion/densities/bipolar_cavity.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from __future__ import print_function, division

import numpy as np
from astropy import log as logger
import six
import logging

from ..util.functions import FreezableClass
from ..dust import SphericalDust
Expand All @@ -11,6 +9,8 @@

from .core import Envelope, Density

logger = logging.getLogger(__name__)


class BipolarCavity(Density):
r'''
Expand Down Expand Up @@ -132,7 +132,7 @@ def dust(self):

@dust.setter
def dust(self, value):
if isinstance(value, six.string_types):
if isinstance(value, str):
self._dust = SphericalDust(value)
else:
self._dust = value
Expand Down
1 change: 0 additions & 1 deletion hyperion/densities/core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function, division

from ..util.functions import FreezableClass

Expand Down
8 changes: 4 additions & 4 deletions hyperion/densities/flared_disk.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from __future__ import print_function, division

import numpy as np
from astropy import log as logger
import six
import logging

from ..dust import SphericalDust
from ..util.constants import pi
Expand All @@ -12,6 +10,8 @@

from .core import Disk

logger = logging.getLogger(__name__)


class FlaredDisk(Disk):
r'''
Expand Down Expand Up @@ -248,7 +248,7 @@ def dust(self):

@dust.setter
def dust(self, value):
if isinstance(value, six.string_types):
if isinstance(value, str):
self._dust = SphericalDust(value)
else:
self._dust = value
Expand Down
8 changes: 4 additions & 4 deletions hyperion/densities/power_law_envelope.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from __future__ import print_function, division

import numpy as np
from astropy import log as logger
import six
import logging

from ..dust import SphericalDust
from ..grid import SphericalPolarGrid, CylindricalPolarGrid
Expand All @@ -14,6 +12,8 @@
from .core import Envelope
from .bipolar_cavity import BipolarCavity

logger = logging.getLogger(__name__)


class PowerLawEnvelope(Envelope):
r'''
Expand Down Expand Up @@ -175,7 +175,7 @@ def dust(self):

@dust.setter
def dust(self, value):
if isinstance(value, six.string_types):
if isinstance(value, str):
self._dust = SphericalDust(value)
else:
self._dust = value
Expand Down
1 change: 0 additions & 1 deletion hyperion/densities/tests/test_densities.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function, division

import pytest
import numpy as np
Expand Down
8 changes: 4 additions & 4 deletions hyperion/densities/ulrich_envelope.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from __future__ import print_function, division

import numpy as np
from astropy import log as logger
import six
import logging

from ..dust import SphericalDust
from ..grid import SphericalPolarGrid, CylindricalPolarGrid
Expand All @@ -14,6 +12,8 @@
from .core import Envelope
from .bipolar_cavity import BipolarCavity

logger = logging.getLogger(__name__)


def delta_neg(r, q):

Expand Down Expand Up @@ -294,7 +294,7 @@ def dust(self):

@dust.setter
def dust(self, value):
if isinstance(value, six.string_types):
if isinstance(value, str):
self._dust = SphericalDust(value)
else:
self._dust = value
Expand Down
10 changes: 5 additions & 5 deletions hyperion/dust/dust_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
#
##############################################################################

from __future__ import print_function, division

import os
import hashlib

import h5py
import numpy as np
from astropy import log as logger
import six
import logging

from ..version import __version__

Expand All @@ -31,6 +29,8 @@
from .emissivities import Emissivities
from .mean_opacities import MeanOpacities

logger = logging.getLogger(__name__)


def henyey_greenstein(mu, g, p_lin_max):
P1 = (1. - g * g) / (1. + g * g - 2. * g * mu) ** 1.5
Expand Down Expand Up @@ -264,7 +264,7 @@ def write(self, filename, compression=True):
self.emissivities.set_lte(self.optical_properties, self.mean_opacities)

# Create dust table set
if isinstance(filename, six.string_types):
if isinstance(filename, str):
dt = h5py.File(filename, 'w')
else:
dt = filename
Expand Down Expand Up @@ -305,7 +305,7 @@ def read(self, filename):

from ..util.functions import asstr

if isinstance(filename, six.string_types):
if isinstance(filename, str):

# Check file exists
if not os.path.exists(filename):
Expand Down
5 changes: 3 additions & 2 deletions hyperion/dust/emissivities.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function, division

import hashlib

Expand All @@ -9,7 +8,9 @@
from ..util.interpolate import interp1d_fast_loglog
from ..util.functions import (B_nu, FreezableClass, nu_common,
planck_nu_range, bool2str, is_numpy_array, monotonically_increasing)
from astropy import log as logger
import logging

logger = logging.getLogger(__name__)


class Emissivities(FreezableClass):
Expand Down
5 changes: 3 additions & 2 deletions hyperion/dust/mean_opacities.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
from __future__ import print_function, division

import hashlib

import numpy as np
from astropy.table import Table, Column
from astropy import log as logger
import logging

from ..util.integrate import integrate_loglog
from ..util.interpolate import interp1d_fast_loglog
from ..util.functions import FreezableClass, nu_common, B_nu, dB_nu_dT, planck_nu_range
from ..util.constants import sigma

logger = logging.getLogger(__name__)


class MeanOpacities(FreezableClass):

Expand Down
5 changes: 3 additions & 2 deletions hyperion/dust/optical_properties.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function, division

import hashlib

Expand All @@ -11,7 +10,9 @@
from ..util.functions import (extrap1d_log10, FreezableClass,
is_numpy_array, monotonically_increasing)
from ..util.constants import c, sigma
from astropy import log as logger
import logging

logger = logging.getLogger(__name__)


class OpticalProperties(FreezableClass):
Expand Down
1 change: 0 additions & 1 deletion hyperion/dust/tests/test_emissivities.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function, division

import matplotlib.pyplot as plt

Expand Down
1 change: 0 additions & 1 deletion hyperion/dust/tests/test_mean_opacities.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function, division

import matplotlib.pyplot as plt

Expand Down
1 change: 0 additions & 1 deletion hyperion/dust/tests/test_optical_properties.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function, division

import matplotlib.pyplot as plt

Expand Down
4 changes: 1 addition & 3 deletions hyperion/filter/filter.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from __future__ import print_function, division

import numpy as np

import six
from astropy import units as u

from ..util.integrate import integrate
Expand Down Expand Up @@ -46,7 +44,7 @@ def name(self):

@name.setter
def name(self, value):
if value is None or isinstance(value, six.string_types):
if value is None or isinstance(value, str):
self._name = value
else:
raise TypeError("name should be given as a string")
Expand Down
5 changes: 3 additions & 2 deletions hyperion/grid/amr_grid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function, division

import os
import posixpath
Expand All @@ -11,9 +10,11 @@

from ..util.meshgrid import meshgrid_nd
from ..util.functions import FreezableClass, link_or_copy, as_str
from astropy import log as logger
import logging
from .grid_helpers import single_grid_dims

logger = logging.getLogger(__name__)


def zero_density(amr_grid, xmin=-np.inf, xmax=np.inf, ymin=-np.inf, ymax=np.inf, zmin=-np.inf, zmax=np.inf):
for level in amr_grid.levels:
Expand Down
5 changes: 3 additions & 2 deletions hyperion/grid/cartesian_grid.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
from __future__ import print_function, division

import hashlib
from copy import deepcopy

import h5py
import numpy as np
from astropy import log as logger
import logging

from ..util.meshgrid import meshgrid_nd
from ..util.functions import FreezableClass, is_numpy_array, monotonically_increasing, link_or_copy, as_str
from .grid_helpers import single_grid_dims

logger = logging.getLogger(__name__)


class CartesianGrid(FreezableClass):
'''
Expand Down
5 changes: 3 additions & 2 deletions hyperion/grid/cylindrical_polar_grid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function, division

import hashlib
from copy import deepcopy
Expand All @@ -8,9 +7,11 @@

from ..util.meshgrid import meshgrid_nd
from ..util.functions import FreezableClass, is_numpy_array, monotonically_increasing, link_or_copy, as_str
from astropy import log as logger
import logging
from .grid_helpers import single_grid_dims

logger = logging.getLogger(__name__)


class CylindricalPolarGrid(FreezableClass):
'''
Expand Down
Loading
Loading