[Yt-svn] commit/yt: 8 new changesets
Bitbucket
commits-noreply at bitbucket.org
Wed May 4 13:03:35 PDT 2011
8 new changesets in yt:
http://bitbucket.org/yt_analysis/yt/changeset/abfad2d2f724/
changeset: r4232:abfad2d2f724
branch: yt
user: MatthewTurk
date: 2011-04-27 13:15:52
summary: Adding a directory for Castro-specific items.
affected #: 8 files (40.9 KB)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/frontends/castro/__init__.py Wed Apr 27 07:15:52 2011 -0400
@@ -0,0 +1,29 @@
+"""
+API for yt.frontends.castro
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: UCSD
+Author: J.S. Oishi <jsoishi at gmail.com>
+Affiliation: KIPAC/SLAC/Stanford
+Author: Britton Smith <brittonsmith at gmail.com>
+Affiliation: MSU
+Homepage: http://yt.enzotools.org/
+License:
+ Copyright (C) 2010 Matthew Turk. 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/>.
+
+"""
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/frontends/castro/api.py Wed Apr 27 07:15:52 2011 -0400
@@ -0,0 +1,42 @@
+"""
+API for yt.frontends.castro
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: UCSD
+Author: J.S. Oishi <jsoishi at gmail.com>
+Affiliation: KIPAC/SLAC/Stanford
+Author: Britton Smith <brittonsmith at gmail.com>
+Affiliation: MSU
+Homepage: http://yt.enzotools.org/
+License:
+ Copyright (C) 2010 Matthew Turk. 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/>.
+
+"""
+
+from .data_structures import \
+ CastroGrid, \
+ CastroHierarchy, \
+ CastroStaticOutput
+
+from .fields import \
+ CastroFieldContainer, \
+ CastroFieldInfo, \
+ add_castro_field
+
+from .io import \
+ IOHandlerNative
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/frontends/castro/data_structures.py Wed Apr 27 07:15:52 2011 -0400
@@ -0,0 +1,625 @@
+"""
+Data structures for Castro.
+
+Author: J. S. Oishi <jsoishi at gmail.com>
+Affiliation: KIPAC/SLAC/Stanford
+Homepage: http://yt.enzotools.org/
+License:
+ Copyright (C) 2008-2010 J. S. Oishi. 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 re
+import os
+import weakref
+import numpy as na
+
+from collections import \
+ defaultdict
+from string import \
+ strip, \
+ rstrip
+from stat import \
+ ST_CTIME
+
+from yt.funcs import *
+from yt.data_objects.grid_patch import \
+ AMRGridPatch
+from yt.data_objects.hierarchy import \
+ AMRHierarchy
+from yt.data_objects.static_output import \
+ StaticOutput
+from yt.utilities.definitions import \
+ mpc_conversion
+
+from .definitions import \
+ castro2enzoDict, \
+ parameterDict, \
+ yt2castroFieldsDict, \
+ castro_FAB_header_pattern
+
+from .fields import \
+ CastroFieldContainer, \
+ add_field
+
+
+class CastroGrid(AMRGridPatch):
+ _id_offset = 0
+ def __init__(self, LeftEdge, RightEdge, index, level, filename, offset, dimensions, start, stop, paranoia=False,**kwargs):
+ AMRGridPatch.__init__(self, index,**kwargs)
+ self.filename = filename
+ self._offset = offset
+ self._paranoid = paranoia
+
+ # should error check this
+ self.ActiveDimensions = (dimensions.copy()).astype('int32')#.transpose()
+ self.start_index = start.copy()#.transpose()
+ self.stop_index = stop.copy()#.transpose()
+ self.LeftEdge = LeftEdge.copy()
+ self.RightEdge = RightEdge.copy()
+ self.index = index
+ self.Level = level
+
+ def get_global_startindex(self):
+ return self.start_index
+
+ def _prepare_grid(self):
+ """
+ Copies all the appropriate attributes from the hierarchy
+ """
+ # This is definitely the slowest part of generating the hierarchy
+ # Now we give it pointers to all of its attributes
+ # Note that to keep in line with Enzo, we have broken PEP-8
+ h = self.hierarchy # cache it
+ #self.StartIndices = h.gridStartIndices[self.id]
+ #self.EndIndices = h.gridEndIndices[self.id]
+ h.grid_levels[self.id,0] = self.Level
+ h.grid_left_edge[self.id,:] = self.LeftEdge[:]
+ h.grid_right_edge[self.id,:] = self.RightEdge[:]
+ #self.Time = h.gridTimes[self.id,0]
+ #self.NumberOfParticles = h.gridNumberOfParticles[self.id,0]
+ self.field_indexes = h.field_indexes
+ self.Children = h.gridTree[self.id]
+ pIDs = h.gridReverseTree[self.id]
+ if len(pIDs) > 0:
+ self.Parent = [weakref.proxy(h.grids[pID]) for pID in pIDs]
+ else:
+ self.Parent = None
+
+ def _setup_dx(self):
+ # So first we figure out what the index is. We don't assume
+ # that dx=dy=dz , at least here. We probably do elsewhere.
+ id = self.id - self._id_offset
+ if self.Parent is not None:
+ self.dds = self.Parent[0].dds / self.pf.refine_by
+ else:
+ LE, RE = self.hierarchy.grid_left_edge[id,:], \
+ self.hierarchy.grid_right_edge[id,:]
+ self.dds = na.array((RE-LE)/self.ActiveDimensions)
+ if self.pf.dimensionality < 2: self.dds[1] = 1.0
+ if self.pf.dimensionality < 3: self.dds[2] = 1.0
+ self.data['dx'], self.data['dy'], self.data['dz'] = self.dds
+
+ def __repr__(self):
+ return "CastroGrid_%04i" % (self.id)
+
+class CastroHierarchy(AMRHierarchy):
+ grid = CastroGrid
+ def __init__(self, pf, data_style='castro_native'):
+ self.field_info = CastroFieldContainer()
+ self.field_indexes = {}
+ self.parameter_file = weakref.proxy(pf)
+ header_filename = os.path.join(pf.fullplotdir, 'Header')
+ self.directory = pf.fullpath
+ self.data_style = data_style
+ #self._setup_classes()
+
+ # This also sets up the grid objects
+ self.read_global_header(header_filename, self.parameter_file.paranoid_read)
+ self.__cache_endianness(self.levels[-1].grids[-1])
+ AMRHierarchy.__init__(self, pf, self.data_style)
+ self._setup_data_io()
+ self._setup_field_list()
+ self._populate_hierarchy()
+
+ def read_global_header(self, filename, paranoid_read):
+ """
+ read the global header file for an Castro plotfile output.
+ """
+ counter = 0
+ header_file = open(filename,'r')
+ self.__global_header_lines = header_file.readlines()
+
+ # parse the file
+ self.castro_version = self.__global_header_lines[0].rstrip()
+ self.n_fields = int(self.__global_header_lines[1])
+
+ counter = self.n_fields+2
+ self.field_list = []
+ for i, line in enumerate(self.__global_header_lines[2:counter]):
+ self.field_list.append(line.rstrip())
+
+ # this is unused...eliminate it?
+ #for f in self.field_indexes:
+ # self.field_list.append(castro2ytFieldsDict.get(f, f))
+
+ self.dimension = int(self.__global_header_lines[counter])
+ if self.dimension != 3:
+ raise RunTimeError("Castro must be in 3D to use yt.")
+ counter += 1
+ self.Time = float(self.__global_header_lines[counter])
+ counter += 1
+ self.finest_grid_level = int(self.__global_header_lines[counter])
+ self.n_levels = self.finest_grid_level + 1
+ counter += 1
+ # quantities with _unnecessary are also stored in the inputs
+ # file and are not needed. they are read in and stored in
+ # case in the future we want to enable a "backwards" way of
+ # taking the data out of the Header file and using it to fill
+ # in in the case of a missing inputs file
+ self.domainLeftEdge_unnecessary = na.array(map(float, self.__global_header_lines[counter].split()))
+ counter += 1
+ self.domainRightEdge_unnecessary = na.array(map(float, self.__global_header_lines[counter].split()))
+ counter += 1
+ self.refinementFactor_unnecessary = self.__global_header_lines[counter].split() #na.array(map(int, self.__global_header_lines[counter].split()))
+ counter += 1
+ self.globalIndexSpace_unnecessary = self.__global_header_lines[counter]
+ #domain_re.search(self.__global_header_lines[counter]).groups()
+ counter += 1
+ self.timestepsPerLevel_unnecessary = self.__global_header_lines[counter]
+ counter += 1
+ self.dx = na.zeros((self.n_levels,3))
+ for i, line in enumerate(self.__global_header_lines[counter:counter+self.n_levels]):
+ self.dx[i] = na.array(map(float, line.split()))
+ counter += self.n_levels
+ self.geometry = int(self.__global_header_lines[counter])
+ if self.geometry != 0:
+ raise RunTimeError("yt only supports cartesian coordinates.")
+ counter += 1
+
+ # this is just to debug. eventually it should go away.
+ linebreak = int(self.__global_header_lines[counter])
+ if linebreak != 0:
+ raise RunTimeError("INTERNAL ERROR! This should be a zero.")
+ counter += 1
+
+ # each level is one group with ngrids on it. each grid has 3 lines of 2 reals
+ self.levels = []
+ grid_counter = 0
+ file_finder_pattern = r"FabOnDisk: (\w+_D_[0-9]{4}) (\d+)\n"
+ re_file_finder = re.compile(file_finder_pattern)
+ dim_finder_pattern = r"\(\((\d+,\d+,\d+)\) \((\d+,\d+,\d+)\) \(\d+,\d+,\d+\)\)\n"
+ re_dim_finder = re.compile(dim_finder_pattern)
+ data_files_pattern = r"Level_[\d]/"
+ data_files_finder = re.compile(data_files_pattern)
+
+ for level in range(0, self.n_levels):
+ tmp = self.__global_header_lines[counter].split()
+ # should this be grid_time or level_time??
+ lev, ngrids, grid_time = int(tmp[0]), int(tmp[1]), float(tmp[2])
+ counter += 1
+ nsteps = int(self.__global_header_lines[counter])
+ counter += 1
+ self.levels.append(CastroLevel(lev, ngrids))
+ # open level header, extract file names and offsets for
+ # each grid
+ # read slightly out of order here: at the end of the lo, hi
+ # pairs for x, y, z is a *list* of files types in the Level
+ # directory. each type has Header and a number of data
+ # files (one per processor)
+ tmp_offset = counter + 3*ngrids
+ nfiles = 0
+ key_off = 0
+ files = {} # dict(map(lambda a: (a,[]), self.field_list))
+ offsets = {} # dict(map(lambda a: (a,[]), self.field_list))
+ while nfiles+tmp_offset < len(self.__global_header_lines) and data_files_finder.match(self.__global_header_lines[nfiles+tmp_offset]):
+ filen = os.path.join(self.parameter_file.fullplotdir, \
+ self.__global_header_lines[nfiles+tmp_offset].strip())
+ # open each "_H" header file, and get the number of
+ # components within it
+ level_header_file = open(filen+'_H','r').read()
+ start_stop_index = re_dim_finder.findall(level_header_file) # just take the last one
+ grid_file_offset = re_file_finder.findall(level_header_file)
+ ncomp_this_file = int(level_header_file.split('\n')[2])
+ for i in range(ncomp_this_file):
+ key = self.field_list[i+key_off]
+ f, o = zip(*grid_file_offset)
+ files[key] = f
+ offsets[key] = o
+ self.field_indexes[key] = i
+ key_off += ncomp_this_file
+ nfiles += 1
+ # convert dict of lists to list of dicts
+ fn = []
+ off = []
+ lead_path = os.path.join(self.parameter_file.fullplotdir,'Level_%i'%level)
+ for i in range(ngrids):
+ fi = [os.path.join(lead_path, files[key][i]) for key in self.field_list]
+ of = [int(offsets[key][i]) for key in self.field_list]
+ fn.append(dict(zip(self.field_list, fi)))
+ off.append(dict(zip(self.field_list, of)))
+
+ for grid in range(0, ngrids):
+ gfn = fn[grid] # filename of file containing this grid
+ gfo = off[grid] # offset within that file
+ xlo, xhi = map(float, self.__global_header_lines[counter].split())
+ counter+=1
+ ylo, yhi = map(float, self.__global_header_lines[counter].split())
+ counter+=1
+ zlo, zhi = map(float, self.__global_header_lines[counter].split())
+ counter+=1
+ lo = na.array([xlo, ylo, zlo])
+ hi = na.array([xhi, yhi, zhi])
+ dims, start, stop = self.__calculate_grid_dimensions(start_stop_index[grid])
+ self.levels[-1].grids.append(self.grid(lo, hi, grid_counter, level, gfn, gfo, dims, start, stop, paranoia=paranoid_read, hierarchy=self))
+ grid_counter += 1 # this is global, and shouldn't be reset
+ # for each level
+
+ # already read the filenames above...
+ counter+=nfiles
+ self.num_grids = grid_counter
+ self.float_type = 'float64'
+
+ self.maxLevel = self.n_levels - 1
+ self.max_level = self.n_levels - 1
+ header_file.close()
+
+ def __cache_endianness(self, test_grid):
+ """
+ Cache the endianness and bytes perreal of the grids by using a
+ test grid and assuming that all grids have the same
+ endianness. This is a pretty safe assumption since Castro uses
+ one file per processor, and if you're running on a cluster
+ with different endian processors, then you're on your own!
+ """
+ # open the test file & grab the header
+ inFile = open(os.path.expanduser(test_grid.filename[self.field_list[0]]),'rb')
+ header = inFile.readline()
+ inFile.close()
+ header.strip()
+
+ # parse it. the patter is in CastroDefs.py
+ headerRe = re.compile(castro_FAB_header_pattern)
+ bytesPerReal, endian, start, stop, centerType, nComponents = headerRe.search(header).groups()
+ self._bytesPerReal = int(bytesPerReal)
+ if self._bytesPerReal == int(endian[0]):
+ dtype = '<'
+ elif self._bytesPerReal == int(endian[-1]):
+ dtype = '>'
+ else:
+ raise ValueError("FAB header is neither big nor little endian. Perhaps the file is corrupt?")
+
+ dtype += ('f%i' % self._bytesPerReal) # always a floating point
+ self._dtype = dtype
+
+ def __calculate_grid_dimensions(self, start_stop):
+ start = na.array(map(int, start_stop[0].split(',')))
+ stop = na.array(map(int, start_stop[1].split(',')))
+ dimension = stop - start + 1
+ return dimension, start, stop
+
+ def _populate_grid_objects(self):
+ mylog.debug("Creating grid objects")
+ self.grids = na.concatenate([level.grids for level in self.levels])
+ self.grid_levels = na.concatenate([level.ngrids*[level.level] for level in self.levels])
+ self.grid_levels = self.grid_levels.reshape((self.num_grids,1))
+ grid_dcs = na.concatenate([level.ngrids*[self.dx[level.level]] for level in self.levels], axis=0)
+ self.grid_dxs = grid_dcs[:,0].reshape((self.num_grids,1))
+ self.grid_dys = grid_dcs[:,1].reshape((self.num_grids,1))
+ self.grid_dzs = grid_dcs[:,2].reshape((self.num_grids,1))
+ left_edges = []
+ right_edges = []
+ dims = []
+ for level in self.levels:
+ left_edges += [g.LeftEdge for g in level.grids]
+ right_edges += [g.RightEdge for g in level.grids]
+ dims += [g.ActiveDimensions for g in level.grids]
+ self.grid_left_edge = na.array(left_edges)
+ self.grid_right_edge = na.array(right_edges)
+ self.grid_dimensions = na.array(dims)
+ self.gridReverseTree = [] * self.num_grids
+ self.gridReverseTree = [ [] for i in range(self.num_grids)]
+ self.gridTree = [ [] for i in range(self.num_grids)]
+ mylog.debug("Done creating grid objects")
+
+ def _populate_hierarchy(self):
+ self.__setup_grid_tree()
+ #self._setup_grid_corners()
+ for i, grid in enumerate(self.grids):
+ if (i%1e4) == 0: mylog.debug("Prepared % 7i / % 7i grids", i, self.num_grids)
+ grid._prepare_grid()
+ grid._setup_dx()
+
+ def __setup_grid_tree(self):
+ for i, grid in enumerate(self.grids):
+ children = self._get_grid_children(grid)
+ for child in children:
+ self.gridReverseTree[child.id].append(i)
+ self.gridTree[i].append(weakref.proxy(child))
+
+ def _setup_classes(self):
+ dd = self._get_data_reader_dict()
+ dd["field_indexes"] = self.field_indexes
+ AMRHierarchy._setup_classes(self, dd)
+ #self._add_object_class('grid', "CastroGrid", CastroGridBase, dd)
+ self.object_types.sort()
+
+ def _get_grid_children(self, grid):
+ mask = na.zeros(self.num_grids, dtype='bool')
+ grids, grid_ind = self.get_box_grids(grid.LeftEdge, grid.RightEdge)
+ mask[grid_ind] = True
+ mask = na.logical_and(mask, (self.grid_levels == (grid.Level+1)).flat)
+ return self.grids[mask]
+
+ def _setup_field_list(self):
+ self.derived_field_list = []
+ for field in self.field_info:
+ try:
+ fd = self.field_info[field].get_dependencies(pf = self.parameter_file)
+ except:
+ continue
+ available = na.all([f in self.field_list for f in fd.requested])
+ if available: self.derived_field_list.append(field)
+ for field in self.field_list:
+ if field not in self.derived_field_list:
+ self.derived_field_list.append(field)
+
+ def _count_grids(self):
+ """this is already provided in
+
+ """
+ pass
+
+ def _initialize_grid_arrays(self):
+ mylog.debug("Allocating arrays for %s grids", self.num_grids)
+ self.grid_dimensions = na.ones((self.num_grids,3), 'int32')
+ self.grid_left_edge = na.zeros((self.num_grids,3), self.float_type)
+ self.grid_right_edge = na.ones((self.num_grids,3), self.float_type)
+ self.grid_levels = na.zeros((self.num_grids,1), 'int32')
+ self.grid_particle_count = na.zeros((self.num_grids,1), 'int32')
+
+ def _parse_hierarchy(self):
+ pass
+
+ def _detect_fields(self):
+ pass
+
+ def _setup_unknown_fields(self):
+ for field in self.field_list:
+ if field in self.parameter_file.field_info: continue
+ mylog.info("Adding %s to list of fields", field)
+ cf = None
+ if self.parameter_file.has_key(field):
+ def external_wrapper(f):
+ def _convert_function(data):
+ return data.convert(f)
+ return _convert_function
+ cf = external_wrapper(field)
+ add_field(field, lambda a, b: None,
+ convert_function=cf, take_log=False)
+
+
+ def _setup_derived_fields(self):
+ pass
+
+ def _initialize_state_variables(self):
+ """override to not re-initialize num_grids in AMRHierarchy.__init__
+
+ """
+ self._parallel_locking = False
+ self._data_file = None
+ self._data_mode = None
+ self._max_locations = {}
+
+class CastroLevel:
+ def __init__(self, level, ngrids):
+ self.level = level
+ self.ngrids = ngrids
+ self.grids = []
+
+
+class CastroStaticOutput(StaticOutput):
+ """
+ This class is a stripped down class that simply reads and parses
+ *filename*, without looking at the Castro hierarchy.
+ """
+ _hierarchy_class = CastroHierarchy
+ _fieldinfo_class = CastroFieldContainer
+
+ def __init__(self, plotname, paramFilename=None, fparamFilename=None,
+ data_style='castro_native', paranoia=False,
+ storage_filename = None):
+ """need to override for Castro file structure.
+
+ the paramfile is usually called "inputs"
+ and there may be a fortran inputs file usually called "probin"
+ plotname here will be a directory name
+ as per BoxLib, data_style will be one of
+ * Native
+ * IEEE (not implemented in yt)
+ * ASCII (not implemented in yt)
+
+ """
+ self.storage_filename = storage_filename
+ self.paranoid_read = paranoia
+ self.parameter_filename = paramFilename
+ self.fparameter_filename = fparamFilename
+ self.__ipfn = paramFilename
+
+ self.fparameters = {}
+
+ StaticOutput.__init__(self, plotname.rstrip("/"),
+ data_style='castro_native')
+ self.field_info = self._fieldinfo_class()
+
+ # These should maybe not be hardcoded?
+ self.parameters["HydroMethod"] = 'castro' # always PPM DE
+ self.parameters["Time"] = 1. # default unit is 1...
+ self.parameters["DualEnergyFormalism"] = 0 # always off.
+ self.parameters["EOSType"] = -1 # default
+
+ if self.fparameters.has_key("mu"):
+ self.parameters["mu"] = self.fparameters["mu"]
+
+ def _localize(self, f, default):
+ if f is None:
+ return os.path.join(self.directory, default)
+ return f
+
+ @classmethod
+ def _is_valid(cls, *args, **kwargs):
+ # fill our args
+ pname = args[0].rstrip("/")
+ dn = os.path.dirname(pname)
+ if len(args) > 1: kwargs['paramFilename'] = args[1]
+ pfname = kwargs.get("paramFilename", os.path.join(dn, "inputs"))
+
+ # We check for the job_info file's existence because this is currently
+ # what distinguishes Castro data from MAESTRO data.
+ return ( os.path.exists(os.path.join(pfname)) and
+ not os.path.exists(os.path.join(pname, "job_info")))
+
+ def _parse_parameter_file(self):
+ """
+ Parses the parameter file and establishes the various
+ dictionaries.
+ """
+ self.fullplotdir = os.path.abspath(self.parameter_filename)
+ self._parse_header_file()
+ self.parameter_filename = self._localize(
+ self.__ipfn, 'inputs')
+ self.fparameter_filename = self._localize(
+ self.fparameter_filename, 'probin')
+ if os.path.isfile(self.fparameter_filename):
+ self._parse_fparameter_file()
+ for param in self.fparameters:
+ if castro2enzoDict.has_key(param):
+ self.parameters[castro2enzoDict[param]]=self.fparameters[param]
+ # Let's read the file
+ self.unique_identifier = \
+ int(os.stat(self.parameter_filename)[ST_CTIME])
+ lines = open(self.parameter_filename).readlines()
+ for lineI, line in enumerate(lines):
+ if line.find("#") >= 1: # Keep the commented lines...
+ line=line[:line.find("#")]
+ line=line.strip().rstrip()
+ if len(line) < 2 or line.find("#") == 0: # ...but skip comments
+ continue
+ try:
+ param, vals = map(strip, map(rstrip, line.split("=")))
+ except ValueError:
+ mylog.error("ValueError: '%s'", line)
+ if castro2enzoDict.has_key(param):
+ paramName = castro2enzoDict[param]
+ t = map(parameterDict[paramName], vals.split())
+ if len(t) == 1:
+ self.parameters[paramName] = t[0]
+ else:
+ if paramName == "RefineBy":
+ self.parameters[paramName] = t[0]
+ else:
+ self.parameters[paramName] = t
+
+ elif param.startswith("geometry.prob_hi"):
+ self.domain_right_edge = \
+ na.array([float(i) for i in vals.split()])
+ elif param.startswith("geometry.prob_lo"):
+ self.domain_left_edge = \
+ na.array([float(i) for i in vals.split()])
+
+ self.parameters["TopGridRank"] = len(self.parameters["TopGridDimensions"])
+ self.dimensionality = self.parameters["TopGridRank"]
+ self.domain_dimensions = self.parameters["TopGridDimensions"]
+ self.refine_by = self.parameters["RefineBy"]
+
+ if self.parameters.has_key("ComovingCoordinates") and bool(self.parameters["ComovingCoordinates"]):
+ self.cosmological_simulation = 1
+ self.omega_lambda = self.parameters["CosmologyOmegaLambdaNow"]
+ self.omega_matter = self.parameters["CosmologyOmegaMatterNow"]
+ self.hubble_constant = self.parameters["CosmologyHubbleConstantNow"]
+ a_file = open(os.path.join(self.fullplotdir,'comoving_a'))
+ line = a_file.readline().strip()
+ a_file.close()
+ self.parameters["CosmologyCurrentRedshift"] = 1/float(line) - 1
+ self.current_redshift = self.parameters["CosmologyCurrentRedshift"]
+ else:
+ self.current_redshift = self.omega_lambda = self.omega_matter = \
+ self.hubble_constant = self.cosmological_simulation = 0.0
+
+ def _parse_fparameter_file(self):
+ """
+ Parses the fortran parameter file for Castro. Most of this will
+ be useless, but this is where it keeps mu = mass per
+ particle/m_hydrogen.
+ """
+ lines = open(self.fparameter_filename).readlines()
+ for line in lines:
+ if line.count("=") == 1:
+ param, vals = map(strip, map(rstrip, line.split("=")))
+ if vals.count("'") == 0:
+ t = map(float,[a.replace('D','e').replace('d','e') for a in vals.split()]) # all are floating point.
+ else:
+ t = vals.split()
+ if len(t) == 1:
+ self.fparameters[param] = t[0]
+ else:
+ self.fparameters[param] = t
+
+ def _parse_header_file(self):
+ """
+ Parses the BoxLib header file to get any parameters stored
+ there. Hierarchy information is read out of this file in
+ CastroHierarchy.
+
+ Currently, only Time is read here.
+ """
+ header_file = open(os.path.join(self.fullplotdir,'Header'))
+ lines = header_file.readlines()
+ header_file.close()
+ n_fields = int(lines[1])
+ self.current_time = float(lines[3+n_fields])
+
+
+
+ def _set_units(self):
+ """
+ Generates the conversion to various physical _units based on the parameter file
+ """
+ self.units = {}
+ self.time_units = {}
+ if len(self.parameters) == 0:
+ self._parse_parameter_file()
+ self._setup_nounits_units()
+ self.conversion_factors = defaultdict(lambda: 1.0)
+ self.time_units['1'] = 1
+ self.units['1'] = 1.0
+ self.units['unitary'] = 1.0 / (self.domain_right_edge - self.domain_left_edge).max()
+ seconds = 1 #self["Time"]
+ self.time_units['years'] = seconds / (365*3600*24.0)
+ self.time_units['days'] = seconds / (3600*24.0)
+ for key in yt2castroFieldsDict:
+ self.conversion_factors[key] = 1.0
+
+ def _setup_nounits_units(self):
+ z = 0
+ mylog.warning("Setting 1.0 in code units to be 1.0 cm")
+ if not self.has_key("TimeUnits"):
+ mylog.warning("No time units. Setting 1.0 = 1 second.")
+ self.conversion_factors["Time"] = 1.0
+ for unit in mpc_conversion.keys():
+ self.units[unit] = mpc_conversion[unit] / mpc_conversion["cm"]
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/frontends/castro/definitions.py Wed Apr 27 07:15:52 2011 -0400
@@ -0,0 +1,77 @@
+"""
+Various definitions for various other modules and routines
+
+Author: J. S. Oishi <jsoishi at gmail.com>
+Affiliation: KIPAC/SLAC/Stanford
+Homepage: http://yt.enzotools.org/
+License:
+ Copyright (C) 2008-20010 J.S. Oishi. 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/>.
+
+"""
+from yt.funcs import *
+
+# TODO: get rid of enzo parameters we do not need
+parameterDict = {"CosmologyCurrentRedshift": float,
+ "CosmologyComovingBoxSize": float,
+ "CosmologyOmegaMatterNow": float,
+ "CosmologyOmegaLambdaNow": float,
+ "CosmologyHubbleConstantNow": float,
+ "CosmologyInitialRedshift": float,
+ "DualEnergyFormalismEta1": float,
+ "DualEnergyFormalismEta2": float,
+ "MetaDataString": str,
+ "HydroMethod": int,
+ "DualEnergyFormalism": int,
+ "InitialTime": float,
+ "ComovingCoordinates": int,
+ "DensityUnits": float,
+ "LengthUnits": float,
+ "LengthUnit": float,
+ "TemperatureUnits": float,
+ "TimeUnits": float,
+ "GravitationalConstant": float,
+ "Gamma": float,
+ "MultiSpecies": int,
+ "CompilerPrecision": str,
+ "CurrentTimeIdentifier": int,
+ "RefineBy": int,
+ "BoundaryConditionName": str,
+ "TopGridRank": int,
+ "TopGridDimensions": int,
+ "EOSSoundSpeed": float,
+ "EOSType": int,
+ "NumberOfParticleAttributes": int,
+ }
+
+
+# converts the Castro inputs file name to the Enzo/yt name expected
+# throughout the code. key is Castro name, value is Enzo/yt equivalent
+castro2enzoDict = {"amr.n_cell": "TopGridDimensions",
+ "materials.gamma": "Gamma",
+ "amr.ref_ratio": "RefineBy",
+ "castro.use_comoving": "ComovingCoordinates",
+ "castro.redshift_in": "CosmologyInitialRedshift",
+ "comoving_OmL": "CosmologyOmegaLambdaNow",
+ "comoving_OmM": "CosmologyOmegaMatterNow",
+ "comoving_h": "CosmologyHubbleConstantNow"
+ }
+
+yt2castroFieldsDict = {}
+castro2ytFieldsDict = {}
+
+castro_FAB_header_pattern = r"^FAB \(\((\d+), \([0-9 ]+\)\),\(\d+, \(([0-9 ]+)\)\)\)\(\((\d+,\d+,\d+)\) \((\d+,\d+,\d+)\) \((\d+,\d+,\d+)\)\) (\d+)\n"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/frontends/castro/fields.py Wed Apr 27 07:15:52 2011 -0400
@@ -0,0 +1,144 @@
+"""
+Castro-specific fields
+
+Author: J. S. Oishi <jsoishi at gmail.com>
+Affiliation: UC Berkeley
+Homepage: http://yt.enzotools.org/
+License:
+ Copyright (C) 2008-2010 J. S. Oishi, Matthew Turk. 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/>.
+"""
+from yt.utilities.physical_constants import \
+ mh, kboltz
+from yt.data_objects.field_info_container import \
+ CodeFieldInfoContainer, \
+ ValidateParameter, \
+ ValidateDataField, \
+ ValidateProperty, \
+ ValidateSpatial, \
+ ValidateGridType
+import yt.data_objects.universal_fields
+
+class CastroFieldContainer(CodeFieldInfoContainer):
+ """
+ All Castro-specific fields are stored in here.
+ """
+ _shared_state = {}
+ _field_list = {}
+CastroFieldInfo = CastroFieldContainer()
+add_castro_field = CastroFieldInfo.add_field
+
+
+add_field = add_castro_field
+
+# def _convertDensity(data):
+# return data.convert("Density")
+add_field("density", function=lambda a, b: None, take_log=True,
+ validators = [ValidateDataField("density")],
+ units=r"\rm{g}/\rm{cm}^3")
+CastroFieldInfo["density"]._projected_units =r"\rm{g}/\rm{cm}^2"
+#CastroFieldInfo["density"]._convert_function=_convertDensity
+
+add_field("eden", function=lambda a, b: None, take_log=True,
+ validators = [ValidateDataField("eden")],
+ units=r"\rm{erg}/\rm{cm}^3")
+
+add_field("xmom", function=lambda a, b: None, take_log=False,
+ validators = [ValidateDataField("xmom")],
+ units=r"\rm{g}/\rm{cm^2\ s}")
+
+add_field("ymom", function=lambda a, b: None, take_log=False,
+ validators = [ValidateDataField("ymom")],
+ units=r"\rm{gm}/\rm{cm^2\ s}")
+
+add_field("zmom", function=lambda a, b: None, take_log=False,
+ validators = [ValidateDataField("zmom")],
+ units=r"\rm{g}/\rm{cm^2\ s}")
+
+translation_dict = {"x-velocity": "xvel",
+ "y-velocity": "yvel",
+ "z-velocity": "zvel",
+ "Density": "density",
+ "Total_Energy": "eden",
+ "Temperature": "temperature",
+ "x-momentum": "xmom",
+ "y-momentum": "ymom",
+ "z-momentum": "zmom"
+ }
+
+def _generate_translation(mine, theirs):
+ add_field(theirs, function=lambda a, b: b[mine], take_log=True)
+
+for f, v in translation_dict.items():
+ if v not in CastroFieldInfo:
+ add_field(v, function=lambda a, b: None, take_log=False,
+ validators = [ValidateDataField(v)])
+ #print "Setting up translator from %s to %s" % (v, f)
+ _generate_translation(v, f)
+
+def _xVelocity(field, data):
+ """generate x-velocity from x-momentum and density
+
+ """
+ return data["xmom"]/data["density"]
+add_field("x-velocity", function=_xVelocity, take_log=False,
+ units=r'\rm{cm}/\rm{s}')
+
+def _yVelocity(field, data):
+ """generate y-velocity from y-momentum and density
+
+ """
+ #try:
+ # return data["xvel"]
+ #except KeyError:
+ return data["ymom"]/data["density"]
+add_field("y-velocity", function=_yVelocity, take_log=False,
+ units=r'\rm{cm}/\rm{s}')
+
+def _zVelocity(field, data):
+ """generate z-velocity from z-momentum and density
+
+ """
+ return data["zmom"]/data["density"]
+add_field("z-velocity", function=_zVelocity, take_log=False,
+ units=r'\rm{cm}/\rm{s}')
+
+def _ThermalEnergy(field, data):
+ """generate thermal (gas energy). Dual Energy Formalism was
+ implemented by Stella, but this isn't how it's called, so I'll
+ leave that commented out for now.
+ """
+ #if data.pf["DualEnergyFormalism"]:
+ # return data["Gas_Energy"]
+ #else:
+ return data["Total_Energy"] - 0.5 * data["density"] * (
+ data["x-velocity"]**2.0
+ + data["y-velocity"]**2.0
+ + data["z-velocity"]**2.0 )
+add_field("ThermalEnergy", function=_ThermalEnergy,
+ units=r"\rm{ergs}/\rm{cm^3}")
+
+def _Pressure(field, data):
+ """M{(Gamma-1.0)*e, where e is thermal energy density
+ NB: this will need to be modified for radiation
+ """
+ return (data.pf["Gamma"] - 1.0)*data["ThermalEnergy"]
+add_field("Pressure", function=_Pressure, units=r"\rm{dyne}/\rm{cm}^{2}")
+
+def _Temperature(field, data):
+ return (data.pf["Gamma"]-1.0)*data.pf["mu"]*mh*data["ThermalEnergy"]/(kboltz*data["Density"])
+add_field("Temperature", function=_Temperature, units=r"\rm{Kelvin}", take_log=False)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/frontends/castro/io.py Wed Apr 27 07:15:52 2011 -0400
@@ -0,0 +1,129 @@
+"""
+Castro data-file handling functions
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Author: J. S. Oishi <jsoishi at gmail.com>
+Affiliation: KIPAC/SLAC/Stanford
+Homepage: http://yt.enzotools.org/
+License:
+ Copyright (C) 2007-2010 Matthew Turk. 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 os
+import numpy as na
+from yt.utilities.io_handler import \
+ BaseIOHandler
+
+from definitions import \
+ yt2castroFieldsDict
+
+class IOHandlerNative(BaseIOHandler):
+
+ _data_style = "castro_native"
+
+ def modify(self, field):
+ return field.swapaxes(0,2)
+
+ def _read_data_set(self, grid, field):
+ """
+ reads packed multiFABs output by BoxLib in "NATIVE" format.
+
+ """
+ filen = os.path.expanduser(grid.filename[field])
+ off = grid._offset[field]
+ inFile = open(filen,'rb')
+ inFile.seek(off)
+ header = inFile.readline()
+ header.strip()
+
+ if grid._paranoid:
+ mylog.warn("Castro Native reader: Paranoid read mode.")
+ headerRe = re.compile(castro_FAB_header_pattern)
+ bytesPerReal, endian, start, stop, centerType, nComponents = headerRe.search(header).groups()
+
+ # we will build up a dtype string, starting with endian
+ # check endianness (this code is ugly. fix?)
+ bytesPerReal = int(bytesPerReal)
+ if bytesPerReal == int(endian[0]):
+ dtype = '<'
+ elif bytesPerReal == int(endian[-1]):
+ dtype = '>'
+ else:
+ raise ValueError("FAB header is neither big nor little endian. Perhaps the file is corrupt?")
+
+ dtype += ('f%i'% bytesPerReal) #always a floating point
+
+ # determine size of FAB
+ start = na.array(map(int, start.split(',')))
+ stop = na.array(map(int, stop.split(',')))
+
+ gridSize = stop - start + 1
+
+ error_count = 0
+ if (start != grid.start).any():
+ print "Paranoia Error: Cell_H and %s do not agree on grid start." %grid.filename
+ error_count += 1
+ if (stop != grid.stop).any():
+ print "Paranoia Error: Cell_H and %s do not agree on grid stop." %grid.filename
+ error_count += 1
+ if (gridSize != grid.ActiveDimensions).any():
+ print "Paranoia Error: Cell_H and %s do not agree on grid dimensions." %grid.filename
+ error_count += 1
+ if bytesPerReal != grid.hierarchy._bytesPerReal:
+ print "Paranoia Error: Cell_H and %s do not agree on bytes per real number." %grid.filename
+ error_count += 1
+ if (bytesPerReal == grid.hierarchy._bytesPerReal and dtype != grid.hierarchy._dtype):
+ print "Paranoia Error: Cell_H and %s do not agree on endianness." %grid.filename
+ error_count += 1
+
+ if error_count > 0:
+ raise RunTimeError("Paranoia unveiled %i differences between Cell_H and %s." % (error_count, grid.filename))
+
+ else:
+ start = grid.start_index
+ stop = grid.stop_index
+ dtype = grid.hierarchy._dtype
+ bytesPerReal = grid.hierarchy._bytesPerReal
+
+ nElements = grid.ActiveDimensions.prod()
+
+ # one field has nElements*bytesPerReal bytes and is located
+ # nElements*bytesPerReal*field_index from the offset location
+ if yt2castroFieldsDict.has_key(field):
+ fieldname = yt2castroFieldsDict[field]
+ else:
+ fieldname = field
+ field_index = grid.field_indexes[fieldname]
+ inFile.seek(int(nElements*bytesPerReal*field_index),1)
+ field = na.fromfile(inFile, count=nElements, dtype=dtype)
+ field = field.reshape(grid.ActiveDimensions[::-1]).swapaxes(0,2)
+
+ # we can/should also check against the max and min in the header file
+
+ inFile.close()
+ return field
+
+ def _read_data_slice(self, grid, field, axis, coord):
+ """wishful thinking?
+ """
+ sl = [slice(None), slice(None), slice(None)]
+ sl[axis] = slice(coord, coord + 1)
+ #sl = tuple(reversed(sl))
+ return self._read_data_set(grid, field)[sl]
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/frontends/castro/setup.py Wed Apr 27 07:15:52 2011 -0400
@@ -0,0 +1,12 @@
+#!/usr/bin/env python
+import setuptools
+import os, sys, os.path
+
+import os.path
+
+def configuration(parent_package='', top_path=None):
+ from numpy.distutils.misc_util import Configuration
+ config = Configuration('castro', parent_package, top_path)
+ config.make_config_py() # installs __config__.py
+ config.make_svn_version_py()
+ return config
http://bitbucket.org/yt_analysis/yt/changeset/71abe4697b56/
changeset: r4233:71abe4697b56
branch: yt
user: MatthewTurk
date: 2011-04-27 13:38:51
summary: Changing the way orion and castro outputs are distinguished.
The BoxLib formats will *need* to be reorganized and the IO cleaned up. This
will be a task, hopefully, for May or June.
affected #: 3 files (404 bytes)
--- a/yt/frontends/castro/data_structures.py Wed Apr 27 07:15:52 2011 -0400
+++ b/yt/frontends/castro/data_structures.py Wed Apr 27 07:38:51 2011 -0400
@@ -490,8 +490,12 @@
# We check for the job_info file's existence because this is currently
# what distinguishes Castro data from MAESTRO data.
- return ( os.path.exists(os.path.join(pfname)) and
- not os.path.exists(os.path.join(pname, "job_info")))
+ pfn = os.path.join(pfname)
+ if not os.path.exists(pfn): return False
+ castro = any(("castro." in line for line in open(pfn)))
+ maestro = os.path.exists(os.path.join(pname, "job_info"))
+ orion = (not castro) and (not maestro)
+ return castro
def _parse_parameter_file(self):
"""
--- a/yt/frontends/orion/data_structures.py Wed Apr 27 07:15:52 2011 -0400
+++ b/yt/frontends/orion/data_structures.py Wed Apr 27 07:38:51 2011 -0400
@@ -489,8 +489,12 @@
# We check for the job_info file's existence because this is currently
# what distinguishes Orion data from MAESTRO data.
- return ( os.path.exists(os.path.join(pfname)) and
- not os.path.exists(os.path.join(pname, "job_info")))
+ pfn = os.path.join(pfname)
+ if not os.path.exists(pfn): return False
+ castro = any(("castro." in line for line in open(pfn)))
+ maestro = os.path.exists(os.path.join(pname, "job_info"))
+ orion = (not castro) and (not maestro)
+ return orion
def _parse_parameter_file(self):
"""
--- a/yt/mods.py Wed Apr 27 07:15:52 2011 -0400
+++ b/yt/mods.py Wed Apr 27 07:38:51 2011 -0400
@@ -56,6 +56,9 @@
EnzoStaticOutput, EnzoStaticOutputInMemory, EnzoFieldInfo, \
add_enzo_field, add_enzo_1d_field, add_enzo_2d_field
+from yt.frontends.castro.api import \
+ CastroStaticOutput, CastroFieldInfo, add_castro_field
+
from yt.frontends.orion.api import \
OrionStaticOutput, OrionFieldInfo, add_orion_field
http://bitbucket.org/yt_analysis/yt/changeset/3de843321a55/
changeset: r4234:3de843321a55
branch: yt
user: MatthewTurk
date: 2011-04-27 15:49:51
summary: Adding a use_particles item.
affected #: 1 file (103 bytes)
--- a/yt/frontends/castro/data_structures.py Wed Apr 27 07:38:51 2011 -0400
+++ b/yt/frontends/castro/data_structures.py Wed Apr 27 09:49:51 2011 -0400
@@ -544,6 +544,8 @@
elif param.startswith("geometry.prob_lo"):
self.domain_left_edge = \
na.array([float(i) for i in vals.split()])
+ elif param.startswith("castro.do_dm_particles"):
+ self.use_particles = True
self.parameters["TopGridRank"] = len(self.parameters["TopGridDimensions"])
self.dimensionality = self.parameters["TopGridRank"]
http://bitbucket.org/yt_analysis/yt/changeset/7a33cb604b36/
changeset: r4235:7a33cb604b36
branch: yt
user: MatthewTurk
date: 2011-04-27 15:58:52
summary: The start of reading particles for Castro.
affected #: 3 files (1.5 KB)
--- a/yt/frontends/castro/data_structures.py Wed Apr 27 09:49:51 2011 -0400
+++ b/yt/frontends/castro/data_structures.py Wed Apr 27 09:58:52 2011 -0400
@@ -50,7 +50,8 @@
castro2enzoDict, \
parameterDict, \
yt2castroFieldsDict, \
- castro_FAB_header_pattern
+ castro_FAB_header_pattern, \
+ castro_particle_field_names
from .fields import \
CastroFieldContainer, \
@@ -377,6 +378,21 @@
for field in self.field_list:
if field not in self.derived_field_list:
self.derived_field_list.append(field)
+ if self.parameter_file.use_particles:
+ # We know which particle fields will exist -- pending further
+ # changes in the future.
+ for field in _castro_particle_fields:
+ def external_wrapper(f):
+ def _convert_function(data):
+ return data.convert(f)
+ return _convert_function
+ cf = external_wrapper(field)
+ # Note that we call add_field on the field_info directly. This
+ # will allow the same field detection mechanism to work for 1D, 2D
+ # and 3D fields.
+ self.pf.field_info.add_field(
+ field, lambda a, b: None,
+ convert_function=cf, take_log=False)
def _count_grids(self):
"""this is already provided in
--- a/yt/frontends/castro/definitions.py Wed Apr 27 09:49:51 2011 -0400
+++ b/yt/frontends/castro/definitions.py Wed Apr 27 09:58:52 2011 -0400
@@ -75,3 +75,10 @@
castro2ytFieldsDict = {}
castro_FAB_header_pattern = r"^FAB \(\((\d+), \([0-9 ]+\)\),\(\d+, \(([0-9 ]+)\)\)\)\(\((\d+,\d+,\d+)\) \((\d+,\d+,\d+)\) \((\d+,\d+,\d+)\)\) (\d+)\n"
+
+castro_particle_field_names = set(
+ ['particle_position_%s' % ax for ax in 'xyz'] +
+ ['particle_mass'] +
+ ['particle_velocity_%s' % ax for ax in 'xyz']
+)
+
--- a/yt/frontends/castro/io.py Wed Apr 27 09:49:51 2011 -0400
+++ b/yt/frontends/castro/io.py Wed Apr 27 09:58:52 2011 -0400
@@ -30,7 +30,8 @@
BaseIOHandler
from definitions import \
- yt2castroFieldsDict
+ yt2castroFieldsDict,
+ castro_particle_field_names
class IOHandlerNative(BaseIOHandler):
@@ -39,11 +40,23 @@
def modify(self, field):
return field.swapaxes(0,2)
+ def _read_particle_field(self, grid, field):
+ raise NotImplementedError
+ offset = grid._particle_offset
+ filen = os.path.expanduser(grid.filename[field])
+ off = grid._particle_offset[field]
+ inFile = open(filen,'rb')
+ inFile.seek(off)
+ # This is hardcoded to: 5 int fields, 4 bytes per field
+ inFile.seek(5*grid.NumberOfParticles*4)
+
def _read_data_set(self, grid, field):
"""
reads packed multiFABs output by BoxLib in "NATIVE" format.
"""
+ if field in castro_particle_field_names:
+ return self._read_particle_field(grid, field)
filen = os.path.expanduser(grid.filename[field])
off = grid._offset[field]
inFile = open(filen,'rb')
http://bitbucket.org/yt_analysis/yt/changeset/2917662ca237/
changeset: r4236:2917662ca237
branch: yt
user: MatthewTurk
date: 2011-05-04 20:45:48
summary: Add parsing of the castro particle headers
affected #: 2 files (1.0 KB)
--- a/yt/frontends/castro/data_structures.py Wed Apr 27 09:58:52 2011 -0400
+++ b/yt/frontends/castro/data_structures.py Wed May 04 14:45:48 2011 -0400
@@ -131,6 +131,7 @@
# This also sets up the grid objects
self.read_global_header(header_filename, self.parameter_file.paranoid_read)
+ self.read_particle_header()
self.__cache_endianness(self.levels[-1].grids[-1])
AMRHierarchy.__init__(self, pf, self.data_style)
self._setup_data_io()
@@ -279,6 +280,28 @@
self.max_level = self.n_levels - 1
header_file.close()
+ def read_particle_header(self):
+ # We need to get particle offsets and particle counts
+ if not self.parameter_file.use_particles:
+ self.pgrid_info = na.zeros((self.num_grids, 2), dtype='int64')
+ return
+ header = open(os.path.join(self.parameter_file.fullplotdir,
+ "DM", "Header"))
+ version = header.readline()
+ ndim = header.readline()
+ nfields = header.readline()
+ ntotalpart = int(header.readline())
+ dummy = header.readline() # nextid
+ maxlevel = int(header.readline()) # max level
+ # Skip over how many grids on each level; this is degenerate
+ for i in range(maxlevel): dummy = header.readline()
+ grid_info = na.fromiter((int(i)
+ for line in header.readlines()
+ for i in line.split()[1:]
+ ),
+ dtype='int64', count=2*self.num_grids).reshape((self.num_grids, 2))
+ self.pgrid_info = grid_info
+
def __cache_endianness(self, test_grid):
"""
Cache the endianness and bytes perreal of the grids by using a
@@ -381,7 +404,7 @@
if self.parameter_file.use_particles:
# We know which particle fields will exist -- pending further
# changes in the future.
- for field in _castro_particle_fields:
+ for field in castro_particle_field_names:
def external_wrapper(f):
def _convert_function(data):
return data.convert(f)
@@ -566,7 +589,7 @@
self.parameters["TopGridRank"] = len(self.parameters["TopGridDimensions"])
self.dimensionality = self.parameters["TopGridRank"]
self.domain_dimensions = self.parameters["TopGridDimensions"]
- self.refine_by = self.parameters["RefineBy"]
+ self.refine_by = self.parameters.get("RefineBy", 2)
if self.parameters.has_key("ComovingCoordinates") and bool(self.parameters["ComovingCoordinates"]):
self.cosmological_simulation = 1
--- a/yt/frontends/castro/io.py Wed Apr 27 09:58:52 2011 -0400
+++ b/yt/frontends/castro/io.py Wed May 04 14:45:48 2011 -0400
@@ -30,7 +30,7 @@
BaseIOHandler
from definitions import \
- yt2castroFieldsDict,
+ yt2castroFieldsDict, \
castro_particle_field_names
class IOHandlerNative(BaseIOHandler):
http://bitbucket.org/yt_analysis/yt/changeset/301cb8a7c35c/
changeset: r4237:301cb8a7c35c
branch: yt
user: MatthewTurk
date: 2011-05-04 21:47:24
summary: Castro particle fields now seem to mostly work.
affected #: 4 files (1.3 KB)
--- a/yt/frontends/castro/data_structures.py Wed May 04 14:45:48 2011 -0400
+++ b/yt/frontends/castro/data_structures.py Wed May 04 15:47:24 2011 -0400
@@ -26,6 +26,7 @@
import re
import os
import weakref
+import itertools
import numpy as na
from collections import \
@@ -283,8 +284,9 @@
def read_particle_header(self):
# We need to get particle offsets and particle counts
if not self.parameter_file.use_particles:
- self.pgrid_info = na.zeros((self.num_grids, 2), dtype='int64')
+ self.pgrid_info = na.zeros((self.num_grids, 3), dtype='int64')
return
+ self.field_list += castro_particle_field_names[:]
header = open(os.path.join(self.parameter_file.fullplotdir,
"DM", "Header"))
version = header.readline()
@@ -294,12 +296,12 @@
dummy = header.readline() # nextid
maxlevel = int(header.readline()) # max level
# Skip over how many grids on each level; this is degenerate
- for i in range(maxlevel): dummy = header.readline()
+ for i in range(maxlevel+1): dummy = header.readline()
grid_info = na.fromiter((int(i)
for line in header.readlines()
- for i in line.split()[1:]
+ for i in line.split()
),
- dtype='int64', count=2*self.num_grids).reshape((self.num_grids, 2))
+ dtype='int64', count=3*self.num_grids).reshape((self.num_grids, 3))
self.pgrid_info = grid_info
def __cache_endianness(self, test_grid):
@@ -339,6 +341,14 @@
def _populate_grid_objects(self):
mylog.debug("Creating grid objects")
self.grids = na.concatenate([level.grids for level in self.levels])
+ basedir = self.parameter_file.fullplotdir
+ for g, pg in itertools.izip(self.grids, self.pgrid_info):
+ g.particle_filename = os.path.join(
+ basedir, "DM", "Level_%s" % (g.Level), "DATA_%04i" % pg[0])
+ g.NumberOfParticles = pg[1]
+ g._particle_offset = pg[2]
+ self.grid_particle_count[:,0] = self.pgrid_info[:,1]
+ del self.pgrid_info
self.grid_levels = na.concatenate([level.ngrids*[level.level] for level in self.levels])
self.grid_levels = self.grid_levels.reshape((self.num_grids,1))
grid_dcs = na.concatenate([level.ngrids*[self.dx[level.level]] for level in self.levels], axis=0)
@@ -658,6 +668,8 @@
self.time_units['days'] = seconds / (3600*24.0)
for key in yt2castroFieldsDict:
self.conversion_factors[key] = 1.0
+ for key in castro_particle_field_names:
+ self.conversion_factors[key] = 1.0
def _setup_nounits_units(self):
z = 0
--- a/yt/frontends/castro/definitions.py Wed May 04 14:45:48 2011 -0400
+++ b/yt/frontends/castro/definitions.py Wed May 04 15:47:24 2011 -0400
@@ -76,9 +76,7 @@
castro_FAB_header_pattern = r"^FAB \(\((\d+), \([0-9 ]+\)\),\(\d+, \(([0-9 ]+)\)\)\)\(\((\d+,\d+,\d+)\) \((\d+,\d+,\d+)\) \((\d+,\d+,\d+)\)\) (\d+)\n"
-castro_particle_field_names = set(
- ['particle_position_%s' % ax for ax in 'xyz'] +
- ['particle_mass'] +
+castro_particle_field_names = \
+ ['particle_position_%s' % ax for ax in 'xyz'] + \
+ ['particle_mass'] + \
['particle_velocity_%s' % ax for ax in 'xyz']
-)
-
--- a/yt/frontends/castro/io.py Wed May 04 14:45:48 2011 -0400
+++ b/yt/frontends/castro/io.py Wed May 04 15:47:24 2011 -0400
@@ -28,6 +28,8 @@
import numpy as na
from yt.utilities.io_handler import \
BaseIOHandler
+from yt.utilities.amr_utils import \
+ read_castro_particles
from definitions import \
yt2castroFieldsDict, \
@@ -41,14 +43,15 @@
return field.swapaxes(0,2)
def _read_particle_field(self, grid, field):
- raise NotImplementedError
offset = grid._particle_offset
- filen = os.path.expanduser(grid.filename[field])
- off = grid._particle_offset[field]
- inFile = open(filen,'rb')
- inFile.seek(off)
- # This is hardcoded to: 5 int fields, 4 bytes per field
- inFile.seek(5*grid.NumberOfParticles*4)
+ filen = os.path.expanduser(grid.particle_filename)
+ off = grid._particle_offset
+ tr = na.zeros(grid.NumberOfParticles, dtype='float64')
+ read_castro_particles(filen, off,
+ castro_particle_field_names.index(field),
+ len(castro_particle_field_names),
+ tr)
+ return tr
def _read_data_set(self, grid, field):
"""
--- a/yt/utilities/_amr_utils/fortran_reader.pyx Wed May 04 14:45:48 2011 -0400
+++ b/yt/utilities/_amr_utils/fortran_reader.pyx Wed May 04 15:47:24 2011 -0400
@@ -300,3 +300,22 @@
filled[offi, offj, offk] = 1
to_fill += 1
return to_fill
+
+ at cython.cdivision(True)
+ at cython.boundscheck(False)
+ at cython.wraparound(False)
+def read_castro_particles(char *fn, int offset, int fieldindex, int nfields,
+ np.ndarray[np.float64_t, ndim=1] tofill):
+ cdef int nparticles = tofill.shape[0]
+ cdef int i
+ cdef startskip = fieldindex*8
+ cdef endskip = (nfields - 1 - fieldindex)*8
+ cdef np.float64_t temp
+ cdef FILE *f = fopen(fn, 'r')
+ fseek(f, offset + 5*nparticles*4, 0) # 4 bytes
+ for i in range(nparticles):
+ fseek(f, startskip, SEEK_CUR)
+ fread(&temp, 8, 1, f)
+ tofill[i] = temp
+ fseek(f, endskip, SEEK_CUR)
+ fclose(f)
http://bitbucket.org/yt_analysis/yt/changeset/c4cdcdf381ee/
changeset: r4238:c4cdcdf381ee
branch: yt
user: MatthewTurk
date: 2011-05-04 21:59:27
summary: Fixing up Castro particles just enough to get HOP to run. Units are not currently correct.
affected #: 3 files (405 bytes)
--- a/yt/frontends/castro/data_structures.py Wed May 04 15:47:24 2011 -0400
+++ b/yt/frontends/castro/data_structures.py Wed May 04 15:59:27 2011 -0400
@@ -425,7 +425,8 @@
# and 3D fields.
self.pf.field_info.add_field(
field, lambda a, b: None,
- convert_function=cf, take_log=False)
+ convert_function=cf, take_log=False,
+ particle_type=True)
def _count_grids(self):
"""this is already provided in
--- a/yt/frontends/castro/definitions.py Wed May 04 15:47:24 2011 -0400
+++ b/yt/frontends/castro/definitions.py Wed May 04 15:59:27 2011 -0400
@@ -58,7 +58,6 @@
"NumberOfParticleAttributes": int,
}
-
# converts the Castro inputs file name to the Enzo/yt name expected
# throughout the code. key is Castro name, value is Enzo/yt equivalent
castro2enzoDict = {"amr.n_cell": "TopGridDimensions",
--- a/yt/frontends/castro/fields.py Wed May 04 15:47:24 2011 -0400
+++ b/yt/frontends/castro/fields.py Wed May 04 15:59:27 2011 -0400
@@ -142,3 +142,13 @@
def _Temperature(field, data):
return (data.pf["Gamma"]-1.0)*data.pf["mu"]*mh*data["ThermalEnergy"]/(kboltz*data["Density"])
add_field("Temperature", function=_Temperature, units=r"\rm{Kelvin}", take_log=False)
+
+def _convertParticleMassMsun(data):
+ return 1.0/1.989e33
+def _ParticleMassMsun(field, data):
+ return data["particle_mass"]
+add_field("ParticleMassMsun",
+ function=_ParticleMassMsun, validators=[ValidateSpatial(0)],
+ particle_type=True, convert_function=_convertParticleMassMsun,
+ particle_convert_function=_ParticleMassMsun)
+
http://bitbucket.org/yt_analysis/yt/changeset/6b310630e2f9/
changeset: r4239:6b310630e2f9
branch: yt
user: MatthewTurk
date: 2011-05-04 21:59:53
summary: Merging
affected #: 207 files (13.2 KB)
--- a/yt/__init__.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/__init__.py Wed May 04 15:59:53 2011 -0400
@@ -64,7 +64,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
@@ -94,8 +94,8 @@
recursive_bottom_clumps, \
clump_list_sort
-from .light_ray.api import \
- LightRay
+#from .light_ray.api import \
+# LightRay
from .light_cone.api import \
LightCone, \
--- a/yt/analysis_modules/coordinate_transformation/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/coordinate_transformation/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/coordinate_transformation/transforms.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/coordinate_transformation/transforms.py Wed May 04 15:59:53 2011 -0400
@@ -7,7 +7,7 @@
Organization: UC Berkeley
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk, J. S. Oishi. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk, J. S. Oishi. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/halo_finding/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/halo_finding/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/halo_finding/fof/EnzoFOF.c Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/halo_finding/fof/EnzoFOF.c Wed May 04 15:59:53 2011 -0400
@@ -1,5 +1,5 @@
/************************************************************************
-* Copyright (C) 2008-2009 Matthew Turk. All Rights Reserved.
+* Copyright (C) 2008-2011 Matthew Turk. All Rights Reserved.
*
* This file is part of yt.
*
--- a/yt/analysis_modules/halo_finding/halo_objects.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/halo_finding/halo_objects.py Wed May 04 15:59:53 2011 -0400
@@ -7,7 +7,7 @@
Affiliation: UCSD Physics/CASS
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2008-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/halo_finding/hop/EnzoHop.c Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/halo_finding/hop/EnzoHop.c Wed May 04 15:59:53 2011 -0400
@@ -1,5 +1,5 @@
/************************************************************************
-* Copyright (C) 2008-2009 Matthew Turk. All Rights Reserved.
+* Copyright (C) 2008-2011 Matthew Turk. All Rights Reserved.
*
* This file is part of yt.
*
--- a/yt/analysis_modules/halo_finding/parallel_hop/parallel_hop_interface.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/halo_finding/parallel_hop/parallel_hop_interface.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD/CASS
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Stephen Skory. All Rights Reserved.
+ Copyright (C) 2008-2011 Stephen Skory. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/halo_mass_function/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/halo_mass_function/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/halo_mass_function/halo_mass_function.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/halo_mass_function/halo_mass_function.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UC San Diego / CASS
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Stephen Skory (and others). All Rights Reserved.
+ Copyright (C) 2008-2011 Stephen Skory (and others). All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/halo_merger_tree/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/halo_merger_tree/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/halo_merger_tree/enzofof_merger_tree.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/halo_merger_tree/enzofof_merger_tree.py Wed May 04 15:59:53 2011 -0400
@@ -3,7 +3,7 @@
catalogs output by Enzo and then compare parent/child relationships.
Author: Matthew J. Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Author: John H. Wise <jwise at astro.princeton.edu>
Affiliation: Princeton
Homepage: http://yt.enzotools.org/
--- a/yt/analysis_modules/halo_merger_tree/merger_tree.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/halo_merger_tree/merger_tree.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: CASS/UC San Diego, CA
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2010 Stephen Skory. All Rights Reserved.
+ Copyright (C) 2008-2011 Stephen Skory. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/halo_profiler/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/halo_profiler/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/halo_profiler/halo_filters.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/halo_profiler/halo_filters.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: CASA/University of CO, Boulder
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Britton Smith. All Rights Reserved.
+ Copyright (C) 2008-2011 Britton Smith. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/halo_profiler/multi_halo_profiler.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/halo_profiler/multi_halo_profiler.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: CASA/University of CO, Boulder
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Britton Smith. All Rights Reserved.
+ Copyright (C) 2008-2011 Britton Smith. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/hierarchy_subset/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/hierarchy_subset/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/hierarchy_subset/hierarchy_subset.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/hierarchy_subset/hierarchy_subset.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2008-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/level_sets/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/level_sets/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/level_sets/clump_handling.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/level_sets/clump_handling.py Wed May 04 15:59:53 2011 -0400
@@ -4,7 +4,7 @@
Author: Britton Smith <Britton.Smith at colorado.edu>
Affiliation: University of Colorado at Boulder
License:
- Copyright (C) 2008-2009 Britton Smith. All Rights Reserved.
+ Copyright (C) 2008-2011 Britton Smith. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/level_sets/contour_finder.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/level_sets/contour_finder.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/light_cone/__init__.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/light_cone/__init__.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: CASA/University of CO, Boulder
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Britton Smith. All Rights Reserved.
+ Copyright (C) 2008-2011 Britton Smith. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/light_cone/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/light_cone/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/light_cone/common_n_volume.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/light_cone/common_n_volume.py Wed May 04 15:59:53 2011 -0400
@@ -6,7 +6,7 @@
Affiliation: CASA/University of CO, Boulder
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Britton Smith. All Rights Reserved.
+ Copyright (C) 2008-2011 Britton Smith. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/light_cone/halo_mask.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/light_cone/halo_mask.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: CASA/University of CO, Boulder
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Britton Smith. All Rights Reserved.
+ Copyright (C) 2008-2011 Britton Smith. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/light_cone/light_cone.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/light_cone/light_cone.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: CASA/University of CO, Boulder
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Britton Smith. All Rights Reserved.
+ Copyright (C) 2008-2011 Britton Smith. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/light_cone/light_cone_projection.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/light_cone/light_cone_projection.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: CASA/University of CO, Boulder
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Britton Smith. All Rights Reserved.
+ Copyright (C) 2008-2011 Britton Smith. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/light_cone/unique_solution.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/light_cone/unique_solution.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: CASA/University of CO, Boulder
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Britton Smith. All Rights Reserved.
+ Copyright (C) 2008-2011 Britton Smith. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/light_ray/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/light_ray/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/light_ray/light_ray.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/light_ray/light_ray.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: CASA/University of CO, Boulder
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Britton Smith. All Rights Reserved.
+ Copyright (C) 2008-2011 Britton Smith. All Rights Reserved.
This file is part of yt.
@@ -138,7 +138,7 @@
def make_light_ray(self, seed=None, fields=None,
solution_filename=None, data_filename=None,
- get_nearest_galaxy=False, **kwargs):
+ get_nearest_galaxy=False, get_los_velocity=False, **kwargs):
"Create a light ray and get field values for each lixel."
# Calculate solution.
@@ -153,6 +153,9 @@
if get_nearest_galaxy:
all_fields.extend(['x', 'y', 'z', 'nearest_galaxy', 'nearest_galaxy_mass'])
fields.extend(['x', 'y', 'z'])
+ if get_los_velocity:
+ all_fields.extend(['x-velocity', 'y-velocity', 'z-velocity', 'los_velocity'])
+ fields.extend(['x-velocity', 'y-velocity', 'z-velocity'])
todo = na.arange(my_rank, len(self.light_ray_solution), my_size)
for index in todo:
@@ -195,6 +198,17 @@
sub_data[field] = na.concatenate([sub_data[field],
(sub_ray[field])])
+ if get_los_velocity:
+ line_of_sight = sub_segment[1] - sub_segment[0]
+ line_of_sight /= ((line_of_sight**2).sum())**0.5
+ sub_vel = na.array([sub_ray['x-velocity'],
+ sub_ray['y-velocity'],
+ sub_ray['z-velocity']])
+ sub_data['los_velocity'] = na.concatenate([sub_data['los_velocity'],
+ (na.rollaxis(sub_vel, 1) *
+ line_of_sight).sum(axis=1)])
+ del sub_vel
+
sub_ray.clear_data()
del sub_ray
--- a/yt/analysis_modules/list_modules.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/list_modules.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/simulation_handler/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/simulation_handler/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/simulation_handler/enzo_simulation.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/simulation_handler/enzo_simulation.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: CASA/University of CO, Boulder
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Britton Smith. All Rights Reserved.
+ Copyright (C) 2008-2011 Britton Smith. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/spectral_integrator/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/spectral_integrator/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/spectral_integrator/spectral_frequency_integrator.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/spectral_integrator/spectral_frequency_integrator.py Wed May 04 15:59:53 2011 -0400
@@ -6,7 +6,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/star_analysis/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/star_analysis/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/star_analysis/sfr_spectrum.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/star_analysis/sfr_spectrum.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UC San Diego / CASS
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Stephen Skory (and others). All Rights Reserved.
+ Copyright (C) 2008-2011 Stephen Skory (and others). All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/sunrise_export/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/sunrise_export/api.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/sunrise_export/sunrise_exporter.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/sunrise_export/sunrise_exporter.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/two_point_functions/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/two_point_functions/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/analysis_modules/two_point_functions/two_point_functions.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/analysis_modules/two_point_functions/two_point_functions.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD Physics/CASS
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Stephen Skory. All Rights Reserved.
+ Copyright (C) 2010-2011 Stephen Skory. All Rights Reserved.
This file is part of yt.
--- a/yt/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/arraytypes.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/arraytypes.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/astro_objects/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/astro_objects/api.py Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
API for yt.astro_objects
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
--- a/yt/astro_objects/astrophysical_object.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/astro_objects/astrophysical_object.py Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
A base-class representing an astrophysical object
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
--- a/yt/astro_objects/clumped_region.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/astro_objects/clumped_region.py Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
A base-class representing an astrophysical object
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
--- a/yt/astro_objects/simulation_volume.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/astro_objects/simulation_volume.py Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
An AstrophysicalObject that represents a simulation volume
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
--- a/yt/config.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/config.py Wed May 04 15:59:53 2011 -0400
@@ -7,7 +7,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/convenience.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/convenience.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/data_objects/analyzer_objects.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/data_objects/analyzer_objects.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/data_objects/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/data_objects/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/data_objects/data_containers.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/data_objects/data_containers.py Wed May 04 15:59:53 2011 -0400
@@ -7,7 +7,7 @@
Affiliation: University of Colorado at Boulder
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
@@ -626,7 +626,10 @@
grid.child_mask)
if field == 'dts': return self._dts[grid.id][mask]
if field == 't': return self._ts[grid.id][mask]
- return grid[field][mask]
+ gf = grid[field]
+ if not iterable(gf):
+ gf = gf * na.ones(grid.child_mask.shape)
+ return gf[mask]
@cache_mask
def _get_cut_mask(self, grid):
@@ -2906,7 +2909,7 @@
"""
AMR3DData.__init__(self, center, fields, pf, **kwargs)
# Unpack the radius, if necessary
- if isinstance(radius, tuple) and len(radius) == 2 and \
+ if isinstance(radius, (list, tuple)) and len(radius) == 2 and \
isinstance(radius[1], types.StringTypes):
radius = radius[0]/self.pf[radius[1]]
if radius < self.hierarchy.get_smallest_dx():
--- a/yt/data_objects/derived_quantities.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/data_objects/derived_quantities.py Wed May 04 15:59:53 2011 -0400
@@ -7,7 +7,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/data_objects/field_info_container.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/data_objects/field_info_container.py Wed May 04 15:59:53 2011 -0400
@@ -7,7 +7,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2008-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/data_objects/grid_patch.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/data_objects/grid_patch.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/data_objects/hierarchy.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/data_objects/hierarchy.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/data_objects/object_finding_mixin.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/data_objects/object_finding_mixin.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/data_objects/profiles.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/data_objects/profiles.py Wed May 04 15:59:53 2011 -0400
@@ -7,7 +7,7 @@
Affiliation: CASA, University of Colorado at Boulder
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/data_objects/static_output.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/data_objects/static_output.py Wed May 04 15:59:53 2011 -0400
@@ -6,7 +6,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk, J. S. Oishi. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk, J. S. Oishi. All Rights Reserved.
This file is part of yt.
--- a/yt/data_objects/time_series.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/data_objects/time_series.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/data_objects/universal_fields.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/data_objects/universal_fields.py Wed May 04 15:59:53 2011 -0400
@@ -7,7 +7,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2008-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/art/__init__.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/art/__init__.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/art/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/art/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/art/data_structures.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/art/data_structures.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
@@ -124,9 +124,9 @@
def _detect_fields(self):
# This will need to be generalized to be used elsewhere.
- self.field_list = [ 'Density','Total_Energy',
+ self.field_list = [ 'Density','TotalEnergy',
'x-momentum','y-momentum','z-momentum',
- 'Pressure','Gamma','Gas_Energy',
+ 'Pressure','Gamma','GasEnergy',
'Metal_DensitySNII', 'Metal_DensitySNIa',
'Potential_New','Potential_Old']
@@ -434,7 +434,7 @@
self.tr = 2./3. *(3.03e5*self.r0**2.0*wmu*self.omega_matter)*(1.0/(aexpn**2))
self.conversion_factors["Density"] = \
self.rho0*(aexpn**-3.0)
- self.conversion_factors["Gas_Energy"] = \
+ self.conversion_factors["GasEnergy"] = \
self.rho0*self.v0**2*(aexpn**-5.0)
tr = self.tr
self.conversion_factors["Temperature"] = tr
--- a/yt/frontends/art/fields.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/art/fields.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
@@ -45,13 +45,13 @@
add_field = add_art_field
translation_dict = {"Density":"density",
- "Total_Energy":"Total_Energy",
+ "TotalEnergy":"TotalEnergy",
"x-velocity":"velocity_x",
"y-velocity":"velocity_y",
"z-velocity":"velocity_z",
"Pressure":"pressure",
"Metallicity":"metallicity",
- "Gas_Energy":"Gas_Energy"
+ "GasEnergy":"GasEnergy"
}
def _generate_translation(mine, theirs):
@@ -78,13 +78,13 @@
ARTFieldInfo["Density"]._convert_function=_convertDensity
def _convertEnergy(data):
- return data.convert("Gas_Energy")
-ARTFieldInfo["Gas_Energy"]._units = r"\rm{ergs}/\rm{g}"
-ARTFieldInfo["Gas_Energy"]._convert_function=_convertEnergy
+ return data.convert("GasEnergy")
+ARTFieldInfo["GasEnergy"]._units = r"\rm{ergs}/\rm{g}"
+ARTFieldInfo["GasEnergy"]._convert_function=_convertEnergy
def _Temperature(field, data):
- tr = data["Gas_Energy"] / data["Density"]
- tr /= data.pf.conversion_factors["Gas_Energy"]
+ tr = data["GasEnergy"] / data["Density"]
+ tr /= data.pf.conversion_factors["GasEnergy"]
tr *= data.pf.conversion_factors["Density"]
return tr
def _convertTemperature(data):
--- a/yt/frontends/art/io.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/art/io.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/chombo/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/chombo/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.Chombotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/chombo/data_structures.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/chombo/data_structures.py Wed May 04 15:59:53 2011 -0400
@@ -6,7 +6,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2010 Matthew Turk, J. S. Oishi. All Rights Reserved.
+ Copyright (C) 2008-2011 Matthew Turk, J. S. Oishi. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/chombo/definitions.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/chombo/definitions.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-20010 J.S. Oishi. All Rights Reserved.
+ Copyright (C) 2008-2011 J.S. Oishi. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/chombo/fields.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/chombo/fields.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2009-2010 J. S. Oishi, Matthew Turk. All Rights Reserved.
+ Copyright (C) 2009-2011 J. S. Oishi, Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/chombo/io.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/chombo/io.py Wed May 04 15:59:53 2011 -0400
@@ -6,7 +6,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/enzo/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/enzo/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/enzo/data_structures.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/enzo/data_structures.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/enzo/definitions.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/enzo/definitions.py Wed May 04 15:59:53 2011 -0400
@@ -6,7 +6,7 @@
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/enzo/fields.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/enzo/fields.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2008-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
@@ -125,12 +125,12 @@
def _ThermalEnergy(field, data):
if data.pf["HydroMethod"] == 2:
- return data["Total_Energy"]
+ return data["TotalEnergy"]
else:
if data.pf["DualEnergyFormalism"]:
return data["GasEnergy"]
else:
- return data["Total_Energy"] - 0.5*(
+ return data["TotalEnergy"] - 0.5*(
data["x-velocity"]**2.0
+ data["y-velocity"]**2.0
+ data["z-velocity"]**2.0 )
@@ -154,9 +154,7 @@
def _convertEnergy(data):
return data.convert("x-velocity")**2.0
-def _GasEnergy(field, data):
- return data["Gas_Energy"] / _convertEnergy(data)
-add_field("GasEnergy", function=_GasEnergy,
+add_field("GasEnergy", function=lambda a, b: None,
units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
def _Gas_Energy(field, data):
@@ -164,9 +162,7 @@
add_field("Gas_Energy", function=_Gas_Energy,
units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
-def _TotalEnergy(field, data):
- return data["Total_Energy"] / _convertEnergy(data)
-add_field("TotalEnergy", function=_TotalEnergy,
+add_field("TotalEnergy", function=lambda a, b: None,
display_name = "\mathrm{Total}\/\mathrm{Energy}",
units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
--- a/yt/frontends/enzo/io.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/enzo/io.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/enzo/misc.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/enzo/misc.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2008-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/flash/__init__.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/flash/__init__.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/flash/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/flash/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/flash/data_structures.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/flash/data_structures.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/flash/fields.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/flash/fields.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk, John ZuHone. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk, John ZuHone. All Rights Reserved.
This file is part of yt.
@@ -61,8 +61,8 @@
"y-velocity": "vely",
"z-velocity": "velz",
"Density": "dens",
- "Total_Energy": "ener",
- "Gas_Energy": "eint",
+ "TotalEnergy": "ener",
+ "GasEnergy": "eint",
"Temperature": "temp",
"particle_position_x" : "particle_posx",
"particle_position_y" : "particle_posy",
--- a/yt/frontends/flash/io.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/flash/io.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/gadget/__init__.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/gadget/__init__.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/gadget/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/gadget/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/gadget/data_structures.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/gadget/data_structures.py Wed May 04 15:59:53 2011 -0400
@@ -7,7 +7,7 @@
Affiliation: UCSC
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/gadget/fields.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/gadget/fields.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UC Santa Cruz
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Christopher E Moody, Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Christopher E Moody, Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/gadget/io.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/gadget/io.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UC Santa Cruz
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Christopher E Moody, Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Christopher E Moody, Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/gdf/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/gdf/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.Chombotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/gdf/data_structures.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/gdf/data_structures.py Wed May 04 15:59:53 2011 -0400
@@ -6,7 +6,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2010 Matthew Turk, J. S. Oishi. All Rights Reserved.
+ Copyright (C) 2008-2011 Matthew Turk, J. S. Oishi. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/gdf/definitions.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/gdf/definitions.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-20010 J.S. Oishi. All Rights Reserved.
+ Copyright (C) 2008-2011 J.S. Oishi. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/gdf/fields.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/gdf/fields.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2009-2010 J. S. Oishi, Matthew Turk. All Rights Reserved.
+ Copyright (C) 2009-2011 J. S. Oishi, Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/gdf/io.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/gdf/io.py Wed May 04 15:59:53 2011 -0400
@@ -6,7 +6,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/maestro/__init__.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/maestro/__init__.py Wed May 04 15:59:53 2011 -0400
@@ -11,7 +11,7 @@
Affiliation: SUNY Stony Brook
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/maestro/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/maestro/api.py Wed May 04 15:59:53 2011 -0400
@@ -11,7 +11,7 @@
Affiliation: SUNY Stony Brook
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/maestro/data_structures.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/maestro/data_structures.py Wed May 04 15:59:53 2011 -0400
@@ -7,7 +7,7 @@
Affiliation: SUNY Stony Brook
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2010 J. S. Oishi. All Rights Reserved.
+ Copyright (C) 2008-2011 J. S. Oishi. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/maestro/definitions.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/maestro/definitions.py Wed May 04 15:59:53 2011 -0400
@@ -8,7 +8,7 @@
Affiliation: SUNY Stony Brook
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-20010 J.S. Oishi. All Rights Reserved.
+ Copyright (C) 2008-2011 J.S. Oishi. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/maestro/fields.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/maestro/fields.py Wed May 04 15:59:53 2011 -0400
@@ -7,7 +7,7 @@
Affiliation: SUNY Stony Brook
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2010 J. S. Oishi, Matthew Turk. All Rights Reserved.
+ Copyright (C) 2008-2011 J. S. Oishi, Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/maestro/io.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/maestro/io.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: SUNY Stony Brook
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/orion/__init__.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/orion/__init__.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/orion/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/orion/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/orion/data_structures.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/orion/data_structures.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2010 J. S. Oishi. All Rights Reserved.
+ Copyright (C) 2008-2011 J. S. Oishi. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/orion/definitions.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/orion/definitions.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-20010 J.S. Oishi. All Rights Reserved.
+ Copyright (C) 2008-2011 J.S. Oishi. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/orion/fields.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/orion/fields.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UC Berkeley
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2010 J. S. Oishi, Matthew Turk. All Rights Reserved.
+ Copyright (C) 2008-2011 J. S. Oishi, Matthew Turk. All Rights Reserved.
This file is part of yt.
@@ -73,7 +73,7 @@
"y-velocity": "yvel",
"z-velocity": "zvel",
"Density": "density",
- "Total_Energy": "eden",
+ "TotalEnergy": "eden",
"Temperature": "temperature",
"x-momentum": "xmom",
"y-momentum": "ymom",
@@ -123,9 +123,9 @@
leave that commented out for now.
"""
#if data.pf["DualEnergyFormalism"]:
- # return data["Gas_Energy"]
+ # return data["GasEnergy"]
#else:
- return data["Total_Energy"] - 0.5 * data["density"] * (
+ return data["TotalEnergy"] - 0.5 * data["density"] * (
data["x-velocity"]**2.0
+ data["y-velocity"]**2.0
+ data["z-velocity"]**2.0 )
--- a/yt/frontends/orion/io.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/orion/io.py Wed May 04 15:59:53 2011 -0400
@@ -6,7 +6,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/ramses/__init__.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/ramses/__init__.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/ramses/_ramses_reader.pyx Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/ramses/_ramses_reader.pyx Wed May 04 15:59:53 2011 -0400
@@ -7,7 +7,7 @@
Affiliation: KIPAC / Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/ramses/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/ramses/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/ramses/data_structures.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/ramses/data_structures.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/ramses/fields.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/ramses/fields.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/ramses/io.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/ramses/io.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/tiger/__init__.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/tiger/__init__.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/tiger/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/tiger/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/tiger/data_structures.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/tiger/data_structures.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/tiger/fields.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/tiger/fields.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/frontends/tiger/io.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/frontends/tiger/io.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/funcs.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/funcs.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
@@ -124,7 +124,10 @@
"""
Returning resident size in megabytes
"""
- pagesize = resource.getpagesize()
+ try:
+ pagesize = resource.getpagesize()
+ except NameError:
+ return 0
pid = os.getpid()
status_file = "/proc/%s/statm" % (pid)
if not os.path.isfile(status_file):
--- a/yt/gui/opengl_widgets/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/gui/opengl_widgets/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/gui/opengl_widgets/mip_viewer.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/gui/opengl_widgets/mip_viewer.py Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
Author: Matthew Turk <matthewturk at gmail.com>
Affiliation: UCSD
License:
- Copyright (C) 2010 Matthew Turk All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk All Rights Reserved.
This file is part of yt.
--- a/yt/gui/opengl_widgets/rendering_contexts.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/gui/opengl_widgets/rendering_contexts.py Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
Author: Matthew Turk <matthewturk at gmail.com>
Affiliation: UCSD
License:
- Copyright (C) 2010 Matthew Turk All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk All Rights Reserved.
This file is part of yt.
--- a/yt/gui/opengl_widgets/small_apps.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/gui/opengl_widgets/small_apps.py Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
Author: Matthew Turk <matthewturk at gmail.com>
Affiliation: UCSD
License:
- Copyright (C) 2010 Matthew Turk All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk All Rights Reserved.
This file is part of yt.
--- a/yt/gui/reason/basic_repl.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/gui/reason/basic_repl.py Wed May 04 15:59:53 2011 -0400
@@ -4,7 +4,7 @@
with the terms of its original license.
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
--- a/yt/gui/reason/bottle_mods.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py Wed May 04 15:59:53 2011 -0400
@@ -3,7 +3,7 @@
yt's purposes
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
@@ -136,10 +136,10 @@
return rv
def uuid_serve_functions(pre_routed = None, open_browser=False, port=9099,
- repl = None):
+ repl = None, token = None):
if pre_routed == None: pre_routed = route_functions
debug(mode=True)
- token = uuid.uuid1()
+ if token is None: token = uuid.uuid1()
for r in pre_routed:
args, kwargs, f = pre_routed[r]
if r[0] == "/": r = r[1:]
--- a/yt/gui/reason/extdirect_repl.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py Wed May 04 15:59:53 2011 -0400
@@ -3,7 +3,7 @@
commands through ExtDirect calls
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
@@ -35,6 +35,10 @@
import urllib2
import pprint
import traceback
+import tempfile
+import base64
+import imp
+import threading
from yt.funcs import *
from yt.utilities.logger import ytLogger, ufstring
@@ -46,7 +50,6 @@
PayloadHandler
from .bottle import response, request, route
from .basic_repl import ProgrammaticREPL
-import threading
try:
import pygments
@@ -92,6 +95,54 @@
lockit = MethodLock()
+def deliver_image(im):
+ if hasattr(im, 'read'):
+ img_data = base64.b64encode(im.read())
+ elif isinstance(im, types.StringTypes) and \
+ im.endswith(".png"):
+ img_data = base64.b64encode(open(im).read())
+ elif isinstance(im, types.StringTypes):
+ img_data = im
+ else:
+ raise RuntimeError
+ ph = PayloadHandler()
+ payload = {'type':'png_string',
+ 'image_data':img_data}
+ ph.add_payload(payload)
+
+def reason_pylab():
+ def _canvas_deliver(canvas):
+ tf = tempfile.TemporaryFile()
+ canvas.print_png(tf)
+ tf.seek(0)
+ img_data = base64.b64encode(tf.read())
+ tf.close()
+ deliver_image(img_data)
+ def reason_draw_if_interactive():
+ if matplotlib.is_interactive():
+ figManager = Gcf.get_active()
+ if figManager is not None:
+ _canvas_deliver(figManager.canvas)
+ def reason_show(mainloop = True):
+ # We ignore mainloop here
+ for manager in Gcf.get_all_fig_managers():
+ _canvas_deliver(manager.canvas)
+ # Matplotlib has very nice backend overriding.
+ # We should really use that. This is just a hack.
+ import matplotlib
+ new_agg = imp.new_module("reason_agg")
+ import matplotlib.backends.backend_agg as bagg
+ new_agg.__dict__.update(bagg.__dict__)
+ new_agg.__dict__.update(
+ {'show': reason_show,
+ 'draw_if_interactive': reason_draw_if_interactive})
+ sys.modules["reason_agg"] = new_agg
+ bagg.draw_if_interactive = reason_draw_if_interactive
+ from matplotlib._pylab_helpers import Gcf
+ import pylab, matplotlib
+ matplotlib.rcParams["backend"] = "module://reason_agg"
+ pylab.switch_backend("module://reason_agg")
+
class ExtDirectREPL(ProgrammaticREPL, BottleDirectRouter):
_skip_expose = ('index')
my_name = "ExtDirectREPL"
@@ -132,9 +183,12 @@
self.payload_handler = PayloadHandler()
# Now we load up all the yt.mods stuff, but only after we've finished
# setting up.
- self.execute("from yt.mods import *")
+ reason_pylab()
+ self.execute("from yt.mods import *\nimport pylab\npylab.ion()")
self.execute("from yt.data_objects.static_output import _cached_pfs", hide = True)
+ self.execute("data_objects = []", hide = True)
self.locals['load_script'] = ext_load_script
+ self.locals['deliver_image'] = deliver_image
self._setup_logging_handlers()
# Setup our heartbeat
@@ -380,8 +434,7 @@
DLE, DRE = _tpf.domain_left_edge, _tpf.domain_right_edge
from yt.visualization.plot_window import PWViewerExtJS
_tpw = PWViewerExtJS(_tsl, (DLE[_txax], DRE[_txax], DLE[_tyax], DRE[_tyax]), setup = False)
- _tpw._current_field = _tfield
- _tpw._field_transform["%(field)s"] = na.log
+ _tpw.set_current_field("%(field)s")
_tfield_list = list(set(_tpf.h.field_list + _tpf.h.derived_field_list))
_tfield_list.sort()
_tcb = _tpw._get_cbar_image()
@@ -420,8 +473,7 @@
DLE, DRE = _tpf.domain_left_edge, _tpf.domain_right_edge
from yt.visualization.plot_window import PWViewerExtJS
_tpw = PWViewerExtJS(_tsl, (DLE[_txax], DRE[_txax], DLE[_tyax], DRE[_tyax]), setup = False)
- _tpw._current_field = _tfield
- _tpw.set_log(_tfield, True)
+ _tpw.set_current_field("%(field)s")
_tfield_list = list(set(_tpf.h.field_list + _tpf.h.derived_field_list))
_tfield_list.sort()
_tcb = _tpw._get_cbar_image()
@@ -555,6 +607,24 @@
self.execute("%s = None\n" % (varname), hide=True)
self.payload_handler.add_payload(payload)
+ @lockit
+ def object_creator(self, pfname, objtype, objargs):
+ funccall = "_tobjargs = {}\n"
+ for argname, argval in objargs.items():
+ # These arguments may need further sanitization
+ if isinstance(argval, types.StringTypes):
+ argval = "'%s'" % argval
+ funccall += "_tobjargs['%(argname)s'] = %(argval)s\n" % dict(
+ argname = argname, argval = argval)
+ funccall += """
+ _tpf = %(pfname)s
+ _tobjclass = getattr(_tpf.h, '%(objtype)s')
+ data_objects.append(_tobjclass(**_tobjargs))
+ """ % dict(pfname = pfname, objtype = objtype)
+ funccall = "\n".join((line.strip() for line in funccall.splitlines()))
+ self.execute(funccall, hide = False)
+ pf = self.locals['_tpf']
+
class ExtDirectParameterFileList(BottleDirectRouter):
my_name = "ExtDirectParameterFileList"
api_url = "pflist"
--- a/yt/gui/reason/html/js/functions.js Wed May 04 15:59:27 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js Wed May 04 15:59:53 2011 -0400
@@ -8,7 +8,7 @@
Author: Britton Smith <brittonsmith at gmail.com>
Affiliation: MSU
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
@@ -476,3 +476,111 @@
}
return projectionHandler;
}
+
+function getSphereCreator(node){
+function sphereCreator(item,pressed){
+ var win = new Ext.Window({
+ layout:'fit',
+ width:320,
+ height:250,
+ modal:true,
+ resizable:false,
+ draggable:false,
+ border:false,
+ title:'Sphere Creator ' + node,
+ items: [{
+ xtype: 'form', // FormPanel
+ labelWidth:80,
+ frame:true,
+ items: [{
+ xtype:'textfield',
+ fieldLabel: 'Center X',
+ id: 'slice_x_center',
+ value: '0.5',
+ width: 90,
+ allowBlank:false,
+ },{
+ xtype:'textfield',
+ fieldLabel: 'Center Y',
+ id: 'slice_y_center',
+ value: '0.5',
+ width: 90,
+ allowBlank:false,
+ },{
+ xtype:'textfield',
+ fieldLabel: 'Center Z',
+ id: 'slice_z_center',
+ value: '0.5',
+ width: 90,
+ allowBlank:false,
+ },{
+ xtype:'textfield',
+ fieldLabel: 'Radius',
+ id: 'radius_value',
+ value: '0.5',
+ width: 90,
+ allowBlank:false,
+ },{
+ xtype:'combo',
+ fieldLabel: 'Unit',
+ id: 'radius_unit',
+ store:['unitary', '1', 'mpc', 'kpc', 'pc', 'au', 'rsun', 'cm'],
+ width: 90,
+ allowBlank:false,
+ value: 'Unitary',
+ triggerAction: 'all',
+ },{
+ xtype:'checkbox',
+ fieldLabel: 'Center on Max',
+ id: 'max_dens',
+ width: 90,
+ allowBlank:false,
+ handler: function(checkbox, checked) {
+ if (checked == true) {
+ this.ownerCt.get("slice_x_center").disable();
+ this.ownerCt.get("slice_y_center").disable();
+ this.ownerCt.get("slice_z_center").disable();
+ } else {
+ this.ownerCt.get("slice_x_center").enable();
+ this.ownerCt.get("slice_y_center").enable();
+ this.ownerCt.get("slice_z_center").enable();
+ }
+ }
+ }],
+ buttons: [
+ {
+ text: 'Slice',
+ handler: function(b, e){
+ var center = [Ext.get("slice_x_center").getValue(),
+ Ext.get("slice_y_center").getValue(),
+ Ext.get("slice_z_center").getValue()];
+ var onmax = Ext.get("max_dens").getValue();
+ var radius = [Ext.get("radius_value").getValue(),
+ Ext.get("radius_unit").getValue()]
+ objargs = {radius: radius}
+ if (onmax == true) {
+ objargs['center'] = 'max';
+ } else {
+ objargs['center'] = center;
+ }
+ yt_rpc.ExtDirectREPL.object_creator({
+ pfname:node.attributes.objdata.varname,
+ objtype:'sphere', objargs:objargs},
+ handle_result);
+ disable_input();
+ win.close();
+ }
+ },{
+ text: 'Cancel',
+ handler: function(b, e){
+ win.close();
+
+ }
+ }
+ ]
+ }]
+ });
+ win.show(this);
+}
+return sphereCreator;
+}
--- a/yt/gui/reason/html/js/menu_items.js Wed May 04 15:59:27 2011 -0400
+++ b/yt/gui/reason/html/js/menu_items.js Wed May 04 15:59:53 2011 -0400
@@ -8,7 +8,7 @@
Author: Britton Smith <brittonsmith at gmail.com>
Affiliation: MSU
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
--- a/yt/gui/reason/html/js/reason.js Wed May 04 15:59:27 2011 -0400
+++ b/yt/gui/reason/html/js/reason.js Wed May 04 15:59:53 2011 -0400
@@ -8,7 +8,7 @@
Author: Britton Smith <brittonsmith at gmail.com>
Affiliation: MSU
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
@@ -168,6 +168,9 @@
}, {
text: 'Open projection',
handler: getProjectionHandler(node),
+ /*}, {
+ text: 'Create Sphere',
+ handler: getSphereCreator(node), */
}, {
text: 'View Streamlines',
handler: getStreamlineViewerHandler(node),
--- a/yt/gui/reason/html/js/widget_griddata.js Wed May 04 15:59:27 2011 -0400
+++ b/yt/gui/reason/html/js/widget_griddata.js Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
The Plot Window Widget
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
--- a/yt/gui/reason/html/js/widget_gridviewer.js Wed May 04 15:59:27 2011 -0400
+++ b/yt/gui/reason/html/js/widget_gridviewer.js Wed May 04 15:59:53 2011 -0400
@@ -4,7 +4,7 @@
Author: Samuel Skillman <samskillman at gmail.com>
Affiliation: University of Colorado at Boulder
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
--- a/yt/gui/reason/html/js/widget_phaseplot.js Wed May 04 15:59:27 2011 -0400
+++ b/yt/gui/reason/html/js/widget_phaseplot.js Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
The Plot Window Widget
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
--- a/yt/gui/reason/html/js/widget_plotwindow.js Wed May 04 15:59:27 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js Wed May 04 15:59:53 2011 -0400
@@ -8,7 +8,7 @@
Author: Britton Smith <brittonsmith at gmail.com>
Affiliation: MSU
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
@@ -114,10 +114,10 @@
xtype: 'panel',
id: 'ticks_' + python_varname,
layout: 'absolute',
- y: 10,
+ y: 0,
x: 540,
- width: 40,
- height: 400,
+ width: 100,
+ height: 420,
items : [],
border: false,
}, { xtype: 'multislider',
@@ -334,9 +334,9 @@
xtype: 'panel',
layout: 'vbox',
id: 'rhs_panel_' + python_varname,
- width: 300,
+ width: 250,
height: 460,
- x: 590, y: 10,
+ x: 690, y: 10,
layoutConfig: {
align: 'stretch',
pack: 'start',
@@ -383,21 +383,22 @@
metadata_string = payload['metadata_string'];
ticks.removeAll();
Ext.each(payload['ticks'], function(tick, index) {
+ console.log(tick);
ticks.add({xtype:'panel',
width: 10, height:1,
style: 'background-color: #000000;',
html:' ',
- x:0, y: tick[0]});
+ x:0, y: 10 + tick[0]});
ticks.add({xtype:'panel',
- width: 30, height:15,
+ width: 90, height:15,
border: false,
style: 'font-family: "Inconsolata", monospace;' +
'font-size: 12px;',
- html: ' ' + tick[2] + ' ',
- x:12, y: tick[0]-6});
+ html: '' + tick[2] + '',
+ x:12, y: 4 + tick[0]});
examine = tick;
});
- //examine = ticks;
+ examine = payload['ticks'];
ticks.doLayout();
}
--- a/yt/gui/reason/html/js/widget_progressbar.js Wed May 04 15:59:27 2011 -0400
+++ b/yt/gui/reason/html/js/widget_progressbar.js Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
The Plot Window Widget
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
--- a/yt/gui/reason/html/js/widget_streamlineviewer.js Wed May 04 15:59:27 2011 -0400
+++ b/yt/gui/reason/html/js/widget_streamlineviewer.js Wed May 04 15:59:53 2011 -0400
@@ -4,7 +4,7 @@
Author: Samuel Skillman <samskillman at gmail.com>
Affiliation: University of Colorado at Boulder
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
--- a/yt/gui/reason/http_repl.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/gui/reason/http_repl.py Wed May 04 15:59:53 2011 -0400
@@ -3,7 +3,7 @@
commands through HTTP
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
--- a/yt/gui/traited_explorer/tvtk_interface.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/gui/traited_explorer/tvtk_interface.py Wed May 04 15:59:53 2011 -0400
@@ -7,7 +7,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/mods.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/mods.py Wed May 04 15:59:53 2011 -0400
@@ -6,7 +6,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2008-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
@@ -95,7 +95,8 @@
from yt.visualization.api import \
PlotCollection, PlotCollectionInteractive, \
get_multi_plot, FixedResolutionBuffer, ObliqueFixedResolutionBuffer, \
- callback_registry, write_bitmap, write_image, annotate_image
+ callback_registry, write_bitmap, write_image, annotate_image, \
+ apply_colormap
from yt.visualization.volume_rendering.api import \
ColorTransferFunction, PlanckTransferFunction, ProjectionTransferFunction, \
--- a/yt/utilities/_amr_utils/ContourFinding.pyx Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_amr_utils/ContourFinding.pyx Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/_amr_utils/Octree.pyx Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_amr_utils/Octree.pyx Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/_amr_utils/QuadTree.pyx Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_amr_utils/QuadTree.pyx Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/_amr_utils/fortran_reader.pyx Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_amr_utils/fortran_reader.pyx Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/_amr_utils/freetype_includes.h Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_amr_utils/freetype_includes.h Wed May 04 15:59:53 2011 -0400
@@ -1,5 +1,5 @@
/************************************************************************
-* Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+* Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
*
* This file is part of yt.
*
--- a/yt/utilities/_amr_utils/freetype_writer.pyx Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_amr_utils/freetype_writer.pyx Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/_amr_utils/healpix_interface.pxd Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_amr_utils/healpix_interface.pxd Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
A light interface to a few HEALPix routines
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
--- a/yt/utilities/_amr_utils/kdtree.c Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_amr_utils/kdtree.c Wed May 04 15:59:53 2011 -0400
@@ -1,6 +1,6 @@
/*
This file is part of ``kdtree'', a library for working with kd-trees.
-Copyright (C) 2007-2009 John Tsiombikas <nuclear at siggraph.org>
+Copyright (C) 2007-2011 John Tsiombikas <nuclear at siggraph.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
--- a/yt/utilities/_amr_utils/kdtree.h Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_amr_utils/kdtree.h Wed May 04 15:59:53 2011 -0400
@@ -1,6 +1,6 @@
/*
This file is part of ``kdtree'', a library for working with kd-trees.
-Copyright (C) 2007-2009 John Tsiombikas <nuclear at siggraph.org>
+Copyright (C) 2007-2011 John Tsiombikas <nuclear at siggraph.org>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
--- a/yt/utilities/_amr_utils/kdtree_utils.pxd Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_amr_utils/kdtree_utils.pxd Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
A light interface to kdtree, from http://code.google.com/p/kdtree/
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
--- a/yt/utilities/_amr_utils/png_writer.pyx Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_amr_utils/png_writer.pyx Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/_libconfig/libconfig.c Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_libconfig/libconfig.c Wed May 04 15:59:53 2011 -0400
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
libconfig - A library for processing structured configuration files
- Copyright (C) 2005-2010 Mark A Lindner
+ Copyright (C) 2005-2011 Mark A Lindner
This file is part of libconfig.
--- a/yt/utilities/_libconfig/libconfig.h Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_libconfig/libconfig.h Wed May 04 15:59:53 2011 -0400
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
libconfig - A library for processing structured configuration files
- Copyright (C) 2005-2010 Mark A Lindner
+ Copyright (C) 2005-2011 Mark A Lindner
This file is part of libconfig.
--- a/yt/utilities/_libconfig/parsectx.h Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_libconfig/parsectx.h Wed May 04 15:59:53 2011 -0400
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
libconfig - A library for processing structured configuration files
- Copyright (C) 2005-2010 Mark A Lindner
+ Copyright (C) 2005-2011 Mark A Lindner
This file is part of libconfig.
--- a/yt/utilities/_libconfig/scanctx.c Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_libconfig/scanctx.c Wed May 04 15:59:53 2011 -0400
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
libconfig - A library for processing structured configuration files
- Copyright (C) 2005-2010 Mark A Lindner
+ Copyright (C) 2005-2011 Mark A Lindner
This file is part of libconfig.
--- a/yt/utilities/_libconfig/scanctx.h Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_libconfig/scanctx.h Wed May 04 15:59:53 2011 -0400
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
libconfig - A library for processing structured configuration files
- Copyright (C) 2005-2010 Mark A Lindner
+ Copyright (C) 2005-2011 Mark A Lindner
This file is part of libconfig.
--- a/yt/utilities/_libconfig/scanner.c Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_libconfig/scanner.c Wed May 04 15:59:53 2011 -0400
@@ -542,7 +542,7 @@
/* -*- mode: C -*- */
/* --------------------------------------------------------------------------
libconfig - A library for processing structured configuration files
- Copyright (C) 2005-2010 Mark A Lindner
+ Copyright (C) 2005-2011 Mark A Lindner
This file is part of libconfig.
--- a/yt/utilities/_libconfig/scanner.l Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_libconfig/scanner.l Wed May 04 15:59:53 2011 -0400
@@ -1,7 +1,7 @@
/* -*- mode: C -*- */
/* --------------------------------------------------------------------------
libconfig - A library for processing structured configuration files
- Copyright (C) 2005-2010 Mark A Lindner
+ Copyright (C) 2005-2011 Mark A Lindner
This file is part of libconfig.
--- a/yt/utilities/_libconfig/strbuf.c Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_libconfig/strbuf.c Wed May 04 15:59:53 2011 -0400
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
libconfig - A library for processing structured configuration files
- Copyright (C) 2005-2010 Mark A Lindner
+ Copyright (C) 2005-2011 Mark A Lindner
This file is part of libconfig.
--- a/yt/utilities/_libconfig/strbuf.h Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_libconfig/strbuf.h Wed May 04 15:59:53 2011 -0400
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
libconfig - A library for processing structured configuration files
- Copyright (C) 2005-2010 Mark A Lindner
+ Copyright (C) 2005-2011 Mark A Lindner
This file is part of libconfig.
--- a/yt/utilities/_libconfig/wincompat.h Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/_libconfig/wincompat.h Wed May 04 15:59:53 2011 -0400
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
libconfig - A library for processing structured configuration files
- Copyright (C) 2005-2010 Mark A Lindner
+ Copyright (C) 2005-2011 Mark A Lindner
This file is part of libconfig.
--- a/yt/utilities/amr_kdtree/amr_kdtree.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/amr_kdtree/amr_kdtree.py Wed May 04 15:59:53 2011 -0400
@@ -8,7 +8,7 @@
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Samuel Skillman. All Rights Reserved.
+ Copyright (C) 2010-2011 Samuel Skillman. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/amr_kdtree/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/amr_kdtree/api.py Wed May 04 15:59:53 2011 -0400
@@ -8,7 +8,7 @@
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Samuel Skillman. All Rights Reserved.
+ Copyright (C) 2010-2011 Samuel Skillman. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/answer_testing/__init__.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/answer_testing/__init__.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/answer_testing/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/answer_testing/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/answer_testing/default_tests.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/answer_testing/default_tests.py Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
Default tests
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
--- a/yt/utilities/answer_testing/hydro_tests.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/answer_testing/hydro_tests.py Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
Hydro tests
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
--- a/yt/utilities/answer_testing/output_tests.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/answer_testing/output_tests.py Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
Base classes for answer testing
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
--- a/yt/utilities/answer_testing/runner.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/answer_testing/runner.py Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
Runner mechanism for answer testing
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
--- a/yt/utilities/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/command_line.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/command_line.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2008-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
@@ -939,6 +939,13 @@
sock.bind(('', 0))
opts.port = sock.getsockname()[-1]
del sock
+ elif opts.port == '-1':
+ port = raw_input("Desired yt port? ")
+ try:
+ opts.port = int(port)
+ except ValueError:
+ print "Please try a number next time."
+ return 1
base_extjs_path = os.path.join(os.environ["YT_DEST"], "src")
if not os.path.isfile(os.path.join(base_extjs_path, "ext-resources", "ext-all.js")):
print
--- a/yt/utilities/cosmology.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/cosmology.py Wed May 04 15:59:53 2011 -0400
@@ -6,7 +6,7 @@
Affiliation: CASA/University of CO, Boulder
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Britton Smith. All Rights Reserved.
+ Copyright (C) 2008-2011 Britton Smith. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/data_point_utilities.c Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/data_point_utilities.c Wed May 04 15:59:53 2011 -0400
@@ -1,5 +1,5 @@
/************************************************************************
-* Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+* Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
*
* This file is part of yt.
*
--- a/yt/utilities/definitions.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/definitions.py Wed May 04 15:59:53 2011 -0400
@@ -7,7 +7,7 @@
@todo: Move into yt.Defs, along with enki.EnkiDefs
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/hdf5_light_reader.c Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/hdf5_light_reader.c Wed May 04 15:59:53 2011 -0400
@@ -1,5 +1,5 @@
/************************************************************************
-* Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+* Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
*
* This file is part of yt.
*
--- a/yt/utilities/io_handler.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/io_handler.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/libconfig_wrapper.pyx Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/libconfig_wrapper.pyx Wed May 04 15:59:53 2011 -0400
@@ -3,7 +3,7 @@
minimum of the API.
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia University
+Affiliation: Columbia University University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
--- a/yt/utilities/linear_interpolators.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/linear_interpolators.py Wed May 04 15:59:53 2011 -0400
@@ -6,7 +6,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/logger.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/logger.py Wed May 04 15:59:53 2011 -0400
@@ -6,7 +6,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/math_utils.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/math_utils.py Wed May 04 15:59:53 2011 -0400
@@ -7,7 +7,7 @@
Affiliation: UCSD Physics/CASS
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2008-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/parallel_tools/__init__.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/parallel_tools/__init__.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/parallel_tools/distributed_object_collection.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/parallel_tools/distributed_object_collection.py Wed May 04 15:59:53 2011 -0400
@@ -6,7 +6,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/parallel_tools/parallel_analysis_interface.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/parallel_tools/parallel_analysis_interface.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2008-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/parallel_tools/task_queue.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/parallel_tools/task_queue.py Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
A task queue for distributing work to worker agents
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
--- a/yt/utilities/parameter_file_storage.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/parameter_file_storage.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2008-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/utilities/pasteboard.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/utilities/pasteboard.py Wed May 04 15:59:53 2011 -0400
@@ -1,6 +1,6 @@
"""
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
--- a/yt/visualization/_MPL.c Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/_MPL.c Wed May 04 15:59:53 2011 -0400
@@ -1,5 +1,5 @@
/************************************************************************
-* Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+* Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
*
* This file is part of yt.
*
--- a/yt/visualization/__init__.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/__init__.py Wed May 04 15:59:53 2011 -0400
@@ -10,7 +10,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/visualization/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
@@ -47,7 +47,8 @@
write_image, \
map_to_colors, \
splat_points, \
- annotate_image
+ annotate_image, \
+ apply_colormap
from plot_modifications import \
PlotCallback, \
--- a/yt/visualization/color_maps.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/color_maps.py Wed May 04 15:59:53 2011 -0400
@@ -4,7 +4,7 @@
Author: Matthew Turk <matthewturk at gmail.com>
Affiliation: KIPAC/SLAC/Stanford
License:
- Copyright (C) 2008-2009 Britton Smith, Matthew Turk All Rights Reserved.
+ Copyright (C) 2008-2011 Britton Smith, Matthew Turk All Rights Reserved.
This file is part of yt.
--- a/yt/visualization/easy_plots.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/easy_plots.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UCSD
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/visualization/eps_writer.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/eps_writer.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Requirements: PyX
License:
- Copyright (C) 2010 John Wise. All Rights Reserved.
+ Copyright (C) 2010-2011 John Wise. All Rights Reserved.
This file is part of yt.
--- a/yt/visualization/fixed_resolution.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/fixed_resolution.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2008-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/visualization/image_panner/__init__.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/image_panner/__init__.py Wed May 04 15:59:53 2011 -0400
@@ -3,7 +3,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/visualization/image_panner/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/image_panner/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/visualization/image_panner/pan_and_scan_widget.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/image_panner/pan_and_scan_widget.py Wed May 04 15:59:53 2011 -0400
@@ -3,7 +3,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/visualization/image_panner/vm_panner.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/image_panner/vm_panner.py Wed May 04 15:59:53 2011 -0400
@@ -3,7 +3,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/visualization/image_writer.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/image_writer.py Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
Author: Matthew Turk <matthewturk at gmail.com>
Affiliation: UCSD
License:
- Copyright (C) 2010 Matthew Turk All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk All Rights Reserved.
This file is part of yt.
--- a/yt/visualization/loglocator.py Wed May 04 15:59:27 2011 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-##
-## This is a modified version of the LogLocator used in Matplotlib.
-## It is subject to the terms of the BSD license, and copyright is held by the
-## original authors.
-##
-
-import math
-import numpy as na
-
-def is_decade(x,base=10):
- if x == 0.0:
- return True
- lx = math.log(x)/math.log(base)
- return lx==int(lx)
-
-class LogLocator(object):
- """
- Determine the tick locations for log axes
- """
-
- def __init__(self, base=10.0, subs=[1.0], numdecs=4):
- """
- place ticks on the location= base**i*subs[j]
- """
- self.base(base)
- self.subs(subs)
- self.numticks = 15
- self.numdecs = numdecs
-
- def base(self,base):
- """
- set the base of the log scaling (major tick every base**i, i interger)
- """
- self._base=base+0.0
-
- def subs(self,subs):
- """
- set the minor ticks the log scaling every base**i*subs[j]
- """
- if subs is None:
- self._subs = None # autosub
- else:
- self._subs = na.asarray(subs)+0.0
-
- def _set_numticks(self):
- self.numticks = 15 # todo; be smart here; this is just for dev
-
- def __call__(self, vmin, vmax):
- 'Return the locations of the ticks'
- b=self._base
-
- if vmin <= 0.0:
- raise ValueError(
- "Data has no positive values, and therefore can not be log-scaled.")
-
- vmin = math.log(vmin)/math.log(b)
- vmax = math.log(vmax)/math.log(b)
-
- if vmax<vmin:
- vmin, vmax = vmax, vmin
-
- numdec = math.floor(vmax)-math.ceil(vmin)
-
- if self._subs is None: # autosub
- if numdec>10: subs = na.array([1.0])
- elif numdec>6: subs = na.arange(2.0, b, 2.0)
- else: subs = na.arange(2.0, b)
- else:
- subs = self._subs
-
- stride = 1
- while numdec/stride+1 > self.numticks:
- stride += 1
-
- decades = na.arange(math.floor(vmin),
- math.ceil(vmax)+stride, stride)
- if len(subs) > 1 or (len(subs == 1) and subs[0] != 1.0):
- ticklocs = []
- for decadeStart in b**decades:
- ticklocs.extend( subs*decadeStart )
- else:
- ticklocs = b**decades
-
- return na.array(ticklocs)
-
-if __name__ == "__main__":
- ll = LogLocator()
- print ll(1e-24, 5e-25)
- print ll(1e-24, 1e-28)
- print ll(1e-24, 1e-35)
--- a/yt/visualization/plot_collection.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/plot_collection.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/visualization/plot_modifications.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/plot_modifications.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: UC San Diego
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2008-2009 Matthew Turk, JS Oishi, Stephen Skory. All Rights Reserved.
+ Copyright (C) 2008-2011 Matthew Turk, JS Oishi, Stephen Skory. All Rights Reserved.
This file is part of yt.
--- a/yt/visualization/plot_types.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/plot_types.py Wed May 04 15:59:53 2011 -0400
@@ -7,7 +7,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2007-2009 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/visualization/plot_window.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/plot_window.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: KIPAC/SLAC/Stanford
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 J. S. Oishi. All Rights Reserved.
+ Copyright (C) 2010-2011 J. S. Oishi. All Rights Reserved.
This file is part of yt.
@@ -33,7 +33,7 @@
from .fixed_resolution import \
FixedResolutionBuffer
from .plot_modifications import get_smallest_appropriate_unit
-from .loglocator import LogLocator
+from .tick_locators import LogLocator, LinearLocator
from yt.funcs import *
from yt.utilities.amr_utils import write_png_to_file
@@ -346,7 +346,8 @@
zoom_fac = na.log10(x_width*self._frb.pf['unitary'])/na.log10(min_zoom)
zoom_fac = 100.0*max(0.0, zoom_fac)
ticks = self.get_ticks(self._frb[field].min(),
- self._frb[field].max())
+ self._frb[field].max(),
+ take_log = self._frb.pf.field_info[field].take_log)
payload = {'type':'png_string',
'image_data':img_data,
'metadata_string': self.get_metadata(field),
@@ -355,18 +356,26 @@
payload.update(addl_keys)
ph.add_payload(payload)
- def get_ticks(self, mi, ma, height = 400):
+ def get_ticks(self, mi, ma, height = 400, take_log = False):
# This will eventually change to work with non-logged fields
- ll = LogLocator()
- tick_locs = ll(mi, ma)
ticks = []
- mi = na.log10(mi)
- ma = na.log10(ma)
- for v1,v2 in zip(tick_locs, na.log10(tick_locs)):
- if v2 < mi or v2 > ma: continue
- p = height - height * (v2 - mi)/(ma - mi)
- ticks.append((p,v1,v2))
- #print v1, v2, mi, ma, height, p
+ if take_log:
+ ll = LogLocator()
+ tick_locs = ll(mi, ma)
+ mi = na.log10(mi)
+ ma = na.log10(ma)
+ for v1,v2 in zip(tick_locs, na.log10(tick_locs)):
+ if v2 < mi or v2 > ma: continue
+ p = height - height * (v2 - mi)/(ma - mi)
+ ticks.append((p,v1,v2))
+ #print v1, v2, mi, ma, height, p
+ else:
+ ll = LinearLocator()
+ tick_locs = ll(mi, ma)
+ for v in tick_locs:
+ p = height - height * (v - mi)/(ma-mi)
+ ticks.append((p,v,"%0.3e" % (v)))
+
return ticks
def _get_cbar_image(self, height = 400, width = 40):
--- a/yt/visualization/profile_plotter.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/profile_plotter.py Wed May 04 15:59:53 2011 -0400
@@ -2,7 +2,7 @@
This is a simple mechanism for interfacing with Profile and Phase plots
Author: Matthew Turk <matthewturk at gmail.com>
-Affiliation: NSF / Columbia
+Affiliation: Columbia University
Homepage: http://yt.enzotools.org/
License:
Copyright (C) 2011 Matthew Turk. All Rights Reserved.
@@ -37,7 +37,7 @@
BinnedProfile1D, \
BinnedProfile2D
from .plot_types import ProfilePlot, PhasePlot
-from .loglocator import LogLocator
+from .tick_locators import LogLocator
def invalidate_plot(f):
@wraps(f)
--- a/yt/visualization/streamlines.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/streamlines.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: University of Colorado
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Samuel Skillman. All Rights Reserved.
+ Copyright (C) 2010-2011 Samuel Skillman. All Rights Reserved.
This file is part of yt.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/visualization/tick_locators.py Wed May 04 15:59:53 2011 -0400
@@ -0,0 +1,163 @@
+##
+## This is a modified version of the LogLocator used in Matplotlib.
+## It is subject to the terms of the BSD license, and copyright is held by the
+## original authors.
+##
+
+import math
+import numpy as na
+
+def is_decade(x,base=10):
+ if x == 0.0:
+ return True
+ lx = math.log(x)/math.log(base)
+ return lx==int(lx)
+
+class LogLocator(object):
+ """
+ Determine the tick locations for log axes
+ """
+
+ def __init__(self, base=10.0, subs=[1.0], numdecs=4):
+ """
+ place ticks on the location= base**i*subs[j]
+ """
+ self.base(base)
+ self.subs(subs)
+ self.numticks = 15
+ self.numdecs = numdecs
+
+ def base(self,base):
+ """
+ set the base of the log scaling (major tick every base**i, i interger)
+ """
+ self._base=base+0.0
+
+ def subs(self,subs):
+ """
+ set the minor ticks the log scaling every base**i*subs[j]
+ """
+ if subs is None:
+ self._subs = None # autosub
+ else:
+ self._subs = na.asarray(subs)+0.0
+
+ def _set_numticks(self):
+ self.numticks = 15 # todo; be smart here; this is just for dev
+
+ def __call__(self, vmin, vmax):
+ 'Return the locations of the ticks'
+ b=self._base
+
+ if vmin <= 0.0:
+ raise ValueError(
+ "Data has no positive values, and therefore can not be log-scaled.")
+
+ vmin = math.log(vmin)/math.log(b)
+ vmax = math.log(vmax)/math.log(b)
+
+ if vmax<vmin:
+ vmin, vmax = vmax, vmin
+
+ numdec = math.floor(vmax)-math.ceil(vmin)
+
+ if self._subs is None: # autosub
+ if numdec>10: subs = na.array([1.0])
+ elif numdec>6: subs = na.arange(2.0, b, 2.0)
+ else: subs = na.arange(2.0, b)
+ else:
+ subs = self._subs
+
+ stride = 1
+ while numdec/stride+1 > self.numticks:
+ stride += 1
+
+ decades = na.arange(math.floor(vmin),
+ math.ceil(vmax)+stride, stride)
+ if len(subs) > 1 or (len(subs == 1) and subs[0] != 1.0):
+ ticklocs = []
+ for decadeStart in b**decades:
+ ticklocs.extend( subs*decadeStart )
+ else:
+ ticklocs = b**decades
+
+ return na.array(ticklocs)
+
+
+class LinearLocator(object):
+ """
+ Determine the tick locations
+
+ The first time this function is called it will try to set the
+ number of ticks to make a nice tick partitioning. Thereafter the
+ number of ticks will be fixed so that interactive navigation will
+ be nice
+ """
+
+
+ def __init__(self, numticks = None, presets=None):
+ """
+ Use presets to set locs based on lom. A dict mapping vmin, vmax->locs
+ """
+ self.numticks = numticks
+ if presets is None:
+ self.presets = {}
+ else:
+ self.presets = presets
+
+ def __call__(self, vmin, vmax):
+ 'Return the locations of the ticks'
+
+ # vmin, vmax = self.axis.get_view_interval()
+ # vmin, vmax = mtransforms.nonsingular(vmin, vmax, expander = 0.05)
+ if vmax<vmin:
+ vmin, vmax = vmax, vmin
+
+ if (vmin, vmax) in self.presets:
+ return self.presets[(vmin, vmax)]
+
+ if self.numticks is None:
+ self._set_numticks()
+
+
+
+ if self.numticks==0: return []
+ ticklocs = na.linspace(vmin, vmax, self.numticks)
+
+ #return self.raise_if_exceeds(ticklocs)
+ return ticklocs
+
+
+ def _set_numticks(self):
+ self.numticks = 11 # todo; be smart here; this is just for dev
+
+ # def view_limits(self, vmin, vmax):
+ # 'Try to choose the view limits intelligently'
+
+ # if vmax<vmin:
+ # vmin, vmax = vmax, vmin
+
+ # if vmin==vmax:
+ # vmin-=1
+ # vmax+=1
+
+ # exponent, remainder = divmod(math.log10(vmax - vmin), 1)
+
+ # if remainder < 0.5:
+ # exponent -= 1
+ # scale = 10**(-exponent)
+ # vmin = math.floor(scale*vmin)/scale
+ # vmax = math.ceil(scale*vmax)/scale
+
+ # return mtransforms.nonsingular(vmin, vmax)
+
+
+if __name__ == "__main__":
+ ll = LogLocator()
+ print ll(1e-24, 5e-25)
+ print ll(1e-24, 1e-28)
+ print ll(1e-24, 1e-35)
+ lll = LinearLocator()
+ print lll(-1e-24, 1e-24)
+ print lll(-2.3, 1.3)
+ print lll(10,23.)
--- a/yt/visualization/volume_rendering/UBVRI.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/volume_rendering/UBVRI.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: UC Berkeley
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 J.S. Oishi. All Rights Reserved.
+ Copyright (C) 2010-2011 J.S. Oishi. All Rights Reserved.
This file is part of yt.
--- a/yt/visualization/volume_rendering/__init__.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/volume_rendering/__init__.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/visualization/volume_rendering/api.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/volume_rendering/api.py Wed May 04 15:59:53 2011 -0400
@@ -9,7 +9,7 @@
Affiliation: MSU
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Matthew Turk. All Rights Reserved.
+ Copyright (C) 2010-2011 Matthew Turk. All Rights Reserved.
This file is part of yt.
--- a/yt/visualization/volume_rendering/image_handling.py Wed May 04 15:59:27 2011 -0400
+++ b/yt/visualization/volume_rendering/image_handling.py Wed May 04 15:59:53 2011 -0400
@@ -5,7 +5,7 @@
Affiliation: University of Colorado at Boulder
Homepage: http://yt.enzotools.org/
License:
- Copyright (C) 2010 Samuel Skillman. All Rights Reserved.
+ Copyright (C) 2010-2011 Samuel Skillman. All Rights Reserved.
This file is part of yt.
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