oliverphilcox / HIPSTER

HIPSTER: HIgh-k Power SpecTrum and bispectrum EstimatoR
6 stars 4 forks source link

Bispectrum code pointing to non-exiting file #7

Open JegerBroxterman opened 1 month ago

JegerBroxterman commented 1 month ago

Hi, I am trying to compute some bispectra using your hipster_wrapper_bispectrum.sh wrapper but it seems to crash when looking for a file that doesn't exist. I git cloned the repository, ran the script to generate the bins and then I initiate the file as

{path_to_wrapper}/hipster_wrapper_bispectrum.sh --dat {data_file} --l_max 4 --R0 50 --k_bin binning.csv --subsample 2 --f_rand 3 --string testing

The error message I get is

[dc-brox1@login8a bispectrum]$ /cosma/apps/dp004/dc-brox1/HIPSTER/hipster_wrapper_bispectrum.sh --dat /snap8/scratch/dp004/dc-brox1/bispec/test_only_pos.npy --l_max 4 --R0 50 --k_bin /cosma/apps/dp004/dc-brox1/HIPSTER/binning.csv --subsample 2 --f_rand 3 --string testing

INPUT PARAMETERS
----------------
Data file: /snap8/scratch/dp004/dc-brox1/bispec/test_only_pos.npy
Maximum Legendre multipole: 4
Pair count truncation radius: 50
k-space binning file: /cosma/apps/dp004/dc-brox1/HIPSTER/binning.csv
Random-to-data ratio: 3
Output string: testing
CPU-threads: 10
Subsampling: 2

Subsampling data with subsampling ratio 2
Counting particles in file
Traceback (most recent call last):
  File "/cosma/apps/dp004/dc-brox1/HIPSTER/python/take_subset_of_particles.py", line 18, in <module>
    for i, l in enumerate(f):
  File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x93 in position 0: invalid start byte
Using 36995519 particles in /snap8/scratch/dp004/dc-brox1/bispec/test_only_pos.npy.sub, from 73991038 particles originally
COMPILING C++ CODE
/cosma/apps/dp004/dc-brox1/HIPSTER /cosma8/data/dp004/dc-brox1/bispectrum

rm: cannot remove 'grid_power.o': No such file or directory
rm: cannot remove './power': No such file or directory
/cosma8/data/dp004/dc-brox1/bispectrum
make: Entering directory '/cosma/apps/dp004/dc-brox1/HIPSTER'
g++ -fopenmp -lgomp -std=c++0x -ffast-math -DPOWER -Wall -O3 -DPERIODIC -DBISPECTRUM  -DOPENMP -I/cosma/local/Python/3.12.4/include/python3.12/  -c -o grid_power.o grid_power.cpp
In file included from grid_power.cpp:44:
power_mod/kernel_interp_bispectrum.h: In constructor ‘KernelInterp::KernelInterp(Parameters*)’:
power_mod/kernel_interp_bispectrum.h:264:22: error: ‘class Parameters’ has no member named ‘rmax’; did you mean ‘nmax’?
  264 |         k_max = par->rmax;
      |                      ^~~~
      |                      nmax
power_mod/kernel_interp_bispectrum.h:265:22: error: ‘class Parameters’ has no member named ‘rmin’; did you mean ‘kmin’?
  265 |         k_min = par->rmin;
      |                      ^~~~
      |                      kmin
In file included from power_mod/triple_counter.h:6,
                 from grid_power.cpp:45:
power_mod/bispectrum_counts.h: In constructor ‘BispectrumCounts::BispectrumCounts(Parameters*, KernelInterp*, bool)’:
power_mod/bispectrum_counts.h:90:19: error: ‘class Parameters’ has no member named ‘rmax’; did you mean ‘nmax’?
   90 |         rmax=par->rmax;
      |                   ^~~~
      |                   nmax
power_mod/bispectrum_counts.h:91:19: error: ‘class Parameters’ has no member named ‘rmin’; did you mean ‘kmin’?
   91 |         rmin=par->rmin;
      |                   ^~~~
      |                   kmin
make: *** [<builtin>: grid_power.o] Error 1
make: Leaving directory '/cosma/apps/dp004/dc-brox1/HIPSTER'

COMPUTING BISPECTRUM COUNTS
/cosma/apps/dp004/dc-brox1/HIPSTER/hipster_wrapper_bispectrum.sh: line 171: /cosma/apps/dp004/dc-brox1/HIPSTER/power: No such file or directory

Bispectrum has not been computed. This indicates an error. Exiting.

It points to the line

$CODE_DIR/power -in $DATA -binfile $BINFILE -output $CODE_DIR/output -out_string ${STRING} -max_l $MAX_L -R0 $R0 -nthread $NTHREADS -perbox -f_rand $FRAND

which indeed points to a file/directory that doesn't exist.

JegerBroxterman commented 1 month ago

Upon closer inspection, the issue is not that the power path is not generated but that k_max = par->rmax; and k_min = par->rmin; are set to non-existent variables. I think these should be set to kmin and kmax, respectively as was done in the latest changes that were applied in some of the other files in https://github.com/oliverphilcox/HIPSTER/commit/2e0a9afb998b9f010c5d85a4a4cc9867c12f202a#diff-7f44db15fbf212b2695c4b657b1cdf6918403be8523bc65c1773f0983adebe8f

The same holds for the parameters r_low and r_high that I believe should be changed to k_low and k_high in bispectrum_counts.h

Fixing these issues the code still crashes at line 140 of grid.h

assert(max_boxsize>0&&nside>0&&np>=0);

As np seems to be a negative number.