sbird / fake_spectra

A code for generating fake spectra from a cosmological simulation
MIT License
12 stars 13 forks source link

get_kernel raises an error when reading BigFile #8

Closed andreufont closed 7 years ago

andreufont commented 7 years ago

I generated a box using MP-Gadget, and when I read the BigFile outputs using fake_spectra I get the following error:

assert kernel == 1 AssertionError

This error is thrown at the end of get_kernel function in abstractsnapshot.py

When I run the code, kernel has a value of 2, so the code crashes. If I fix it to 1 by hand, it runs fine...

andreufont commented 7 years ago

This is the code I use:

from randspectra import RandSpectra sim_dir = "../Sims/L10_N128_z9_MPI12/output/" snap_num = 4

Extract spectra from simulation

rr = RandSpectra(snap_num, sim_dir, thresh=0., numlos=10) rr.get_tau("H",1,1215)

sbird commented 7 years ago

This is warning you that you ran MP-Gadget in a mode that fake_spectra does not (yet) support. fake_spectra only support cubic spline kernels, as used in the old-school vanilla Gadget SPH. The quintic and quartic splines have different smoothing length definitions and so need to be interpolated differently, which I have not yet implemented.

You can get a snapshot that fake_spectra will read by setting DensityKernelType=cubic in MP-Gadget's parameter file. You should probably also turn off DENSITY_INDEPENDENT_SPH

andreufont commented 7 years ago

Thanks for the clarification. I recompiled the code without that FLAG, changed the parameter file to use cubic interpolation, and rerun the simulation. It works!
I believe this might explain why I was having low values of the mean flux (I started an issue in MP-Gadget about it). Will confirm soon.

We could close this issue.

sbird commented 7 years ago

Low mean flux would indeed be the result of doing this! Each particle would be smeared over a wide area.