diff --git a/make_movie.py b/make_movie.py index ac7d224..e534f3a 100755 --- a/make_movie.py +++ b/make_movie.py @@ -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 @@ -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() \ No newline at end of file + Movie.record() diff --git a/video/scripts/moviemaker.py b/video/scripts/moviemaker.py index 8a863a5..0008623 100644 --- a/video/scripts/moviemaker.py +++ b/video/scripts/moviemaker.py @@ -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, @@ -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: @@ -248,4 +255,4 @@ def fading_effect(source, frames): cv.imwrite(new_im_name, output) if __name__ == '__main__': - print('Cannot call script directly.') \ No newline at end of file + print('Cannot call script directly.')