mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 15:21:11 +00:00
made getArray more general; updated gitignore
This commit is contained in:
parent
76ea3567c8
commit
87445abfab
2 changed files with 16 additions and 1 deletions
|
@ -447,7 +447,12 @@ def loadVoidCatalog(sampleDir, dataPortion="central", loadParticles=True,
|
|||
def getArray(objectList, attr):
|
||||
|
||||
if hasattr(objectList[0], attr):
|
||||
return np.fromiter((getattr(v, attr) for v in objectList), float)
|
||||
ndim = np.shape( np.atleast_1d( getattr(objectList[0], attr) ) )[0]
|
||||
attrArr = np.zeros(( len(objectList), ndim ))
|
||||
for idim in xrange(ndim):
|
||||
attrArr[:,idim] = np.fromiter((np.atleast_1d(getattr(v, attr))[idim] \
|
||||
for v in objectList), float )
|
||||
return attrArr
|
||||
else:
|
||||
print " Attribute", attr, "not found!"
|
||||
return -1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue