Skip to content

[Question] ION_Tvir_MIN seems to be a dummy parameter #536

@zhaotingchen

Description

@zhaotingchen

Describe what you would like to do

I am familiarising myself with the v4 interface. One thing I noticed is that the default case is no longer the simple 2-parameter model (which is fine but I feel like there can be a warning). But after configuring what I think is the correct case of invoking the simple (zeta, Tvir) case, changing Tvir does not seem to modify anything (but setting different HII_EFF_FACTOR does make a difference)

What I've tried

import numpy as np
import py21cmfast as p21c

cache_dir = '_cache'
#run fiducial model
input_params = p21c.InputParameters.from_template('const-zeta',random_seed = 12345,).evolve_input_structs(
    HII_DIM = 32,
    BOX_LEN = 128,
    N_THREADS=8,
)
# [4.69897 30.0]
print(input_params.astro_params.ION_Tvir_MIN,input_params.astro_params.HII_EFF_FACTOR)
cache = p21c.OutputCache(cache_dir)

coevals = []
for coeval,in_outputs in p21c.generate_coeval(
    inputs=input_params,
    out_redshifts=[8],
    cache=cache,
):
    if in_outputs:
        coevals.append(coeval)
xhi_box1 = coevals[0].neutral_fraction

# change ION_Tvir_MIN 
input_params = p21c.InputParameters.from_template('const-zeta',random_seed = 12345,).evolve_input_structs(
    HII_DIM = 32,
    BOX_LEN = 128,
    N_THREADS=8,
    ION_Tvir_MIN = 5.4,
)
# [5.4 30.0]
print(input_params.astro_params.ION_Tvir_MIN,input_params.astro_params.HII_EFF_FACTOR)

coevals = []
for coeval,in_outputs in p21c.generate_coeval(
    inputs=input_params,
    out_redshifts=[8],
    cache=cache,
):
    if in_outputs:
        coevals.append(coeval)
xhi_box2 = coevals[0].neutral_fraction

print(xhi_box1.mean()) # 0.2927972, not 0
assert np.allclose(xhi_box1,xhi_box2) # they are the same

Other context

I have also tested cases with MASS_DEPENDENT_ZETA=True. Also tried clearing cache before running the second coeval box.

If this is not desired behaviour, I will modify this issue to be a bug report. If this is desired, I would like to understand how it works and what kind of astro_options do I tune to get to the simplest case, as it is fairly useful for testing.

This is tested on the main branch with pip install -e ".[dev]". Version number is '4.0.0b1.dev205+g5c06e4b6'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions