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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Sat Jun 1 10:08:53 PDT 2013


5 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/b6c23df78443/
Changeset:   b6c23df78443
Branch:      yt
User:        atmyers
Date:        2013-06-01 01:50:53
Summary:     adding support for old StarParticle files to the Orion particle reader
Affected #:  4 files

diff -r 7576917f462cd323995eb47bfc16e65d2a4c5e5c -r b6c23df78443aed27decfcdd9102ef03abc44630 yt/frontends/chombo/fields.py
--- a/yt/frontends/chombo/fields.py
+++ b/yt/frontends/chombo/fields.py
@@ -163,10 +163,12 @@
                         "angmomen_y",
                         "angmomen_z",
                         "mlast",
+                        "r",
                         "mdeut",
                         "n",
                         "mdot",
                         "burnstate",
+                        "luminosity",
                         "id"]
 
 for pf in _particle_field_list:

diff -r 7576917f462cd323995eb47bfc16e65d2a4c5e5c -r b6c23df78443aed27decfcdd9102ef03abc44630 yt/frontends/chombo/io.py
--- a/yt/frontends/chombo/io.py
+++ b/yt/frontends/chombo/io.py
@@ -77,6 +77,14 @@
         parses the Orion Star Particle text files
              
         """
+
+        fn = grid.pf.fullplotdir[:-4] + "sink"
+
+        # Figure out the format of the particle file
+        with open(fn, 'r') as f:
+            lines = f.readlines()
+        line = lines[1]
+        
         index = {'particle_mass': 0,
                  'particle_position_x': 1,
                  'particle_position_y': 2,
@@ -87,15 +95,33 @@
                  'particle_angmomen_x': 7,
                  'particle_angmomen_y': 8,
                  'particle_angmomen_z': 9,
-                 'particle_mlast': 10,
-                 'particle_mdeut': 11,
-                 'particle_n': 12,
-                 'particle_mdot': 13,
-                 'particle_burnstate': 14,
-                 'particle_id': 15}
+                 'particle_id': -1}
 
+        if len(line.strip().split()) == 11:
+            pass  
+
+        elif len(line.strip().split()) == 17:
+            index['particle_mlast']     = 10
+            index['particle_r']         = 11
+            index['particle_mdeut']     = 12
+            index['particle_n']         = 13
+            index['particle_mdot']      = 14,
+            index['particle_burnstate'] = 15
+
+        elif len(line.strip().split()) == 18:
+            index['particle_mlast']     = 10
+            index['particle_r']         = 11
+            index['particle_mdeut']     = 12
+            index['particle_n']         = 13
+            index['particle_mdot']      = 14,
+            index['particle_burnstate'] = 15,
+            index['particle_luminosity']= 16
+
+        else:
+            print 'Warning - could not figure out particle output file'
+            
         def read(line, field):
-            return float(line.split(' ')[index[field]])
+            return float(line.strip().split(' ')[index[field]])
 
         fn = grid.pf.fullplotdir[:-4] + "sink"
         with open(fn, 'r') as f:

diff -r 7576917f462cd323995eb47bfc16e65d2a4c5e5c -r b6c23df78443aed27decfcdd9102ef03abc44630 yt/frontends/orion/fields.py
--- a/yt/frontends/orion/fields.py
+++ b/yt/frontends/orion/fields.py
@@ -163,10 +163,12 @@
                         "angmomen_y",
                         "angmomen_z",
                         "mlast",
+                        "r",
                         "mdeut",
                         "n",
                         "mdot",
                         "burnstate",
+                        "luminosity",
                         "id"]
 
 for pf in _particle_field_list:

diff -r 7576917f462cd323995eb47bfc16e65d2a4c5e5c -r b6c23df78443aed27decfcdd9102ef03abc44630 yt/frontends/orion/io.py
--- a/yt/frontends/orion/io.py
+++ b/yt/frontends/orion/io.py
@@ -44,6 +44,14 @@
         parses the Orion Star Particle text files
         
         """
+
+        fn = grid.pf.fullplotdir + "/StarParticles"
+
+        # Figure out the format of the particle file
+        with open(fn, 'r') as f:
+            lines = f.readlines()
+        line = lines[1]
+        
         index = {'particle_mass': 0,
                  'particle_position_x': 1,
                  'particle_position_y': 2,
@@ -54,17 +62,34 @@
                  'particle_angmomen_x': 7,
                  'particle_angmomen_y': 8,
                  'particle_angmomen_z': 9,
-                 'particle_mlast': 10,
-                 'particle_mdeut': 11,
-                 'particle_n': 12,
-                 'particle_mdot': 13,
-                 'particle_burnstate': 14,
-                 'particle_id': 15}
+                 'particle_id': -1}
+
+        if len(line.strip().split()) == 11:
+            pass  
+
+        elif len(line.strip().split()) == 17:
+            index['particle_mlast']     = 10
+            index['particle_r']         = 11
+            index['particle_mdeut']     = 12
+            index['particle_n']         = 13
+            index['particle_mdot']      = 14,
+            index['particle_burnstate'] = 15
+
+        elif len(line.strip().split()) == 18:
+            index['particle_mlast']     = 10
+            index['particle_r']         = 11
+            index['particle_mdeut']     = 12
+            index['particle_n']         = 13
+            index['particle_mdot']      = 14,
+            index['particle_burnstate'] = 15,
+            index['particle_luminosity']= 16
+
+        else:
+            print 'Warning - Could not figure out particle file format'
 
         def read(line, field):
             return float(line.split(' ')[index[field]])
 
-        fn = grid.pf.fullplotdir + "/StarParticles"
         with open(fn, 'r') as f:
             lines = f.readlines()
             particles = []


https://bitbucket.org/yt_analysis/yt/commits/087e0fae99a8/
Changeset:   087e0fae99a8
Branch:      yt
User:        atmyers
Date:        2013-06-01 02:05:12
Summary:     adding a few comments and fixing issue re: vanilla sinks in orion
Affected #:  2 files

diff -r b6c23df78443aed27decfcdd9102ef03abc44630 -r 087e0fae99a8fcdb4e1bff853510395fab72ce8a yt/frontends/chombo/io.py
--- a/yt/frontends/chombo/io.py
+++ b/yt/frontends/chombo/io.py
@@ -84,7 +84,8 @@
         with open(fn, 'r') as f:
             lines = f.readlines()
         line = lines[1]
-        
+
+        # The basic fields that all sink particles have
         index = {'particle_mass': 0,
                  'particle_position_x': 1,
                  'particle_position_y': 2,
@@ -98,9 +99,11 @@
                  'particle_id': -1}
 
         if len(line.strip().split()) == 11:
+            # these are vanilla sinks, do nothing
             pass  
 
         elif len(line.strip().split()) == 17:
+            # these are old-style stars, add stellar model parameters
             index['particle_mlast']     = 10
             index['particle_r']         = 11
             index['particle_mdeut']     = 12
@@ -109,6 +112,7 @@
             index['particle_burnstate'] = 15
 
         elif len(line.strip().split()) == 18:
+            # these are the newer style, add luminosity as well
             index['particle_mlast']     = 10
             index['particle_r']         = 11
             index['particle_mdeut']     = 12
@@ -118,7 +122,9 @@
             index['particle_luminosity']= 16
 
         else:
+            # give a warning if none of the above apply:
             print 'Warning - could not figure out particle output file'
+            print 'These results could be nonsense!'
             
         def read(line, field):
             return float(line.strip().split(' ')[index[field]])

diff -r b6c23df78443aed27decfcdd9102ef03abc44630 -r 087e0fae99a8fcdb4e1bff853510395fab72ce8a yt/frontends/orion/io.py
--- a/yt/frontends/orion/io.py
+++ b/yt/frontends/orion/io.py
@@ -46,12 +46,15 @@
         """
 
         fn = grid.pf.fullplotdir + "/StarParticles"
+        if !os.path.exists(fn):
+            fn = grid.pf.fullplotdir + "/SinkParticles"
 
         # Figure out the format of the particle file
         with open(fn, 'r') as f:
             lines = f.readlines()
         line = lines[1]
         
+        # The basic fields that all sink particles have
         index = {'particle_mass': 0,
                  'particle_position_x': 1,
                  'particle_position_y': 2,
@@ -65,9 +68,11 @@
                  'particle_id': -1}
 
         if len(line.strip().split()) == 11:
+            # these are vanilla sinks, do nothing
             pass  
 
         elif len(line.strip().split()) == 17:
+            # these are old-style stars, add stellar model parameters
             index['particle_mlast']     = 10
             index['particle_r']         = 11
             index['particle_mdeut']     = 12
@@ -76,6 +81,7 @@
             index['particle_burnstate'] = 15
 
         elif len(line.strip().split()) == 18:
+            # these are the newer style, add luminosity as well
             index['particle_mlast']     = 10
             index['particle_r']         = 11
             index['particle_mdeut']     = 12
@@ -85,7 +91,9 @@
             index['particle_luminosity']= 16
 
         else:
-            print 'Warning - Could not figure out particle file format'
+            # give a warning if none of the above apply:
+            print 'Warning - could not figure out particle output file'
+            print 'These results could be nonsense!'
 
         def read(line, field):
             return float(line.split(' ')[index[field]])


https://bitbucket.org/yt_analysis/yt/commits/6a6b6d7fe09d/
Changeset:   6a6b6d7fe09d
Branch:      yt
User:        atmyers
Date:        2013-06-01 02:08:38
Summary:     more robust parsing of sink particle files
Affected #:  1 file

diff -r 087e0fae99a8fcdb4e1bff853510395fab72ce8a -r 6a6b6d7fe09d26fe832558a534f580dacd379592 yt/frontends/orion/io.py
--- a/yt/frontends/orion/io.py
+++ b/yt/frontends/orion/io.py
@@ -96,7 +96,7 @@
             print 'These results could be nonsense!'
 
         def read(line, field):
-            return float(line.split(' ')[index[field]])
+            return float(line.strip().split(' ')[index[field]])
 
         with open(fn, 'r') as f:
             lines = f.readlines()


https://bitbucket.org/yt_analysis/yt/commits/97d42725f8e9/
Changeset:   97d42725f8e9
Branch:      yt
User:        Andrew Myers
Date:        2013-06-01 02:17:06
Summary:     not the right syntax
Affected #:  1 file

diff -r 6a6b6d7fe09d26fe832558a534f580dacd379592 -r 97d42725f8e97977d38c0df6c79c9d8ede6dfdcc yt/frontends/orion/io.py
--- a/yt/frontends/orion/io.py
+++ b/yt/frontends/orion/io.py
@@ -46,7 +46,7 @@
         """
 
         fn = grid.pf.fullplotdir + "/StarParticles"
-        if !os.path.exists(fn):
+        if not os.path.exists(fn):
             fn = grid.pf.fullplotdir + "/SinkParticles"
 
         # Figure out the format of the particle file


https://bitbucket.org/yt_analysis/yt/commits/2ad91aa91e30/
Changeset:   2ad91aa91e30
Branch:      yt
User:        atmyers
Date:        2013-06-01 19:04:21
Summary:     print -> mylog.warning
Affected #:  2 files

diff -r 97d42725f8e97977d38c0df6c79c9d8ede6dfdcc -r 2ad91aa91e3054eadb445f88303d97842b68155f yt/frontends/chombo/io.py
--- a/yt/frontends/chombo/io.py
+++ b/yt/frontends/chombo/io.py
@@ -123,8 +123,8 @@
 
         else:
             # give a warning if none of the above apply:
-            print 'Warning - could not figure out particle output file'
-            print 'These results could be nonsense!'
+            mylog.warning('Warning - could not figure out particle output file')
+            mylog.warning('These results could be nonsense!')
             
         def read(line, field):
             return float(line.strip().split(' ')[index[field]])

diff -r 97d42725f8e97977d38c0df6c79c9d8ede6dfdcc -r 2ad91aa91e3054eadb445f88303d97842b68155f yt/frontends/orion/io.py
--- a/yt/frontends/orion/io.py
+++ b/yt/frontends/orion/io.py
@@ -92,8 +92,8 @@
 
         else:
             # give a warning if none of the above apply:
-            print 'Warning - could not figure out particle output file'
-            print 'These results could be nonsense!'
+            mylog.warning('Warning - could not figure out particle output file')
+            mylog.warning('These results could be nonsense!')
 
         def read(line, field):
             return float(line.strip().split(' ')[index[field]])

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