Skip to content

Commit

Permalink
Merge pull request #1 from lmorabit/master
Browse files Browse the repository at this point in the history
small updates
  • Loading branch information
jurjen93 authored Jul 20, 2021
2 parents 2daf0e3 + 56764ea commit 2b3fa0f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions make_movie.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def isNaN(a):
if args.csvfile:#go through all objects in csv file
df = pd.read_csv(args.csvfile)[['RA', 'DEC', 'imsize']]

start_coord = Movie.wcs.pixel_to_world(Movie.image_data.shape[0]/2, Movie.image_data.shape[0]/2)
start_coord = Movie.wcs.pixel_to_world(Movie.image_data.shape[1]/2, Movie.image_data.shape[0]/2)
start_dec = start_coord.dec.degree
start_ra = start_coord.ra.degree

Expand Down Expand Up @@ -132,4 +132,4 @@ def isNaN(a):
move_to_frames = max(int(4*dist*Movie.framerate), 2)
Movie.move_to(N_frames=move_to_frames, ra=position[0], dec=position[1])
Movie.zoom(N_frames=int(3*Movie.framerate), imsize_out=3)
Movie.record()
Movie.record()
13 changes: 10 additions & 3 deletions video/scripts/moviemaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,15 @@ def make_frame(self, N, ra = None, dec = None, imsize: float = None, dpi: float
"""
print(colored(f"Frame number: {N-self.N_min}/{self.N_max-self.N_min}", 'red'), end='\r')

## reduce jitter by always having a central pixel (force odd size)
size1 = np.int(imsize/np.max(self.wcs.pixel_scale_matrix))
size2 = np.int(imsize/np.max(self.wcs.pixel_scale_matrix)*1.77)
if size1%2 == 0:
size1 = size1 + 1
if size2%2 == 0:
size2 = size2 + 1
self.image_cutout(pos=(ra, dec),
size=(np.int(imsize/np.max(self.wcs.pixel_scale_matrix)), np.int(imsize/np.max(self.wcs.pixel_scale_matrix)*1.77)),
size=(size1,size2),
dpi=dpi,
image_name=f'image_{str(N).rjust(5, "0")}.png',
cmap=self.cmap,
Expand Down Expand Up @@ -173,7 +180,7 @@ def zoom(self, N_frames: int = None, first_time: bool=False, imsize_out: float =
if not full_im:
begin_size/=2
end_size = self.imsize
coordinates = self.wcs.pixel_to_world(int(self.image_data.shape[0]/2), int(self.image_data.shape[0]/2))
coordinates = self.wcs.pixel_to_world(int(self.image_data.shape[1]/2), int(self.image_data.shape[0]/2))
self.dec = coordinates.dec.degree
self.ra = coordinates.ra.degree
else:
Expand Down Expand Up @@ -248,4 +255,4 @@ def fading_effect(source, frames):
cv.imwrite(new_im_name, output)

if __name__ == '__main__':
print('Cannot call script directly.')
print('Cannot call script directly.')

0 comments on commit 2b3fa0f

Please sign in to comment.