-
Notifications
You must be signed in to change notification settings - Fork 47
Beta esc #538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Beta esc #538
Changes from all commits
976e221
06b2112
5ce8bea
51a5b19
e5715bc
9b22eab
d84ba36
cec161f
53338d2
32aecef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1103,11 +1103,11 @@ def _USE_MINI_HALOS_vald(self, att, val): | |
|
|
||
| @PHOTON_CONS_TYPE.validator | ||
| def _PHOTON_CONS_TYPE_vld(self, att, val): | ||
| """Raise an error if using PHOTON_CONS_TYPE='z_photoncons' and USE_MINI_HALOS is True.""" | ||
| """Raise an error if using PHOTON_CONS_TYPE='z-photoncons' and USE_MINI_HALOS is True.""" | ||
| if self.USE_MINI_HALOS and val == "z-photoncons": | ||
| raise ValueError( | ||
| "USE_MINI_HALOS is not compatible with the redshift-based" | ||
| " photon conservation corrections (PHOTON_CONS_TYPE=='z_photoncons')! " | ||
| " photon conservation corrections (PHOTON_CONS_TYPE=='z-photoncons')! " | ||
| ) | ||
|
|
||
| @USE_EXP_FILTER.validator | ||
|
|
@@ -1182,6 +1182,12 @@ class AstroParams(InputStruct): | |
| ALPHA_ESC : float, optional | ||
| Power-law index of escape fraction as a function of halo mass. See Sec 2.1 of | ||
| Park+2018. | ||
| BETA_ESC : float, optional | ||
| Power-law index of escape fraction as a function of redshift. See Eq. 2 of | ||
| Qin+2025. | ||
| BETA_ESC_MINI : float, optional | ||
| Power-law index of escape fraction as a function of redshift for minihalos. | ||
| If the scaling relations are not provided explicitly, we extend the ACG ones by default. | ||
| M_TURN : float, optional | ||
| Turnover mass (in log10 solar mass units) for quenching of star formation in | ||
| halos, due to SNe or photo-heating feedback, or inefficient gas accretion. | ||
|
|
@@ -1276,6 +1282,11 @@ class AstroParams(InputStruct): | |
| default=-0.5, | ||
| converter=float, | ||
| ) | ||
| BETA_ESC: float = field( | ||
| default=0.0, | ||
| converter=float, | ||
| ) | ||
| BETA_ESC_MINI: float = field(converter=float) | ||
| F_ESC7_MINI: float = field( | ||
| default=-2.0, | ||
| converter=float, | ||
|
|
@@ -1372,6 +1383,10 @@ def _F_STAR7_MINI_default(self): | |
| def _ALPHA_STAR_MINI_default(self): | ||
| return self.ALPHA_STAR | ||
|
|
||
| @BETA_ESC_MINI.default | ||
| def _BETA_ESC_MINI_default(self): | ||
| return self.BETA_ESC | ||
|
|
||
| @L_X_MINI.default | ||
| def _L_X_MINI_default(self): | ||
| return self.L_X | ||
|
|
@@ -1430,6 +1445,8 @@ def get_logspaced_redshifts( | |
| ) -> tuple[float]: | ||
| """Compute a sequence of redshifts to evolve over that are log-spaced.""" | ||
| redshifts = [min_redshift] | ||
| if z_step_factor <= 1.0: | ||
| return (min_redshift,) | ||
| while redshifts[-1] < max_redshift: | ||
| redshifts.append((redshifts[-1] + 1.0) * z_step_factor - 1.0) | ||
|
|
||
|
|
@@ -1651,6 +1668,18 @@ def _astro_params_validator(self, att, val): | |
| "update of M_TURN", | ||
| stacklevel=2, | ||
| ) | ||
| if ( | ||
| self.astro_options.USE_MASS_DEPENDENT_ZETA | ||
| and val.BETA_ESC != 0 | ||
| and self.astro_options.PHOTON_CONS_TYPE | ||
| not in ["no-photoncons", "alpha-photoncons"] | ||
| ): | ||
| warnings.warn( | ||
| f"You have set BETA_ESC != 0 but PHOTON_CONS_TYPE is {self.astro_options.PHOTON_CONS_TYPE}. " | ||
| "This changes the escape fraction so it is not consistent with the manual setting of scaling." | ||
| "Set PHOTON_CONS_TYPE to 'no-photoncons' or 'alpha-photoncons' if you want the scaling to be exact.", | ||
| stacklevel=2, | ||
| ) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Someone else may have an opinion on this, but if there is a real problem using these two models together then perhaps we should throw an error instead of a warning
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think an error will be better. Warnings are too easy to ignore.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand is what is happening when we turn on |
||
|
|
||
| if ( | ||
| self.astro_options.HII_FILTER == "sharp-k" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this!