added utility to read off particle velocities

This commit is contained in:
P.M. Sutter 2014-01-27 20:26:27 -06:00
parent d3554b0732
commit b466730c42

View file

@ -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):