Skip to content

Conversation

@iancze
Copy link
Collaborator

@iancze iancze commented Oct 29, 2022

WIP pull request to implement the PrimaryBeam correction for MPoL.

Copy link
Collaborator Author

@iancze iancze left a comment

Choose a reason for hiding this comment

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

Looking great so far!


class PBCorrectedCube(nn.Module):
r"""
A ImageCube that has been corrected for the expected primary beam. Currently only implemented for ALMA.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As I mentioned in the issue, I think you can be agnostic about which array this is, and split the corrections into two classes, one for a uniform illuminated dish, and the other with a central blockage.

cell_size=None,
npix=None,
coords=None,
chan_freqs=None,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nitpicky, but I would say freqs to be consistent with other usages.

self.telescope_to_radius = {"ALMA_12": 6.} # in meters
self.telescope_to_blocked_radius = {"ALMA_12": 0.375}

assert (telescope in self.telescope_to_radius) and (telescope in self.telescope_to_blocked_radius)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think separating this into two PB types (uniform and centrally blocked) will simplify the logic here, and make the choice between them more obvious to the user.

R_obs = telescope_to_blocked_radius[telescope]

r_coords = np.sqrt(self.packed_x_centers_2D**2 + self.packed_y_centers_2D**2) # units of arcsec
r_coords_rads = r_coords * np.pi/648000. # radians
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Where do these constants originate from? If you need speed of light, you can import the variables from constants: https://github.com/MPoL-dev/MPoL/blob/main/src/mpol/constants.py

Eventually we should probably just start depending on astropy, but that's for another day.


assert (telescope in self.telescope_to_radius) and (telescope in self.telescope_to_blocked_radius)

self.pb_mask = self.obscured_airy_disk(chan_freqs, telescope)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You might want to add a comment here noting that pb_mask is actually in packed cube format. I need to be a bit better about specifying these throughout the ImageCube too.

def __init__(self, cell_size=None, npix=None, coords=None):

super().__init__()
super().__init__(cell_size)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why does cell_size need to be passed here?

coords=self.coords, nchan=self.nchan, passthrough=True
)

self.pbcube = images.PBCorrectedCube(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Rather than modifying SimpleNet, I think it might be better to subclass it as a new SimplePBNet and then make your modifications to that. I think that for learning purposes new users will want to start with literally the simplest thing possible, and the PB correction is a step up from that

@iancze
Copy link
Collaborator Author

iancze commented Oct 29, 2022

@kdesoto-psu I started a WIP pull request and added some comments for you here. If you continue to push to your main branch as you would normally do, this should continue to update and we can centralize comments here.

kadri-nizam and others added 28 commits February 5, 2023 18:12
_setup_coord function replaced with classmethods
Started type hinting Dartboard. The conditional statements can be simplified by rewriting them as guard clauses.

Copied attributes from coords can be rewritten as `@property` to save memory
The numpy type hints are a little long, but Python 3.8 doesn't support type aliasing.
"Beautiful is better than ugly."
The init logic can be simplified by treating the if statement as a guard clause
init function has been simplified as well
…order

pre-release.yml: move linter after mpol install
iancze and others added 28 commits March 23, 2023 07:00
Co-authored-by: Jeff Jennings <jjennings1519@gmail.com>
Co-authored-by: Jeff Jennings <jjennings1519@gmail.com>
Co-authored-by: Jeff Jennings <jjennings1519@gmail.com>
Co-authored-by: Jeff Jennings <jjennings1519@gmail.com>
Co-authored-by: Jeff Jennings <jjennings1519@gmail.com>
Co-authored-by: Jeff Jennings <jjennings1519@gmail.com>
Co-authored-by: Jeff Jennings <jjennings1519@gmail.com>
Co-authored-by: Jeff Jennings <jjennings1519@gmail.com>
Co-authored-by: Jeff Jennings <jjennings1519@gmail.com>
Co-authored-by: Jeff Jennings <jjennings1519@gmail.com>
Co-authored-by: Jeff Jennings <jjennings1519@gmail.com>
…leNet, currently can only handle one channel
@iancze
Copy link
Collaborator Author

iancze commented Mar 25, 2023

Closing this PR #103 for now and will shortly re-open new PR to see if it provides better diff (not full duplication).

Edit: now available in #177

@iancze iancze closed this Mar 25, 2023
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