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

add flag to disable point source mask in analysis #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions project/data_analysis/python/get_window_dr6.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def create_crosslink_mask(xlink_map, cross_link_threshold):
window_dir = "windows"
surveys = d["surveys"]

disable_ptsrc_mask = ("disable_ptsrc_mask" in d) and d["disable_ptsrc_mask"]

pspy_utils.create_directory(window_dir)

patch = None
Expand Down Expand Up @@ -128,9 +130,11 @@ def create_crosslink_mask(xlink_map, cross_link_threshold):
# Now we create the final window function that will be used in the analysis
survey_mask.data[dist.data < skip_from_edges_degree] = 0
survey_mask = so_window.create_apodization(survey_mask, "C1", apod_survey_degree, use_rmax=True)
ps_mask = so_map.read_map(d[f"ps_mask_{sv}_{ar}"])
ps_mask = so_window.create_apodization(ps_mask, "C1", apod_pts_source_degree, use_rmax=True)
survey_mask.data *= ps_mask.data

if disable_ptsrc_mask == False:
Copy link
Collaborator

@xgarrido xgarrido Jan 30, 2023

Choose a reason for hiding this comment

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

Default should be False then you can write

if not d.get("disable_ptsrc_maks", False):

You can then remove line 54

Copy link
Collaborator

Choose a reason for hiding this comment

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

or maybe it's even clearer

if d.get("enable_ptsrc_mask", True):

Copy link
Collaborator

Choose a reason for hiding this comment

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

@xzackli what do you think about the above changes ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@thibautlouis are you ok with adding enable_ptsrc_mask to every param file?

Copy link
Collaborator

@thibautlouis thibautlouis Jul 19, 2023

Choose a reason for hiding this comment

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

Hi Zack, the only issue I see with this is the fact that we use the point source mask in other part of the analysis, for example in get_alms.py ( ps_map.data *= ps_mask.data) where we add back sources that are below the flux cut threshold. I think this will lead to strange behavior compared to what is expected by the user when he set enable_ptsrc_mask=False. Since this option is only important for a very specific test case, what I would do if I were you would just be to create a unity template (all value set to 1) and pass this as an argument in the dictfile instead of a point source mask. It might look ugly and wasteful, however not using a point source mask in pspipe is such a specific test case that I don't think it's problematic.

ps_mask = so_map.read_map(d[f"ps_mask_{sv}_{ar}"])
ps_mask = so_window.create_apodization(ps_mask, "C1", apod_pts_source_degree, use_rmax=True)
survey_mask.data *= ps_mask.data

survey_mask.data = survey_mask.data.astype(np.float32)
survey_mask.write_map(f"{window_dir}/window_{sv}_{ar}.fits")
Expand Down