Skip to content

fix-redshift-minus-one-lib_tools-gravwaves#133

Open
shreyas-tiruvaskar wants to merge 2 commits intonanograv:mainfrom
shreyas-tiruvaskar:fix-redshift-minus-one-lib_tools-gravwaves
Open

fix-redshift-minus-one-lib_tools-gravwaves#133
shreyas-tiruvaskar wants to merge 2 commits intonanograv:mainfrom
shreyas-tiruvaskar:fix-redshift-minus-one-lib_tools-gravwaves

Conversation

@shreyas-tiruvaskar
Copy link
Contributor

Description

Setting redz=-1.0 for the binaries not merging within the age of the universe causes problems. -1 is used as a flag to identify such binaries, but that redshift value is used in averaging, which can cause troubles.

While converting the redz_final from (91, 81, 101, 5) to (90, 80, 100, 5), i.e. going from bin edges to bin midpoints, the average is taken of the 8 vertex redshift values to obtain an average bin mid-point value. That -1 was creating problem by occasionally causing very small positive midpoint redshift values.

My fix changes the flag value from -1 to -np.inf in librarian/lib_tools.py. So that in averaging, the result can't become accidentally positive.

This, however, creates nan values for those bins in gravwaves.py hs calculation in the function char_strain_sq_from_bin_edges_redz. I fix that by simply applying a filter there.

@shreyas-tiruvaskar
Copy link
Contributor Author

Even though I have used -np.inf, more robust and safe option would be using np.nan. Although, it would mean more changes in different relevant files. I didn't do it because of time constraints.

@kayhangultekin
Copy link
Collaborator

@lzkelley This was the PR I was talking about in our zoom.

@kayhangultekin kayhangultekin added the bug Something isn't working label Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants