21cmfast / 21cmFAST

Official repository for 21cmFAST: a code for generating fast simulations of the cosmological 21cm signal
MIT License
58 stars 37 forks source link

Branch debanjan cosmo #284

Closed debanjan-cosmo closed 2 years ago

debanjan-cosmo commented 2 years ago

Hi,

I have added CMB and Lyman-alpha heating to this code. I have done some basic testing and the code seems to work fine. Please check and let me know if anything needs to be done.

CMB heating term is calculated following https://arxiv.org/pdf/2105.14516.pdf. The Lyman-alpha heating is implemented as described in https://doi.org/10.1093/mnras/stab2089.

Best, Debanjan

steven-murray commented 2 years ago

Thank you @debanjan-cosmo! Code-wise, this looks excellent. Physics-wise, I'll get @BradGreig, @andreimesinger or @qyx268 to review.

The only thing I'd like to see is some tests. I think the appropriate thing to do here is to run a lightcone with and without the new features (perhaps one at a time), and show the difference in the power spectra, global Tb, global xH etc. You can make those plots and put them in comments in this PR, to justify that your code is working as expected. Then you'll want to add new test(s) to the tests/produce_integration_test_data.py file and run that file.

So, for example you might add the following entries to the OPTIONS dictionary in that module:

"lyman_alpha_heating": [
        8,
        {"N_THREADS": 4, "USE_Lya_HEATING": True},
    ],
"cmb_heating": [
        8,
        {"N_THREADS": 4, "USE_CMB_HEATING": True},
    ],

Then you would do

cd tests
python produce_integration_test_data.py go --names lyman_alpha_heating --names cmb_heating --no-pt --no-halo

This will produce a few new files in the tests directory which you then add to git and upload.

debanjan-cosmo commented 2 years ago

Thanks, Steven. I'll do the tests and upload the results.

Best, Debanjan

On Wed, 18 May 2022 at 16:33, Steven Murray @.***> wrote:

Thank you @debanjan-cosmo https://github.com/debanjan-cosmo! Code-wise, this looks excellent. Physics-wise, I'll get @BradGreig https://github.com/BradGreig, @andreimesinger https://github.com/andreimesinger or @qyx268 https://github.com/qyx268 to review.

The only thing I'd like to see is some tests. I think the appropriate thing to do here is to run a lightcone with and without the new features (perhaps one at a time), and show the difference in the power spectra, global Tb, global xH etc. You can make those plots and put them in comments in this PR, to justify that your code is working as expected. Then you'll want to add new test(s) to the tests/produce_integration_test_data.py file and run that file.

So, for example you might add the following entries to the OPTIONS dictionary in that module:

"lyman_alpha_heating": [ 8, {"N_THREADS": 4, "USE_Lya_HEATING": True}, ],"cmb_heating": [ 8, {"N_THREADS": 4, "USE_CMB_HEATING": True}, ],

Then you would do

cd tests python produce_integration_test_data.py go --names lyman_alpha_heating --names cmb_heating --no-pt --no-halo

This will produce a few new files in the tests directory which you then add to git and upload.

— Reply to this email directly, view it on GitHub https://github.com/21cmfast/21cmFAST/pull/284#issuecomment-1130024220, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUR6I2GHJO4ZZR7OSNR37ITVKTWSXANCNFSM5WHOEHUQ . You are receiving this because you were mentioned.Message ID: @.***>

debanjan-cosmo commented 2 years ago

Hi,

I tried to conduct the test and I am getting the following error message.

