[yt-svn] commit/yt: 3 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Jul 22 13:28:53 PDT 2014


3 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/ebb8fd34c4ae/
Changeset:   ebb8fd34c4ae
Branch:      yt-3.0
User:        karraki
Date:        2014-07-22 19:03:41
Summary:     Cleaning up NMSU-ART unit conversions.
Affected #:  1 file

diff -r e816afd0f0637f5a4eb1136a01309ad4875a97ce -r ebb8fd34c4ae907640b88be3a8d0acf590da60ad yt/frontends/art/data_structures.py
--- a/yt/frontends/art/data_structures.py
+++ b/yt/frontends/art/data_structures.py
@@ -245,55 +245,20 @@
         aexpn = self.parameters["aexpn"]
         hubble = self.parameters['hubble']
 
-        cf = defaultdict(lambda: 1.0)
         r0 = boxh/ng
-        P0 = 4.697e-16 * Om0**2.0 * r0**2.0 * hubble**2.0
-        T_0 = 3.03e5 * r0**2.0 * wmu * Om0  # [K]
-        S_0 = 52.077 * wmu**(5.0/3.0)
-        S_0 *= hubble**(-4.0/3.0)*Om0**(1.0/3.0)*r0**2.0
-        # v0 =  r0 * 50.0*1.0e5 * np.sqrt(self.omega_matter)  #cm/s
         v0 = 50.0*r0*np.sqrt(Om0)
-        t0 = r0/v0
-        rho1 = 1.8791e-29 * hubble**2.0 * self.omega_matter
         rho0 = 2.776e11 * hubble**2.0 * Om0
-        tr = 2./3. * (3.03e5*r0**2.0*wmu*self.omega_matter)*(1.0/(aexpn**2))
         aM0 = rho0 * (boxh/hubble)**3.0 / ng**3.0
-        cf['r0'] = r0
-        cf['P0'] = P0
-        cf['T_0'] = T_0
-        cf['S_0'] = S_0
-        cf['v0'] = v0
-        cf['t0'] = t0
-        cf['rho0'] = rho0
-        cf['rho1'] = rho1
-        cf['tr'] = tr
-        cf['aM0'] = aM0
+        velocity = v0/aexpn*1.0e5  # proper cm/s
+        mass = aM0 * 1.98892e33
 
-        # factors to multiply the native code units to CGS
-        cf['Pressure'] = P0  # already cgs
-        cf['Velocity'] = v0/aexpn*1.0e5  # proper cm/s
-        cf["Mass"] = aM0 * 1.98892e33
-        cf["Density"] = rho1*(aexpn**-3.0)
-        cf["GasEnergy"] = rho0*v0**2*(aexpn**-5.0)
-        cf["Potential"] = 1.0
-        cf["Entropy"] = S_0
-        cf["Temperature"] = tr
-        cf["Time"] = 1.0
-        cf["particle_mass"] = cf['Mass']
-        cf["particle_mass_initial"] = cf['Mass']
         self.cosmological_simulation = True
+        self.mass_unit = self.quan(mass, "g*%s" % ng**3)
+        self.particlemass_unit = self.quan(mass, "g")
+        self.length_unit = self.quan(box_proper, "Mpc")
+        self.velocity_unit = self.quan(velocity, "cm/s")
+        self.time_unit = self.length_unit / self.velocity_unit
 
