Skip to content

Commit caa1e81

Browse files
authored
Update imaging.py
1 parent e156cf0 commit caa1e81

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/pista/imaging.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def check_df(self):
297297
if 'x' in self.df.keys() and 'y' in self.df.keys():
298298
print("Converting xy to ra-dec")
299299
self.df = self.xy_to_radec(self.df, self.n_x, self.n_y,
300-
self.pixel_scale)
300+
self.pixel_scale,self.theta)
301301
else:
302302
raise Exception("'ra','dec','x',or 'y', \
303303
columns not found in input dataframe ")
@@ -346,14 +346,17 @@ def init_image_array(self, return_img=False):
346346

347347
return image
348348

349-
def xy_to_radec(self, df, n_x, n_y, pixel_scale):
349+
def xy_to_radec(self, df, n_x, n_y, pixel_scale, theta=0):
350350

351351
w = WCS(naxis=2)
352352
w.wcs.crpix = [n_x//2, n_y//2]
353353
w.wcs.cdelt = np.array([-pixel_scale/3600, pixel_scale/3600])
354354
w.wcs.crval = [10, 10]
355355
w.wcs.ctype = ['RA---TAN', 'DEC--TAN']
356356

357+
w.wcs.pc = np.array([[np.cos(theta), -np.sin(theta)],
358+
[np.sin(theta), np.cos(theta)]])
359+
357360
pos = np.array([df['x'], df['y']])
358361
coords = np.array(w.pixel_to_world_values(pos.T))
359362
df['ra'] = np.flip(coords[:, 0])

0 commit comments

Comments
 (0)