File "produce_integration_test_data.py", line 699, in main() File "/Users/debanjansarkar/Desktop/My_venvs_python/venv_for_21cmfast_new/lib/python3.8/site-packages/click-8.0.3-py3.8.egg/click/core.py", line 1128, in call return self.main(args, kwargs) File "/Users/debanjansarkar/Desktop/My_venvs_python/venv_for_21cmfast_new/lib/python3.8/site-packages/click-8.0.3-py3.8.egg/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/Users/debanjansarkar/Desktop/My_venvs_python/venv_for_21cmfast_new/lib/python3.8/site-packages/click-8.0.3-py3.8.egg/click/core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/debanjansarkar/Desktop/My_venvs_python/venv_for_21cmfast_new/lib/python3.8/site-packages/click-8.0.3-py3.8.egg/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, ctx.params) File "/Users/debanjansarkar/Desktop/My_venvs_python/venv_for_21cmfast_new/lib/python3.8/site-packages/click-8.0.3-py3.8.egg/click/core.py", line 754, in invoke return __callback(args, kwargs) File "produce_integration_test_data.py", line 601, in go produce_power_spectra_for_tests(name, redshift, force, direc, kwargs) File "produce_integration_test_data.py", line 456, in produce_power_spectra_for_tests k, p, coeval = produce_coeval_power_spectra(redshift, kwargs) File "produce_integration_test_data.py", line 325, in produce_coeval_power_spectra coeval = run_coeval(write=write_ics_only_hook, options) File "/Users/debanjansarkar/Desktop/My_venvs_python/venv_for_21cmfast_new/lib/python3.8/site-packages/21cmFAST-3.1.4.dev28+gbb049dc.d20220518-py3.8-macosx-10.9-x86_64.egg/py21cmfast/wrapper.py", line 2343, in run_coeval ib2 = ionize_box( File "/Users/debanjansarkar/Desktop/My_venvs_python/venv_for_21cmfast_new/lib/python3.8/site-packages/21cmFAST-3.1.4.dev28+gbb049dc.d20220518-py3.8-macosx-10.9-x86_64.egg/py21cmfast/wrapper.py", line 1640, in ionize_box return box.compute( File "/Users/debanjansarkar/Desktop/My_venvs_python/venv_for_21cmfast_new/lib/python3.8/site-packages/21cmFAST-3.1.4.dev28+gbb049dc.d20220518-py3.8-macosx-10.9-x86_64.egg/py21cmfast/outputs.py", line 601, in compute return self._compute( File "/Users/debanjansarkar/Desktop/My_venvs_python/venv_for_21cmfast_new/lib/python3.8/site-packages/21cmFAST-3.1.4.dev28+gbb049dc.d20220518-py3.8-macosx-10.9-x86_64.egg/py21cmfast/_utils.py", line 1376, in _compute inputs = [arg() if isinstance(arg, StructWrapper) else arg for arg in args] File "/Users/debanjansarkar/Desktop/My_venvs_python/venv_for_21cmfast_new/lib/python3.8/site-packages/21cmFAST-3.1.4.dev28+gbb049dc.d20220518-py3.8-macosx-10.9-x86_64.egg/py21cmfast/_utils.py", line 1376, in inputs = [arg() if isinstance(arg, StructWrapper) else arg for arg in args] File "/Users/debanjansarkar/Desktop/My_venvs_python/venv_for_21cmfast_new/lib/python3.8/site-packages/21cmFAST-3.1.4.dev28+gbb049dc.d20220518-py3.8-macosx-10.9-x86_64.egg/py21cmfast/_utils.py", line 470, in call setattr(self._cstruct, key, val) TypeError: an integer is required

I could not locate the error. Can you please help me with this?

steven-murray commented 2 years ago

Hi @debanjan-cosmo, it looks like you're trying to set an integer value on one of the InputStructs with a non-integer. What exact code are you running?

debanjan-cosmo commented 2 years ago

Hi,

Actually I pushed a wrong file and it created problem. I faced some problem locally with that branch. So I deleted it and created a fresh branch. I have performed the test on this new branch and it generated two files. I have pushed the changes and new files in the new branch. I’ll try a pull request tomorrow once I have the results which I can show with the PR comment.

Thanks for the help.

Best, @debanjan-cosmo

On Thu, 19 May 2022 at 16:19 Steven Murray @.***> wrote:

Hi @debanjan-cosmo https://github.com/debanjan-cosmo, it looks like you're trying to set an integer value on one of the InputStructs with a non-integer. What exact code are you running?

— Reply to this email directly, view it on GitHub https://github.com/21cmfast/21cmFAST/pull/284#issuecomment-1131679440, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUR6I2EKW6R4PUDJMXSQOJDVKY5W7ANCNFSM5WHOEHUQ . You are receiving this because you were mentioned.Message ID: @.***>

-- DEBANJAN SARKAR

----------------------------------------------------------- Department of Physics Ben-Gurion University of the Negev Beer-Sheva, Israel Mob: +972-53-8540546 Email: @. @.