-        # I have left much of the old code above.for historical reference, but
-        # it is largely or completely vestigial.  The subsequent unit setting
-        # is from ARTIO, which I have been assured has identical units to
-        # NMSU-ART for hydrodynamic quantities..
-        #
-        # That being said, these are a bit uncertain to me.
-
-        self.mass_unit = self.quan(cf["Mass"], "g*%s" % ng**3)
-        self.length_unit = self.quan(box_proper, "Mpc")
-        self.velocity_unit = self.quan(cf["Velocity"], "cm/s")
-        self.time_unit = self.length_unit / self.velocity_unit
 
     def _parse_parameter_file(self):
         """


https://bitbucket.org/yt_analysis/yt/commits/d0c5b6c47043/
Changeset:   d0c5b6c47043
Branch:      yt-3.0
User:        karraki
Date:        2014-07-22 19:29:20
Summary:     Added changes to NMSU-ART file that I had made in March.
Affected #:  2 files

diff -r ebb8fd34c4ae907640b88be3a8d0acf590da60ad -r d0c5b6c470431679aaf39aa619f8017b8a7a0315 yt/frontends/art/data_structures.py
--- a/yt/frontends/art/data_structures.py
+++ b/yt/frontends/art/data_structures.py
@@ -74,7 +74,7 @@
         """
         # Overloaded
         ds = self.dataset
-        return (1.0/pf.domain_dimensions.astype('f8') /
+        return (1.0/ds.domain_dimensions.astype('f8') /
                 (2**self.max_level)).min()
 
     def _initialize_oct_handler(self):
@@ -102,7 +102,7 @@
 
     def _detect_output_fields(self):
         self.particle_field_list = [f for f in particle_fields]
-        self.field_list = [("gas", f) for f in fluid_fields]
+        self.field_list = [("art", f) for f in fluid_fields]
         # now generate all of the possible particle fields
         if "wspecies" in self.dataset.parameters.keys():
             wspecies = self.dataset.parameters['wspecies']
@@ -175,6 +175,7 @@
                  limit_level=None, spread_age=True,
                  force_max_level=None, file_particle_header=None,
                  file_particle_data=None, file_particle_stars=None):
+        self.fluid_types += ("art", )
         if fields is None:
             fields = fluid_fields
         filename = os.path.abspath(filename)
@@ -240,7 +241,6 @@
         wmu = self.parameters["wmu"]
         Om0 = self.parameters['Om0']
         ng = self.parameters['ng']
-        wmu = self.parameters["wmu"]
         boxh = self.parameters['boxh']
         aexpn = self.parameters["aexpn"]
         hubble = self.parameters['hubble']
@@ -254,7 +254,6 @@
 
         self.cosmological_simulation = True
         self.mass_unit = self.quan(mass, "g*%s" % ng**3)
-        self.particlemass_unit = self.quan(mass, "g")
         self.length_unit = self.quan(box_proper, "Mpc")
         self.velocity_unit = self.quan(velocity, "cm/s")
         self.time_unit = self.length_unit / self.velocity_unit
@@ -305,7 +304,6 @@
             self.iOctFree, self.nOct = fpu.read_vector(f, 'i', '>')
             self.child_grid_offset = f.tell()
             self.parameters.update(amr_header_vals)
