Skip to content
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

Remove blinding civ [bump minor] #1046

Closed
wants to merge 12 commits into from
Closed

Remove blinding civ [bump minor] #1046

wants to merge 12 commits into from

Conversation

iprafols
Copy link
Collaborator

Blinding is removed when running on metal forests

py/picca/io.py Outdated
else: # This is for BinTable format

# check if we are doing metal forests
if "MIN_RF_WAVE" in header and "MIN_RF_WAVE" in header:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iprafols - you probably meant MAX_RF_WAVE in one of these clauses

py/picca/io.py Outdated
max_rf_wave = header["MAX_RF_WAVE"]
if min_rf_wave > lya_wave and max_rf_wave > lya_wave:
if lambda_abs2 is None:
lambda_abs2 = lambda_abs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to set lambda_abs2 here?

py/picca/io.py Outdated
if lambda_abs2 is None:
lambda_abs2 = lambda_abs
blinding_tracers = ["LYA", "QSO"]
if tracer1 not in blinding_tracers and tracer2 not in blinding_tracers:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iprafols - I think you want to have an "or" here, since we don't want to blind QSO x CIV either. Basically, you want to blind only when both tracers are either LyA or QSO

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iprafols - it looks like you have fixed this above (for the ImageHDU format) but you have not fixed it for the BinTable format. It still says "and" instead of "or"

Copy link
Contributor

@andreufont andreufont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iprafols - I added several comments on the code, most of them are important enough that should be fixed.

I'm also surprised by the large number of files changed, in particular some log files related to picca delta attributes? Are these related to automated testing, or were they added by mistake?

@andreufont
Copy link
Contributor

andreufont commented Oct 24, 2023

Another comment: when @julienguy runs his analysis of CIV auto-correlations, he actually tells Picca to run the Lya auto-correlation but passes CIV deltas. He does this because he wants to see use the "wrong" Lya coordinates that we use in the main analysis, but without having to deal with the Lya correlation "contaminating" the CIV signal.

Similarly, we don't want to blind either the QSO x CIV(LYA) correlation (that Cesar is computing).

So we should only blind when we have all of the above TRUE:

  • lambda_rf_min < lambda_lya
  • tracer1 in [QSO, LYA]
  • tracer2 in [QSO, LYA]

Even when only one of these is False we should not blind. Do you agree @julienguy ?

@iprafols
Copy link
Collaborator Author

iprafols commented Oct 24, 2023

Hi @andreufont , I fixed the comments on the code. Thanks!
Regarding your question about the changes in the test suite, since I had to add a couple of keywords in the headers, the automatic tests were complaining that the headers were not the same (thus my having to update them)

@iprafols
Copy link
Collaborator Author

iprafols commented Nov 6, 2023

@andreufont , are you happy with the changes? should we merge this?

@andreufont andreufont self-requested a review November 7, 2023 05:45
@@ -253,7 +253,7 @@ def main(cmdargs):
xcf.lambda_abs = constants.ABSORBER_IGM[args.lambda_abs]

# read blinding keyword
blinding = io.read_blinding(args.in_dir)
blinding = io.read_blinding(args.in_dir, args.lambda_abs, args.lambda_abs_obj)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have expected the second argument here would be 'obj_name' as in picca_xcf, but I noticed that this variable is named different in this (not very popular) script, so we can leave it as is for now.

Copy link
Contributor

@andreufont andreufont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iprafols - has this been tested? I found a couple of bugs that I think should be fixed, and it would also be good if someone looking into these (Andrea? Julien? Cesar?) checked that the branch works as intended.

py/picca/io.py Outdated
max_rf_wave = header["MAX_RF_WAVE"]
if min_rf_wave > lya_wave and max_rf_wave > lya_wave:
if tracer2 is None:
tracer2 = lambda_abs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iprafols - where have you defined lambda_abs? Shouldn't you use here tracer2 = tracer1?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested this code? It looks like it should have crashed...

py/picca/io.py Outdated
max_rf_wave = header["MAX_RF_WAVE"]
if min_rf_wave > lya_wave and max_rf_wave > lya_wave:
if tracer2 is None:
tracer2 = lambda_abs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, this should be tracer2 = tracer1

py/picca/io.py Outdated
if lambda_abs2 is None:
lambda_abs2 = lambda_abs
blinding_tracers = ["LYA", "QSO"]
if tracer1 not in blinding_tracers and tracer2 not in blinding_tracers:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iprafols - it looks like you have fixed this above (for the ImageHDU format) but you have not fixed it for the BinTable format. It still says "and" instead of "or"

@iprafols
Copy link
Collaborator Author

iprafols commented Nov 7, 2023

I fixed the bugs, but indeed we should fully test this (I have not had the time to properly do it)

Copy link
Contributor

@andreufont andreufont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good. Let's see if @Andrea-MG and @julienguy can run their CIV codes on this branch and get unblind results, before we merge.

@iprafols
Copy link
Collaborator Author

iprafols commented Nov 7, 2023

tests (python 3.10) are failing due to a weird coveralls error. Maybe their server is down. Otherwise, they might have updated something and the new version is not backwards compatible. We should try to rerun failing tests in a while to see if it was just their server being down or not

@Waelthus
Copy link
Contributor

Waelthus commented Nov 7, 2023

server seems to not be down according to this. Restarted the tests which was not successful, but apparently even with servers up they had similar issues half a year back due to software updates on their side, lets just wait...

Copy link
Contributor

@andreufont andreufont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we are doing this right. When one of the tracers is not LYA or QSO, the rest-frame range shouldn't matter. In other words, if you are looking at CIV absorption in the LYB region, you should not blind either.

@andreufont
Copy link
Contributor

@iprafols , @Andrea-MG - I think we should change the order of the if clauses.

if tracer1 not in blinding_tracers or tracer2 not in blinding_tracers:
    # one of the tracers is not relevant, so do not blind (ever)
    blinding=None
else:
    # we are now in the danger zone, the only way out is if there is no LyA absorption in this region
    if min_rf_wave > lya_wave:
        blinding=None

@Andrea-MG
Copy link
Collaborator

The changes look good. Let's see if @Andrea-MG and @julienguy can run their CIV codes on this branch and get unblind results, before we merge.

I sent feedback to @iprafols and after the fixes I could run successfully cf, xcf, dmat and xdmat with these changes, testing with CIV and Lyb forests.

Copy link
Collaborator

@Andrea-MG Andrea-MG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have run successfully cf, xcf, dmat and xdmat with these changes, testing with CIV and Lyb forests with @iprafols and get in all "blinding = none" in all.

if ((min_rf_wave > lya_wave and max_rf_wave > lya_wave) or
(min_rf_wave < lyb_wave and max_rf_wave < lyb_wave)):
# we are doing a metal forest, so do not blind (ever)
blinding = "none"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iprafols , @Andrea-MG - Are you sure about this? It looks to me that the this code would not blind the QSO x LyA(LyB) correlation.

I believe the "if" statement in line 263 should only have the first line (check that both rf_wave are above lya_wave), but it should not have the second condition.

@iprafols iprafols closed this Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants