From b466730c426838cf440290a0a21113a242c0399b Mon Sep 17 00:00:00 2001 From: "P.M. Sutter" Date: Mon, 27 Jan 2014 20:26:27 -0600 Subject: [PATCH] added utility to read off particle velocities --- .../void_python_tools/partUtil/partUtil.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/python_tools/void_python_tools/partUtil/partUtil.py b/python_tools/void_python_tools/partUtil/partUtil.py index 7444939..ba16b8a 100644 --- a/python_tools/void_python_tools/partUtil/partUtil.py +++ b/python_tools/void_python_tools/partUtil/partUtil.py @@ -105,6 +105,30 @@ def loadPart(workDir, sampleDir, sample): return partData, boxLen, volNorm, isObservationData +# ----------------------------------------------------------------------------- +def loadPartVel(workDir, sampleDir, sample): + #print " Loading particle velocities..." + sys.stdout.flush() + + infoFile = workDir+"/"+sampleDir+"/zobov_slice_"+sample.fullName+".par" + File = NetCDFFile(infoFile, 'r') + isObservation = getattr(File, 'is_observation') + + if isObservation: + print "No velocities for observations!" + return -1 + + vx = File.variables['vel_x'][0:] + vy = File.variables['vel_y'][0:] + vx = File.variables['vel_z'][0:] + + File.close() + + partVel = np.column_stack((vx,vy,vz)) + + return partVel + + # ----------------------------------------------------------------------------- def shiftPart(inPart, newCenter, periodicLine, boxLen):