[yt-svn] commit/yt: 2 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Aug 6 09:19:08 PDT 2015
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/32dfcda177e7/
Changeset: 32dfcda177e7
Branch: yt
User: cosmosquark
Date: 2015-07-30 18:01:52+00:00
Summary: fixing a bug where particle_velocity_cylindrical_radius is being registered as particle_velocity_spherical_radius
Affected #: 1 file
diff -r b35ac81530d482ef95fd62caec0c018207a41b47 -r 32dfcda177e7d392bc6e336973b37d299aca3844 yt/fields/particle_fields.py
--- a/yt/fields/particle_fields.py
+++ b/yt/fields/particle_fields.py
@@ -669,7 +669,7 @@
registry.add_field(
(ptype, "particle_velocity_cylindrical_radius"),
- function=_particle_velocity_spherical_radius,
+ function=_particle_velocity_cylindrical_radius,
particle_type=True,
units="cm/s",
validators=[ValidateParameter("normal"), ValidateParameter("center")])
https://bitbucket.org/yt_analysis/yt/commits/15e0883da341/
Changeset: 15e0883da341
Branch: yt
User: ngoldbaum
Date: 2015-08-06 16:18:56+00:00
Summary: Merging Ben Thomson's bugfix for the cylindrical theta field
Affected #: 17 files
diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 15e0883da341774c22c9ee83a71b5261c2ead8b3 doc/install_script.sh
--- a/doc/install_script.sh
+++ b/doc/install_script.sh
@@ -47,7 +47,6 @@
# lead to broken mercurial installations.
INST_PNG=1 # Install a local libpng? Same things apply as with zlib.
INST_FTYPE=1 # Install FreeType2 locally?
-INST_ENZO=0 # Clone a copy of Enzo?
INST_SQLITE3=1 # Install a local version of SQLite3?
INST_PYX=0 # Install PyX? Sometimes PyX can be problematic without a
# working TeX installation.
@@ -109,7 +108,6 @@
echo INST_BZLIB=${INST_BZLIB} >> ${CONFIG_FILE}
echo INST_PNG=${INST_PNG} >> ${CONFIG_FILE}
echo INST_FTYPE=${INST_FTYPE} >> ${CONFIG_FILE}
- echo INST_ENZO=${INST_ENZO} >> ${CONFIG_FILE}
echo INST_SQLITE3=${INST_SQLITE3} >> ${CONFIG_FILE}
echo INST_PYX=${INST_PYX} >> ${CONFIG_FILE}
echo INST_0MQ=${INST_0MQ} >> ${CONFIG_FILE}
@@ -426,10 +424,6 @@
get_willwont ${INST_HG}
echo "be installing Mercurial"
-printf "%-15s = %s so I " "INST_ENZO" "${INST_ENZO}"
-get_willwont ${INST_ENZO}
-echo "be checking out Enzo"
-
printf "%-15s = %s so I " "INST_PYX" "${INST_PYX}"
get_willwont ${INST_PYX}
echo "be installing PyX"
@@ -1047,14 +1041,6 @@
fi
fi
-if [ $INST_ENZO -eq 1 ]
-then
- echo "Cloning a copy of Enzo."
- cd ${DEST_DIR}/src/
- ${HG_EXEC} clone https://bitbucket.org/enzo/enzo-stable ./enzo-hg-stable
- cd $MY_PWD
-fi
-
if [ -e $HOME/.matplotlib/fontList.cache ] && \
( grep -q python2.6 $HOME/.matplotlib/fontList.cache )
then
@@ -1106,16 +1092,6 @@
echo "$DEST_DIR/bin/hg"
echo
fi
- if [ $INST_ENZO -eq 1 ]
- then
- echo "Enzo has also been checked out, but not built."
- echo
- echo "$DEST_DIR/src/enzo-hg-stable"
- echo
- echo "The value of YT_DEST can be used as an HDF5 installation location."
- echo "Questions about Enzo should be directed to the Enzo User List."
- echo
- fi
echo
echo "For support, see the website and join the mailing list:"
echo
diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 15e0883da341774c22c9ee83a71b5261c2ead8b3 doc/source/cookbook/tests/test_cookbook.py
--- a/doc/source/cookbook/tests/test_cookbook.py
+++ b/doc/source/cookbook/tests/test_cookbook.py
@@ -34,7 +34,7 @@
try:
subprocess.check_call(cmd)
result = True
- except subprocess.CalledProcessError, e:
+ except subprocess.CalledProcessError as e:
print(("Stdout output:\n", e.output))
result = False
assert result
diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 15e0883da341774c22c9ee83a71b5261c2ead8b3 doc/source/reference/command-line.rst
--- a/doc/source/reference/command-line.rst
+++ b/doc/source/reference/command-line.rst
@@ -42,9 +42,9 @@
~~~~~~~~~~~~~~~~~~~~~~
The :code:`yt` command-line tool allows you to access some of yt's basic
-funcionality without opening a python interpreter. The tools is a collection of
+functionality without opening a python interpreter. The tools is a collection of
subcommands. These can quickly making plots of slices and projections through a
-dataset, updating yt's codebase, print basic statistics about a dataset, laucnh
+dataset, updating yt's codebase, print basic statistics about a dataset, launch
an IPython notebook session, and more. To get a quick list of what is
available, just type:
diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 15e0883da341774c22c9ee83a71b5261c2ead8b3 doc/source/reference/python_introduction.rst
--- a/doc/source/reference/python_introduction.rst
+++ b/doc/source/reference/python_introduction.rst
@@ -34,7 +34,7 @@
called on it. ``dir()`` will return the available commands and objects that
can be directly called, and ``dir(something)`` will return information about
all the commands that ``something`` provides. This probably sounds a bit
-opaque, but it will become clearer with time -- it's also probably heldsul to
+opaque, but it will become clearer with time -- it's also probably helpful to
call ``help`` on any or all of the objects we create during this orientation.
To start up Python, at your prompt simply type:
diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 15e0883da341774c22c9ee83a71b5261c2ead8b3 setup.py
--- a/setup.py
+++ b/setup.py
@@ -114,7 +114,7 @@
# End snippet
######
-VERSION = "3.3-dev"
+VERSION = "3.3.dev0"
if os.path.exists('MANIFEST'):
os.remove('MANIFEST')
diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 15e0883da341774c22c9ee83a71b5261c2ead8b3 yt/frontends/art/data_structures.py
--- a/yt/frontends/art/data_structures.py
+++ b/yt/frontends/art/data_structures.py
@@ -28,10 +28,7 @@
OctreeSubset
from yt.geometry.oct_container import \
ARTOctreeContainer
-from .fields import \
- ARTFieldInfo
-from yt.utilities.definitions import \
- mpc_conversion
+from .fields import ARTFieldInfo
from yt.utilities.io_handler import \
io_registry
from yt.utilities.lib.misc_utilities import \
@@ -50,14 +47,10 @@
from .io import b2t
from .io import a2b
-from yt.utilities.definitions import \
- mpc_conversion, sec_conversion
from yt.utilities.io_handler import \
io_registry
from yt.fields.field_info_container import \
FieldInfoContainer, NullFunc
-from yt.utilities.physical_constants import \
- mass_hydrogen_cgs, sec_per_Gyr
class ARTIndex(OctreeIndex):
@@ -300,6 +293,7 @@
self.iOctFree, self.nOct = fpu.read_vector(f, 'i', '>')
self.child_grid_offset = f.tell()
self.parameters.update(amr_header_vals)
+ amr_header_vals = None
# estimate the root level
float_center, fl, iocts, nocts, root_level = _read_art_level_info(
f,
@@ -347,18 +341,18 @@
# setup standard simulation params yt expects to see
self.current_redshift = self.parameters["aexpn"]**-1.0 - 1.0
- self.omega_lambda = amr_header_vals['Oml0']
- self.omega_matter = amr_header_vals['Om0']
- self.hubble_constant = amr_header_vals['hubble']
- self.min_level = amr_header_vals['min_level']
- self.max_level = amr_header_vals['max_level']
+ self.omega_lambda = self.parameters['Oml0']
+ self.omega_matter = self.parameters['Om0']
+ self.hubble_constant = self.parameters['hubble']
+ self.min_level = self.parameters['min_level']
+ self.max_level = self.parameters['max_level']
if self.limit_level is not None:
self.max_level = min(
- self.limit_level, amr_header_vals['max_level'])
+ self.limit_level, self.parameters['max_level'])
if self.force_max_level is not None:
self.max_level = self.force_max_level
self.hubble_time = 1.0/(self.hubble_constant*100/3.08568025e19)
- self.current_time = b2t(self.parameters['t']) * sec_per_Gyr
+ self.current_time = self.quan(b2t(self.parameters['t']), 'Gyr')
self.gamma = self.parameters["gamma"]
mylog.info("Max level is %02i", self.max_level)
@@ -600,7 +594,7 @@
# self.max_level = self.force_max_level
self.hubble_time = 1.0/(self.hubble_constant*100/3.08568025e19)
self.parameters['t'] = a2b(self.parameters['aexpn'])
- self.current_time = b2t(self.parameters['t']) * sec_per_Gyr
+ self.current_time = self.quan(b2t(self.parameters['t']), 'Gyr')
self.gamma = self.parameters["gamma"]
mylog.info("Max level is %02i", self.max_level)
diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 15e0883da341774c22c9ee83a71b5261c2ead8b3 yt/frontends/art/definitions.py
--- a/yt/frontends/art/definitions.py
+++ b/yt/frontends/art/definitions.py
@@ -110,7 +110,7 @@
]
star_struct = [
- ('>d', ('tdum', 'adum')),
+ ('>d', ('t_stars', 'a_stars')),
('>i', 'nstars'),
('>d', ('ws_old', 'ws_oldi')),
('>f', 'particle_mass'),
diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 15e0883da341774c22c9ee83a71b5261c2ead8b3 yt/frontends/art/fields.py
--- a/yt/frontends/art/fields.py
+++ b/yt/frontends/art/fields.py
@@ -55,7 +55,7 @@
("particle_mass", ("code_mass", [], None)),
("particle_index", ("", [], None)),
("particle_species", ("", ["particle_type"], None)),
- ("particle_creation_time", ("code_time", [], None)),
+ ("particle_creation_time", ("Gyr", [], None)),
("particle_mass_initial", ("code_mass", [], None)),
("particle_metallicity1", ("", [], None)),
("particle_metallicity2", ("", [], None)),
diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 15e0883da341774c22c9ee83a71b5261c2ead8b3 yt/frontends/art/io.py
--- a/yt/frontends/art/io.py
+++ b/yt/frontends/art/io.py
@@ -31,6 +31,7 @@
from yt.utilities.physical_constants import sec_per_year
from yt.utilities.lib.geometry_utils import compute_morton
from yt.geometry.oct_container import _ORDER_MAX
+from yt.units.yt_array import YTQuantity
class IOHandlerART(BaseIOHandler):
@@ -300,18 +301,19 @@
def interpolate_ages(data, file_stars, interp_tb=None, interp_ages=None,
current_time=None):
if interp_tb is None:
- tdum, adum = read_star_field(file_stars,
- field="tdum")
+ t_stars, a_stars = read_star_field(file_stars,
+ field="t_stars")
# timestamp of file should match amr timestamp
if current_time:
- tdiff = b2t(tdum)-current_time/(sec_per_year*1e9)
- if np.abs(tdiff) < 1e-4:
+ tdiff = YTQuantity(b2t(t_stars), 'Gyr') - current_time.in_units('Gyr')
+ if np.abs(tdiff) > 1e-4:
mylog.info("Timestamp mismatch in star " +
- "particle header")
+ "particle header: %s", tdiff)
mylog.info("Interpolating ages")
interp_tb, interp_ages = b2t(data)
+ interp_tb = YTArray(interp_tb, 'Gyr')
+ interp_ages = YTArray(interp_ages, 'Gyr')
temp = np.interp(data, interp_tb, interp_ages)
- temp *= 1.0e9*sec_per_year
return interp_tb, interp_ages, temp
diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 15e0883da341774c22c9ee83a71b5261c2ead8b3 yt/frontends/gadget/data_structures.py
--- a/yt/frontends/gadget/data_structures.py
+++ b/yt/frontends/gadget/data_structures.py
@@ -264,7 +264,11 @@
# or the byte swapped equivalents (65536 and 134217728).
# The int32 following the header (first 4+256 bytes) must equal this
# number.
- (rhead,) = struct.unpack('<I',f.read(4))
+ try:
+ (rhead,) = struct.unpack('<I',f.read(4))
+ except struct.error:
+ f.close()
+ return False, 1
# Use value to check endianess
if rhead == 256:
endianswap = '<'
diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 15e0883da341774c22c9ee83a71b5261c2ead8b3 yt/frontends/stream/tests/test_outputs.py
--- /dev/null
+++ b/yt/frontends/stream/tests/test_outputs.py
@@ -0,0 +1,45 @@
+"""
+Tests for loading in-memory datasets
+
+
+
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2013, yt Development Team.
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+#-----------------------------------------------------------------------------
+
+import os
+import shutil
+import tempfile
+import unittest
+
+from yt.testing import assert_raises
+from yt.utilities.answer_testing.framework import data_dir_load
+from yt.utilities.exceptions import YTOutputNotIdentified
+
+class TestEmptyLoad(unittest.TestCase):
+
+ def setUp(self):
+ self.tmpdir = tempfile.mkdtemp()
+ self.curdir = os.getcwd()
+ os.chdir(self.tmpdir)
+
+ # create 0 byte file
+ open("empty_file", "a")
+
+ # create empty directory
+ os.makedirs("empty_directory")
+
+ def tearDown(self):
+ os.chdir(self.curdir)
+ shutil.rmtree(self.tmpdir)
+
+ def test_load_empty_file(self):
+ assert_raises(YTOutputNotIdentified, data_dir_load, "not_a_file")
+ assert_raises(YTOutputNotIdentified, data_dir_load, "empty_file")
+ assert_raises(YTOutputNotIdentified, data_dir_load, "empty_directory")
diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 15e0883da341774c22c9ee83a71b5261c2ead8b3 yt/frontends/tipsy/data_structures.py
--- a/yt/frontends/tipsy/data_structures.py
+++ b/yt/frontends/tipsy/data_structures.py
@@ -255,7 +255,7 @@
f.seek(0, os.SEEK_SET)
#Read in the header
t, n, ndim, ng, nd, ns = struct.unpack("<diiiii", f.read(28))
- except IOError:
+ except (IOError, struct.error):
return False, 1
endianswap = "<"
#Check Endianness
diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 15e0883da341774c22c9ee83a71b5261c2ead8b3 yt/units/tests/test_ytarray.py
--- a/yt/units/tests/test_ytarray.py
+++ b/yt/units/tests/test_ytarray.py
@@ -631,7 +631,7 @@
# In-place copies do not drop units.
assert_true(hasattr(out, 'units'))
assert_true(not hasattr(ret, 'units'))
- elif ufunc in (np.absolute, np.conjugate, np.floor, np.ceil,
+ elif ufunc in (np.absolute, np.fabs, np.conjugate, np.floor, np.ceil,
np.trunc, np.negative):
ret = ufunc(a, out=out)
diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 15e0883da341774c22c9ee83a71b5261c2ead8b3 yt/units/yt_array.py
--- a/yt/units/yt_array.py
+++ b/yt/units/yt_array.py
@@ -26,7 +26,7 @@
greater, greater_equal, less, less_equal, not_equal, equal, logical_and, \
logical_or, logical_xor, logical_not, maximum, minimum, isreal, iscomplex, \
isfinite, isinf, isnan, signbit, copysign, nextafter, modf, frexp, \
- floor, ceil, trunc, fmax, fmin
+ floor, ceil, trunc, fmax, fmin, fabs
from yt.units.unit_object import Unit, UnitParseError
from yt.units.unit_registry import UnitRegistry
@@ -139,7 +139,7 @@
log10, expm1, log1p, sqrt, square, reciprocal, sin, cos, tan, arcsin,
arccos, arctan, sinh, cosh, tanh, arcsinh, arccosh, arctanh, deg2rad,
rad2deg, logical_not, isreal, iscomplex, isfinite, isinf, isnan,
- signbit, floor, ceil, trunc, modf, frexp,
+ signbit, floor, ceil, trunc, modf, frexp, fabs
)
binary_operators = (
@@ -223,6 +223,7 @@
mod: preserve_units,
fmod: preserve_units,
absolute: passthrough_unit,
+ fabs: passthrough_unit,
rint: return_without_unit,
sign: return_without_unit,
conj: passthrough_unit,
@@ -1072,7 +1073,8 @@
unit.base_value, out=out_arr)
unit = Unit(registry=unit.registry)
else:
- raise RuntimeError("Operation is not defined.")
+ raise RuntimeError("Support for the %s ufunc has not been added "
+ "to YTArray." % str(context[0]))
if unit is None:
out_arr = np.array(out_arr, copy=False)
return out_arr
diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 15e0883da341774c22c9ee83a71b5261c2ead8b3 yt/utilities/hierarchy_inspection.py
--- a/yt/utilities/hierarchy_inspection.py
+++ b/yt/utilities/hierarchy_inspection.py
@@ -32,6 +32,9 @@
counters = [Counter(mro) for mro in mros]
+ if len(counters) == 0:
+ return counters
+
count = reduce(lambda x, y: x + y, counters)
return [x for x in count.keys() if count[x] == 1]
diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 15e0883da341774c22c9ee83a71b5261c2ead8b3 yt/utilities/pyparselibconfig/libconfig.py
--- a/yt/utilities/pyparselibconfig/libconfig.py
+++ b/yt/utilities/pyparselibconfig/libconfig.py
@@ -1,9 +1,9 @@
from __future__ import print_function
#-----------------------------------------------------------------------------
-# Copyright (c) 2013, Samuel Skillman
+# Copyright (c) 2013, yt Development Team
#
-# Distributed under the terms of the MIT License.
+# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
diff -r 32dfcda177e7d392bc6e336973b37d299aca3844 -r 15e0883da341774c22c9ee83a71b5261c2ead8b3 yt/utilities/quantities.py
--- a/yt/utilities/quantities.py
+++ /dev/null
@@ -1,54 +0,0 @@
-"""
-Quantities -- floats with units.
-
-Author: Casey W. Stark <caseywstark at gmail.com>
-Affiliation: UC Berkeley
-
-Homepage: http://yt-project.org/
-License:
- Copyright (C) 2013 Casey W. Stark. All Rights Reserved.
-
- This file is part of yt.
-
- yt is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-"""
-
-import numpy as np
-
-from yt.units.yt_array import YTArray
-from yt.units.unit_object import Unit
-from yt.utilities.exceptions import YTUnitOperationError
-
-
-class Quantity(YTArray):
- """
- A physical quantity. Attaches units to a scalar.
-
- """
- def __new__(cls, input_array, input_units=None):
- if isinstance(input_array, Quantity):
- return input_array
-
- # Input array is an already formed ndarray instance
- # We first cast to be our class type
- obj = np.asarray(input_array).view(cls)
-
- # Restrict the array to a scalar.
- if obj.size != 1:
- raise ValueError("A Quantity can contain only one element. The "
- "caller provided the array %s with %s elements."
- % (obj, obj.size))
-
- return YTArray.__new__(cls, input_array, input_units)
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list