-            self.parameters['ncell0'] = self.parameters['ng']**3
             # estimate the root level
             float_center, fl, iocts, nocts, root_level = _read_art_level_info(
                 f,
@@ -326,9 +324,10 @@
             self.parameters['wspecies'] = wspecies[:n]
             self.parameters['lspecies'] = lspecies[:n]
             ls_nonzero = np.diff(lspecies)[:n-1]
+            ls_nonzero = np.append(lspecies[0], ls_nonzero)
             self.star_type = len(ls_nonzero)
             mylog.info("Discovered %i species of particles", len(ls_nonzero))
-            mylog.info("Particle populations: "+'%1.1e '*len(ls_nonzero),
+            mylog.info("Particle populations: "+'%9i '*len(ls_nonzero),
                        *ls_nonzero)
             for k, v in particle_header_vals.items():
                 if k in self.parameters.keys():
@@ -339,6 +338,10 @@
                 else:
                     self.parameters[k] = v
             self.parameters_particles = particle_header_vals
+            self.parameters.update(particle_header_vals)
+            self.parameters['ng'] = self.parameters['Ngridc']
+            self.parameters['ncell0'] = self.parameters['ng']**3
+
 
         # setup standard simulation params yt expects to see
         self.current_redshift = self.parameters["aexpn"]**-1.0 - 1.0

diff -r ebb8fd34c4ae907640b88be3a8d0acf590da60ad -r d0c5b6c470431679aaf39aa619f8017b8a7a0315 yt/frontends/art/definitions.py
--- a/yt/frontends/art/definitions.py
+++ b/yt/frontends/art/definitions.py
@@ -119,8 +119,7 @@
     "gamma": 5./3.,
     "T_CMB0": 2.726,
     "T_min": 300.,
-    "ng": 128,
-    "wmu": 4.0/(8.0-5.0*0.245)
+    "wmu": 4.0/(8.0-5.0*0.245),
 }
 
 seek_extras = 137


https://bitbucket.org/yt_analysis/yt/commits/3c4dc9e27719/
Changeset:   3c4dc9e27719
Branch:      yt-3.0
User:        MatthewTurk
Date:        2014-07-22 22:28:27
Summary:     Merged in karraki/yt/yt-3.0 (pull request #1051)

NMSU-ART frontend unit cleanup
Affected #:  2 files

diff -r f7f16f1a8e05b03faa91c8ba436b6d378af5bd60 -r 3c4dc9e27719f260e29bcbc6ad18c4a3601ed1f9 yt/frontends/art/data_structures.py
--- a/yt/frontends/art/data_structures.py
+++ b/yt/frontends/art/data_structures.py
@@ -74,7 +74,7 @@
         """
         # Overloaded
         ds = self.dataset
-        return (1.0/pf.domain_dimensions.astype('f8') /
+        return (1.0/ds.domain_dimensions.astype('f8') /
                 (2**self.max_level)).min()
 
     def _initialize_oct_handler(self):
@@ -102,7 +102,7 @@
 
     def _detect_output_fields(self):
         self.particle_field_list = [f for f in particle_fields]
-        self.field_list = [("gas", f) for f in fluid_fields]
+        self.field_list = [("art", f) for f in fluid_fields]
         # now generate all of the possible particle fields
         if "wspecies" in self.dataset.parameters.keys():
             wspecies = self.dataset.parameters['wspecies']
@@ -175,6 +175,7 @@
                  limit_level=None, spread_age=True,
                  force_max_level=None, file_particle_header=None,
                  file_particle_data=None, file_particle_stars=None):
+        self.fluid_types += ("art", )
         if fields is None:
             fields = fluid_fields
         filename = os.path.abspath(filename)
@@ -240,60 +241,23 @@
         wmu = self.parameters["wmu"]
         Om0 = self.parameters['Om0']
         ng = self.parameters['ng']
-        wmu = self.parameters["wmu"]
         boxh = self.parameters['boxh']
         aexpn = self.parameters["aexpn"]
         hubble = self.parameters['hubble']
 
-        cf = defaultdict(lambda: 1.0)
         r0 = boxh/ng
-        P0 = 4.697e-16 * Om0**2.0 * r0**2.0 * hubble**2.0
-        T_0 = 3.03e5 * r0**2.0 * wmu * Om0  # [K]
-        S_0 = 52.077 * wmu**(5.0/3.0)
-        S_0 *= hubble**(-4.0/3.0)*Om0**(1.0/3.0)*r0**2.0
-        # v0 =  r0 * 50.0*1.0e5 * np.sqrt(self.omega_matter)  #cm/s
         v0 = 50.0*r0*np.sqrt(Om0)
-        t0 = r0/v0
-        rho1 = 1.8791e-29 * hubble**2.0 * self.omega_matter
         rho0 = 2.776e11 * hubble**2.0 * Om0
-        tr = 2./3. * (3.03e5*r0**2.0*wmu*self.omega_matter)*(1.0/(aexpn**2))
         aM0 = rho0 * (boxh/hubble)**3.0 / ng**3.0
-        cf['r0'] = r0
-        cf['P0'] = P0
-        cf['T_0'] = T_0
-        cf['S_0'] = S_0
-        cf['v0'] = v0
-        cf['t0'] = t0
-        cf['rho0'] = rho0
-        cf['rho1'] = rho1
-        cf['tr'] = tr
-        cf['aM0'] = aM0
+        velocity = v0/aexpn*1.0e5  # proper cm/s
+        mass = aM0 * 1.98892e33
 
-        # factors to multiply the native code units to CGS
-        cf['Pressure'] = P0  # already cgs
-        cf['Velocity'] = v0/aexpn*1.0e5  # proper cm/s
-        cf["Mass"] = aM0 * 1.98892e33
-        cf["Density"] = rho1*(aexpn**-3.0)
-        cf["GasEnergy"] = rho0*v0**2*(aexpn**-5.0)
-        cf["Potential"] = 1.0
-        cf["Entropy"] = S_0
-        cf["Temperature"] = tr
-        cf["Time"] = 1.0
-        cf["particle_mass"] = cf['Mass']
-        cf["particle_mass_initial"] = cf['Mass']
         self.cosmological_simulation = True
+        self.mass_unit = self.quan(mass, "g*%s" % ng**3)
+        self.length_unit = self.quan(box_proper, "Mpc")
+        self.velocity_unit = self.quan(velocity, "cm/s")
+        self.time_unit = self.length_unit / self.velocity_unit
 
-        # I have left much of the old code above.for historical reference, but
-        # it is largely or completely vestigial.  The subsequent unit setting
-        # is from ARTIO, which I have been assured has identical units to
-        # NMSU-ART for hydrodynamic quantities..
-        #
-        # That being said, these are a bit uncertain to me.
-
-        self.mass_unit = self.quan(cf["Mass"], "g*%s" % ng**3)
-        self.length_unit = self.quan(box_proper, "Mpc")
-        self.velocity_unit = self.quan(cf["Velocity"], "cm/s")
-        self.time_unit = self.length_unit / self.velocity_unit
 
     def _parse_parameter_file(self):
         """
@@ -340,7 +304,6 @@
             self.iOctFree, self.nOct = fpu.read_vector(f, 'i', '>')
             self.child_grid_offset = f.tell()
             self.parameters.update(amr_header_vals)
-            self.parameters['ncell0'] = self.parameters['ng']**3
             # estimate the root level
             float_center, fl, iocts, nocts, root_level = _read_art_level_info(
                 f,
@@ -361,9 +324,10 @@
             self.parameters['wspecies'] = wspecies[:n]
             self.parameters['lspecies'] = lspecies[:n]
             ls_nonzero = np.diff(lspecies)[:n-1]
+            ls_nonzero = np.append(lspecies[0], ls_nonzero)
             self.star_type = len(ls_nonzero)
             mylog.info("Discovered %i species of particles", len(ls_nonzero))
-            mylog.info("Particle populations: "+'%1.1e '*len(ls_nonzero),
+            mylog.info("Particle populations: "+'%9i '*len(ls_nonzero),
                        *ls_nonzero)
             for k, v in particle_header_vals.items():
                 if k in self.parameters.keys():
@@ -374,6 +338,10 @@
                 else:
                     self.parameters[k] = v
             self.parameters_particles = particle_header_vals
+            self.parameters.update(particle_header_vals)
+            self.parameters['ng'] = self.parameters['Ngridc']
+            self.parameters['ncell0'] = self.parameters['ng']**3
+
 
         # setup standard simulation params yt expects to see
         self.current_redshift = self.parameters["aexpn"]**-1.0 - 1.0

diff -r f7f16f1a8e05b03faa91c8ba436b6d378af5bd60 -r 3c4dc9e27719f260e29bcbc6ad18c4a3601ed1f9 yt/frontends/art/definitions.py
--- a/yt/frontends/art/definitions.py
+++ b/yt/frontends/art/definitions.py
@@ -119,8 +119,7 @@
     "gamma": 5./3.,
     "T_CMB0": 2.726,
     "T_min": 300.,
-    "ng": 128,
-    "wmu": 4.0/(8.0-5.0*0.245)
+    "wmu": 4.0/(8.0-5.0*0.245),
 }
 
 seek_extras = 137

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