def construct_illustris_images(num_of_images, illustris_gal_path): """ function returns N images of the same galaxy at different projections """ #file_path = "/Users/dalyabaron/Downloads/cutout_242959.hdf5" #file_path = "/Users/dalyabaron/Copy/Astrophysics/python/new_scripts/new_scripts/DeprojectAllGalaxies/illustris_galaxies/cutout_83.hdf5" file_path = illustris_gal_path illustris_gal = astrohack_projections.illustris_model_and_image(file_path) illustris_gal.set_image_shape((60, 80)) images = [] for i in xrange(num_of_images): xi_hat, eta_hat = astrohack_projections.choose_random_projection() alpha, beta, gamma = numpy.random.uniform(0.0, 360.0, 3) intensity = 20 #150 scale = 0.015 * numpy.exp(numpy.random.uniform()) #0.18 * numpy.exp(numpy.random.uniform()) xshift = numpy.random.uniform(29., 31.)#(13., 16.) yshift = numpy.random.uniform(39., 41.)#(18., 21.) psf_size = 1.5 #1 bg = 0. kwargs = {'alpha':alpha, 'beta':beta, 'gamma':gamma, 'intensity':intensity, 'scale':scale, 'xshift': xshift, 'yshift': yshift, 'bg':0.0, 'psf_size':psf_size} illustris_gal.set_image_parameters(**kwargs) illustris_gal.construct_image() images.append(illustris_gal.get_image()) return images
def _construct_images_to_fit(self): """ function constrcts a list of images for the fitting process based on the image parameters """ assert self.gal_path != None illustris_gal = astrohack_projections.illustris_model_and_image(self.gal_path) illustris_gal.set_image_shape(self.image_parameters['shape']) self.images_to_fit = [] for i in xrange(self.image_parameters['num']): xi_hat, eta_hat = astrohack_projections.choose_random_projection() alpha, beta, gamma = numpy.random.uniform(0.0, 360.0, 3) intensity = self.image_parameters['intensity'] scale = self.image_parameters['scale'] * numpy.exp(numpy.random.uniform()) xshift = numpy.random.uniform(self.image_parameters['xshift'][0], self.image_parameters['xshift'][1]) yshift = numpy.random.uniform(self.image_parameters['yshift'][0], self.image_parameters['yshift'][1]) psf_size = self.image_parameters['psf_size'] bg = self.image_parameters['bg'] kwargs = {'alpha':alpha, 'beta':beta, 'gamma':gamma, 'intensity':intensity, 'scale':scale, 'xshift': xshift, 'yshift': yshift, 'bg':0.0, 'psf_size':psf_size} illustris_gal.set_image_parameters(**kwargs) illustris_gal.construct_image() self.images_to_fit.append(illustris_gal.get_image())