[Yt-svn] yt: 4 new changesets
hg at spacepope.org
hg at spacepope.org
Tue Dec 14 12:22:55 PST 2010
hg Repository: yt
details: yt/rev/3271f0e096dc
changeset: 3610:3271f0e096dc
user: Matthew Turk <matthewturk at gmail.com>
date:
Mon Dec 06 23:01:12 2010 -0800
description:
Adding in FreeType2 support. This adds in build support as well as a wrapper
function to find fonts and add text to an image.
hg Repository: yt
details: yt/rev/619fab682452
changeset: 3611:619fab682452
user: Matthew Turk <matthewturk at gmail.com>
date:
Sun Dec 12 10:50:41 2010 -0800
description:
Fix from Cameron for the order of arguments in simple_writing
hg Repository: yt
details: yt/rev/2f9479b4f1dd
changeset: 3612:2f9479b4f1dd
user: Matthew Turk <matthewturk at gmail.com>
date:
Tue Dec 14 08:19:42 2010 -0800
description:
Merging
hg Repository: yt
details: yt/rev/ad6d77904932
changeset: 3613:ad6d77904932
user: Matthew Turk <matthewturk at gmail.com>
date:
Tue Dec 14 12:22:49 2010 -0800
description:
Merging
diffstat:
yt/analysis_modules/halo_finding/halo_objects.py | 6 +-
yt/analysis_modules/halo_finding/hop/EnzoHop.c | 12 +-
yt/analysis_modules/halo_finding/hop/hop_hop.c | 8 +-
yt/analysis_modules/halo_finding/parallel_hop/parallel_hop_interface.py | 1 +
yt/analysis_modules/halo_merger_tree/merger_tree.py | 5 +
yt/analysis_modules/simulation_handler/enzo_simulation.py | 4 +-
yt/analysis_modules/two_point_functions/two_point_functions.py | 3 +-
yt/data_objects/data_containers.py | 19 +-
yt/data_objects/derived_quantities.py | 2 +-
yt/data_objects/field_info_container.py | 38 ++-
yt/data_objects/static_output.py | 22 ++
yt/frontends/enzo/data_structures.py | 2 +-
yt/frontends/flash/data_structures.py | 57 +++++-
yt/frontends/flash/fields.py | 64 +++++-
yt/mods.py | 2 +-
yt/utilities/_amr_utils/freetype_includes.h | 38 +++
yt/utilities/amr_utils.pyx | 1 +
yt/utilities/data_point_utilities.c | 2 +-
yt/utilities/kdtree/fKD.f90 | 6 +-
yt/utilities/kdtree/fKD.v | 5 +-
yt/utilities/kdtree/fKD_source.f90 | 47 ++-
yt/utilities/math_utils.py | 106 ++++++++++
yt/utilities/parallel_tools/parallel_analysis_interface.py | 12 +
yt/utilities/setup.py | 58 +++++-
yt/visualization/api.py | 3 +-
yt/visualization/image_writer.py | 59 +++++-
yt/visualization/plot_collection.py | 44 +++-
yt/visualization/plot_types.py | 2 +-
yt/visualization/plot_window.py | 79 +++++--
29 files changed, 614 insertions(+), 93 deletions(-)
diffs (truncated from 1441 to 300 lines):
diff -r 672c309bd892 -r ad6d77904932 yt/analysis_modules/halo_finding/halo_objects.py
--- a/yt/analysis_modules/halo_finding/halo_objects.py Mon Dec 06 14:54:04 2010 -0800
+++ b/yt/analysis_modules/halo_finding/halo_objects.py Tue Dec 14 12:22:49 2010 -0800
@@ -1050,12 +1050,16 @@
HaloList.__init__(self, data_source, dm_only)
def _run_finder(self):
+ period_x, period_y, period_z = \
+ self.pf.domain_right_edge - self.pf.domain_left_edge
+ print "Setting period to", period_x, period_y, period_z
self.densities, self.tags = \
RunHOP(self.particle_fields["particle_position_x"],
self.particle_fields["particle_position_y"],
self.particle_fields["particle_position_z"],
self.particle_fields["ParticleMassMsun"],
- self.threshold)
+ self.threshold,
+ period_x, period_y, period_z)
self.particle_fields["densities"] = self.densities
self.particle_fields["tags"] = self.tags
diff -r 672c309bd892 -r ad6d77904932 yt/analysis_modules/halo_finding/hop/EnzoHop.c
--- a/yt/analysis_modules/halo_finding/hop/EnzoHop.c Mon Dec 06 14:54:04 2010 -0800
+++ b/yt/analysis_modules/halo_finding/hop/EnzoHop.c Tue Dec 14 12:22:49 2010 -0800
@@ -36,7 +36,8 @@
#include "numpy/ndarrayobject.h"
void initgrouplist(Grouplist *g);
-void hop_main(KD kd, HC *my_comm, float densthres);
+void hop_main(KD kd, HC *my_comm, float densthres,
+ float period_x, float period_y, float period_z);
void regroup_main(float dens_outer, HC *my_comm);
static PyObject *_HOPerror;
@@ -102,11 +103,14 @@
npy_float64 totalmass = 0.0;
float normalize_to = 1.0;
float thresh = 160.0;
+ float period_x, period_y, period_z;
+ period_x = period_y = period_z = 1.0;
int i;
- if (!PyArg_ParseTuple(args, "OOOO|ff",
- &oxpos, &oypos, &ozpos, &omass, &thresh, &normalize_to))
+ if (!PyArg_ParseTuple(args, "OOOO|fffff",
+ &oxpos, &oypos, &ozpos, &omass, &thresh, &normalize_to,
+ &period_x, &period_y, &period_z))
return PyErr_Format(_HOPerror,
"EnzoHop: Invalid parameters.");
@@ -155,7 +159,7 @@
initgrouplist(my_comm.gl);
fprintf(stderr, "Calling hop... %d %0.3e\n",num_particles,thresh);
- hop_main(kd, &my_comm, thresh);
+ hop_main(kd, &my_comm, thresh, period_x, period_y, period_z);
fprintf(stderr, "Calling regroup...\n");
regroup_main(thresh, &my_comm);
diff -r 672c309bd892 -r ad6d77904932 yt/analysis_modules/halo_finding/hop/hop_hop.c
--- a/yt/analysis_modules/halo_finding/hop/hop_hop.c Mon Dec 06 14:54:04 2010 -0800
+++ b/yt/analysis_modules/halo_finding/hop/hop_hop.c Tue Dec 14 12:22:49 2010 -0800
@@ -51,7 +51,8 @@
void outGroupMerge(SMX smx, HC *my_comm);
/* void main(int argc,char **argv) */
-void hop_main(KD kd, HC *my_comm, float densthres)
+void hop_main(KD kd, HC *my_comm, float densthres,
+ float period_x, float period_y, float period_z)
{
/* KD kd; */
SMX smx;
@@ -77,7 +78,10 @@
inputfile = NULL;
i = 1;
/* for (j=0;j<3;++j) fPeriod[j] = HUGE; */
- for (j=0;j<3;++j) fPeriod[j] = 1.0;
+/* for (j=0;j<3;++j) fPeriod[j] = 1.0; */
+ fPeriod[0] = period_x;
+ fPeriod[1] = period_y;
+ fPeriod[2] = period_z;
nMerge = 4;
diff -r 672c309bd892 -r ad6d77904932 yt/analysis_modules/halo_finding/parallel_hop/parallel_hop_interface.py
--- a/yt/analysis_modules/halo_finding/parallel_hop/parallel_hop_interface.py Mon Dec 06 14:54:04 2010 -0800
+++ b/yt/analysis_modules/halo_finding/parallel_hop/parallel_hop_interface.py Tue Dec 14 12:22:49 2010 -0800
@@ -358,6 +358,7 @@
fKD.sort = True # Slower, but needed in _connect_chains
fKD.rearrange = self.rearrange # True is faster, but uses more memory
# Now call the fortran.
+ fKD.period = self.period
create_tree(0)
self.__max_memory()
yt_counters("init kd tree")
diff -r 672c309bd892 -r ad6d77904932 yt/analysis_modules/halo_merger_tree/merger_tree.py
--- a/yt/analysis_modules/halo_merger_tree/merger_tree.py Mon Dec 06 14:54:04 2010 -0800
+++ b/yt/analysis_modules/halo_merger_tree/merger_tree.py Tue Dec 14 12:22:49 2010 -0800
@@ -164,6 +164,7 @@
self.dm_only = dm_only
self.refresh = refresh
self.sleep = sleep # How long to wait between db sync checks.
+ self.period = -1
if self.sleep <= 0.:
self.sleep = 5
# MPI stuff
@@ -215,6 +216,9 @@
for cycle, file in enumerate(self.restart_files):
gc.collect()
pf = load(file)
+ # get the period, only once is sufficient
+ if self.period == -1:
+ self.period = pf.domain_right_edge - pf.domain_left_edge
# If the halos are already found, skip this data step, unless
# refresh is True.
dir = os.path.dirname(file)
@@ -365,6 +369,7 @@
fKD.nn = 5
fKD.sort = True
fKD.rearrange = True
+ fKD.period = self.period
create_tree(0)
# Find the parent points from the database.
diff -r 672c309bd892 -r ad6d77904932 yt/analysis_modules/simulation_handler/enzo_simulation.py
--- a/yt/analysis_modules/simulation_handler/enzo_simulation.py Mon Dec 06 14:54:04 2010 -0800
+++ b/yt/analysis_modules/simulation_handler/enzo_simulation.py Tue Dec 14 12:22:49 2010 -0800
@@ -352,7 +352,7 @@
rounded += na.power(10.0,(-1.0*decimals))
z = rounded
- deltaz_max = __deltaz_forward(self.cosmology, z, self.enzoParameters['CosmologyComovingBoxSize'])
+ deltaz_max = _deltaz_forward(self.cosmology, z, self.enzoParameters['CosmologyComovingBoxSize'])
outputs.append({'redshift': z, 'deltazMax': deltaz_max})
z -= deltaz_max
@@ -576,7 +576,7 @@
"DataDumpDir": str,
"GlobalDir" : str}
-def __deltaz_forward(cosmology, z, target_distance):
+def _deltaz_forward(cosmology, z, target_distance):
"Calculate deltaz corresponding to moving a comoving distance starting from some redshift."
d_Tolerance = 1e-4
diff -r 672c309bd892 -r ad6d77904932 yt/analysis_modules/two_point_functions/two_point_functions.py
--- a/yt/analysis_modules/two_point_functions/two_point_functions.py Mon Dec 06 14:54:04 2010 -0800
+++ b/yt/analysis_modules/two_point_functions/two_point_functions.py Tue Dec 14 12:22:49 2010 -0800
@@ -29,7 +29,7 @@
from yt.utilities.parallel_tools.parallel_analysis_interface import ParallelAnalysisInterface, parallel_blocking_call, parallel_root_only
try:
- from yt.extensions.kdtree import *
+ from yt.utilities.kdtree import *
except ImportError:
mylog.debug("The Fortran kD-Tree did not import correctly.")
@@ -306,6 +306,7 @@
fKD.nn = 1
fKD.sort = False
fKD.rearrange = True
+ fKD.period = self.period
create_tree(0)
def _build_sort_array(self):
diff -r 672c309bd892 -r ad6d77904932 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py Mon Dec 06 14:54:04 2010 -0800
+++ b/yt/data_objects/data_containers.py Tue Dec 14 12:22:49 2010 -0800
@@ -40,7 +40,7 @@
grid_points_in_volume, planar_points_in_volume, VoxelTraversal, \
QuadTree
from yt.utilities.data_point_utilities import CombineGrids, \
- DataCubeRefine, DataCubeReplace, FillRegion
+ DataCubeRefine, DataCubeReplace, FillRegion, FillBuffer
from yt.utilities.definitions import axis_names, x_dict, y_dict
from yt.utilities.parallel_tools.parallel_analysis_interface import \
ParallelAnalysisInterface
@@ -764,11 +764,14 @@
points = []
for grid in self._get_grids():
points.append(self._generate_grid_coords(grid))
- if len(points) == 0: points = None
- else: points = na.concatenate(points)
- # We have to transpose here so that _mpi_catarray works properly, as
- # it and the alltoall assume the long axis is the last one.
- t = self._mpi_catarray(points.transpose())
+ if len(points) == 0:
+ points = None
+ t = self._mpi_catarray(None)
+ else:
+ points = na.concatenate(points)
+ # We have to transpose here so that _mpi_catarray works properly, as
+ # it and the alltoall assume the long axis is the last one.
+ t = self._mpi_catarray(points.transpose())
self['px'] = t[0,:]
self['py'] = t[1,:]
self['pz'] = t[2,:]
@@ -1766,6 +1769,7 @@
self._dls = {}
self.domain_width = na.rint((self.pf.domain_right_edge -
self.pf.domain_left_edge)/self.dds).astype('int64')
+ self._refresh_data()
def _get_list_of_grids(self):
if self._grids is not None: return
@@ -1804,9 +1808,10 @@
if not self.has_key('pdx'):
self._generate_coords()
if fields == None:
- fields_to_get = self.fields[:]
+ fields_to_get = [f for f in self.fields if f not in self._key_fields]
else:
fields_to_get = ensure_list(fields)
+ if len(fields_to_get) == 0: return
temp_data = {}
for field in fields_to_get:
self[field] = na.zeros(self.dims, dtype='float64')
diff -r 672c309bd892 -r ad6d77904932 yt/data_objects/derived_quantities.py
--- a/yt/data_objects/derived_quantities.py Mon Dec 06 14:54:04 2010 -0800
+++ b/yt/data_objects/derived_quantities.py Tue Dec 14 12:22:49 2010 -0800
@@ -80,7 +80,7 @@
if preload:
if not lazy_reader: mylog.debug("Turning on lazy_reader because of preload")
lazy_reader = True
- e = FieldDetector()
+ e = FieldDetector(flat = True)
e.NumberOfParticles = 1
self.func(e, *args, **kwargs)
mylog.debug("Preloading %s", e.requested)
diff -r 672c309bd892 -r ad6d77904932 yt/data_objects/field_info_container.py
--- a/yt/data_objects/field_info_container.py Mon Dec 06 14:54:04 2010 -0800
+++ b/yt/data_objects/field_info_container.py Tue Dec 14 12:22:49 2010 -0800
@@ -143,15 +143,21 @@
NumberOfParticles = 1
_read_exception = None
_id_offset = 0
- def __init__(self, nd = 16, pf = None):
+ def __init__(self, nd = 16, pf = None, flat = False):
self.nd = nd
+ self.flat = flat
+ self._spatial = not flat
self.ActiveDimensions = [nd,nd,nd]
self.LeftEdge = [0.0,0.0,0.0]
self.RightEdge = [1.0,1.0,1.0]
self.dds = na.ones(3, "float64")
self['dx'] = self['dy'] = self['dz'] = na.array([1.0])
+ class fake_parameter_file(defaultdict):
+ pass
if pf is None:
- pf = defaultdict(lambda: 1)
+ pf = fake_parameter_file(lambda: 1)
+ pf.current_redshift = pf.omega_lambda = pf.omega_matter = \
+ pf.hubble_constant = pf.cosmological_simulation = 0.0
self.pf = pf
class fake_hierarchy(object):
class fake_io(object):
@@ -164,23 +170,32 @@
self.hierarchy = fake_hierarchy()
self.requested = []
self.requested_parameters = []
- defaultdict.__init__(self,
- lambda: na.ones((nd,nd,nd), dtype='float64') + 1e-4*na.random.random((nd,nd,nd)))
+ if not self.flat:
+ defaultdict.__init__(self,
+ lambda: na.ones((nd,nd,nd), dtype='float64')
+ + 1e-4*na.random.random((nd,nd,nd)))
+ else:
+ defaultdict.__init__(self,
+ lambda: na.ones((nd*nd*nd), dtype='float64')
+ + 1e-4*na.random.random((nd*nd*nd)))
def __missing__(self, item):
if FieldInfo.has_key(item) and \
FieldInfo[item]._function.func_name != '<lambda>':
try:
vv = FieldInfo[item](self)
- except NeedsGridType, exc:
+ except NeedsGridType as exc:
ngz = exc.ghost_zones
nfd = FieldDetector(self.nd+ngz*2)
- vv = FieldInfo[item](nfd)[ngz:-ngz,ngz:-ngz,ngz:-ngz]
- for i in vv.requested:
+ nfd._num_ghost_zones = ngz
+ vv = FieldInfo[item](nfd)
+ if ngz > 0: vv = vv[ngz:-ngz,ngz:-ngz,ngz:-ngz]
+ for i in nfd.requested:
if i not in self.requested: self.requested.append(i)
- for i in vv.requested_parameters:
+ for i in nfd.requested_parameters:
if i not in self.requested_parameters: self.requested_parameters.append(i)
if vv is not None:
- self[item] = vv
+ if not self.flat: self[item] = vv
+ else: self[item] = vv.ravel()
return self[item]
self.requested.append(item)
return defaultdict.__missing__(self, item)
@@ -199,7 +214,6 @@
return na.random.random(3)*1e-2
else:
More information about the yt-svn
mailing list