Closed EiffL closed 3 years ago
Hi @EiffL! I found the solution by taking your suggestion and defining the variables:
a = afactor(r)
a_s=z2a(1.00) ds=chifactor(a_s)
Inside the power_spectrum_for_cosmology function. Thank you! But I have a new problem, trying to build the function to compute the gradient (or the Jacobian), I'm running into the following error:
TypeError: Expected int32, got 0.0 of type 'float' instead.
The whole message (too long) is here notebooks/spectrum_for_cosmology.ipynb.
How can I fix it?
I can explain later why it happened
ok @dlanzieri , I think this is all solved for now: https://github.com/LSSTDESC/DifferentiableHOS/blob/main/notebooks/spectrum_for_cosmology2.ipynb
Sorry it took me a while to get to it, there were a few remaining problems, the biggest one I think is that we were computing the linear power spectrum more than necessary, and that was making things very complicated. Here I'm using instead an interpolation scheme to evaluate the linear power spectrm at the positions ndeeded for initializing the linear field.
This notebook is still approximate though, I reduced the number of steps and lensplanes to have something that went faster.
Also, loooking at our flowpm code, I found a bunch of problems in how we were handling the cosmology, and I've opened a PR to fix these issues: https://github.com/modichirag/flowpm/pull/67
I propose we follow the following strategy:
I'm going to close this one, because I think we did all the steps :-)
While trying to build a tf.function to compute the lensing power spectrum from the simulation, we are running into the following error:
Below is a MWE to reproduce the issue:
A longer version of this example can be found in this notebook
Any idea of what could be wrong ?