Skip to content

Commit

Permalink
Add ra back to calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
aknierim committed Jul 22, 2024
1 parent ab726a1 commit eeaac67
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pyvisgen/simulation/observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,13 @@ def create_rd_grid(self):
# define resolution
res = fov / self.img_size

ra = torch.deg2rad(self.ra)
dec = torch.deg2rad(self.dec)

r = (
torch.arange(self.img_size, device=self.device, dtype=torch.float64)
- self.img_size / 2
) * res
) * res + ra
d = (
torch.arange(self.img_size, device=self.device, dtype=torch.float64)
- self.img_size / 2
Expand All @@ -390,13 +391,18 @@ def create_lm_grid(self):
3d array
Returns a 3d array with every pixel containing a l and m value
"""
ra = torch.deg2rad(self.ra)
dec = torch.deg2rad(self.dec)

lm_grid = torch.zeros(self.rd.shape, device=self.device, dtype=torch.float64)
lm_grid[:, :, 0] = (torch.cos(self.rd[..., 1]) * torch.sin(self.rd[..., 0])).T
lm_grid[:, :, 0] = (
torch.cos(self.rd[..., 1]) * torch.sin(self.rd[..., 0] - ra)
).T
lm_grid[:, :, 1] = (
torch.sin(self.rd[..., 1]) * torch.cos(dec)
- torch.cos(self.rd[..., 1]) * torch.sin(dec) * torch.cos(self.rd[..., 0])
- torch.cos(self.rd[..., 1])
* torch.sin(dec)
* torch.cos(self.rd[..., 0] - ra)
).T
return lm_grid

Expand Down

0 comments on commit eeaac67

Please sign in to comment.