lwang-astro / PeTar

PeTar is a high-performance N-body code for modelling the evolution of star clusters and tidal streams, including the effect of galactic potential, dynamics of binary and hierarchical system, single and binary stellar evolution.
MIT License
71 stars 19 forks source link

Read binaries fail #14

Closed SaraRastello closed 3 years ago

SaraRastello commented 3 years ago

The method suggested to get binaries from files generated from petar.data.process gives the following errors:

p1 = petar.Particle(interrupt_mode='bse') p2 = petar.Particle(interrupt_mode='bse') binary =petar.Binary(p1,p2) binary.loadtxt([binary data file path])

IN my case I tried with file "data.200.binary"

import petar p1 = petar.Particle(interrupt_mode='bse') p2 = petar.Particle(interrupt_mode='bse') binary =petar.Binary(p1,p2) binary.loadtxt('data.200.binary',skiprows=1) Traceback (most recent call last): File "", line 1, in File "/tank0/rastello/NEWPETAR2021/PeTar/include/petar/base.py", line 324, in loadtxt self.readArray(dat_int, kwargs) File "/tank0/rastello/NEWPETAR2021/PeTar/include/petar/base.py", line 124, in readArray self.dict[key].readArray(_dat, icol, kwargs) File "/tank0/rastello/NEWPETAR2021/PeTar/include/petar/base.py", line 128, in readArray self.dict[key] = _dat[:,icol].astype(parameter) IndexError: index 51 is out of bounds for axis 1 with size 50

It seems there are less columns than expected.

lwang-astro commented 3 years ago

In your script, the interrupt_mode='bse' indicates that you have switch on BSE in the simulation. The missing of columns suggests that there is probably no Stellar evolution columns in data.200.binary (should be 78 columns). Is your simulation using BSE? Besides, when you use petar.data.process to generate binary snapshot, have you also included the bse option (-i bse) in petar.data.process commander?

SaraRastello commented 3 years ago

Thank you! now it works!