if config.backup: # Inform the user log.info("Making a backup of the original image ...") # Determine new filepath and copy new_filepath = fs.appended_filepath(config.filepath, "_backup") fs.copy_file(config.filepath, new_filepath) # ----------------------------------------------------------------- # Inform the user log.info("Loading the image '" + config.filepath + "' ...") # Load the image image = Image.from_file(config.filepath) # ----------------------------------------------------------------- # Debugging sum_before = np.nansum(image.primary.data) log.debug("Sum of the primary frame before multiplication is " + str(sum_before)) # ----------------------------------------------------------------- # Inform th euser log.info("Multiplying the image with a factor of " + str(config.factor) + " ...") # Multiply image *= config.factor
definition.add_flag("replace_masks", "replace masks", False) definition.add_flag("replace_segments", "replace segmentation maps", False) definition.add_flag("backup", "make backup", False) config = parse_arguments("interpolate", definition) # ----------------------------------------------------------------- if config.replace: config.replace_frames = config.replace_masks = config.replace_segments = True # ----------------------------------------------------------------- # Inform the user log.info("Loading the images ...") # Load to_image = Image.from_file(config.add_to) from_image = Image.from_file(config.add_from) # ----------------------------------------------------------------- # Add the frames if config.frames: # Inform the user log.info("Adding the frames ...") # Loop over the frames for frame_name in from_image.frames: # Check if frame_name in to_image.frames:
#control_panels_to_load = [("Source", SourcePanel), # ("Color", ColorPanel), # ("Plot", PlotPanel), # ("Stats", StatsPanel), # ("Phot", PhotPanel), # ("Faker", FitsFakerPanel) # ] # -----> #viewer = MagicViewer(control_panels_module_path='control_panels') # Load the image first image = Image.from_file(arguments.filename) #frame = Frame.from_file(arguments.filename) # Create the viewer viewer = MagicViewer(title="Magic viewer") # Load the image into the viewer viewer.load_image(image) #viewer.load_frame(frame) # Set options viewer.control_panel('Color') viewer.cmap("hot") viewer.scaling('Log') # Wait for the GUI to be closed
# Load the star region star_region_path = fs.join(input_path, "stars.reg") star_region = Region.from_file(star_region_path) if fs.is_file(star_region_path) else None # Load the saturation region saturation_region_path = fs.join(input_path, "saturation.reg") saturation_region = Region.from_file(saturation_region_path) if fs.is_file(saturation_region_path) else None # Load the region of other sources other_region_path = fs.join(input_path, "other_sources.reg") other_region = Region.from_file(other_region_path) if fs.is_file(other_region_path) else None # Load the image with segmentation maps segments_path = fs.join(input_path, "segments.fits") segments = Image.from_file(segments_path, no_filter=True) # Get the segmentation maps galaxy_segments = segments.frames.galaxies if "galaxies" in segments.frames else None star_segments = segments.frames.stars if "stars" in segments.frames else None other_segments = segments.frames.other_sources if "other_sources" in segments.frames else None # ----------------------------------------------------------------- # If visualisation is enabled, set the visualisation path (=output path) if arguments.visualise: animation = Animation() animation.fps = 1 else: animation = None # -----------------------------------------------------------------
definition.add_flag("replace_segments", "replace segmentation maps", False) definition.add_flag("backup", "make backup", False) config = parse_arguments("interpolate", definition) # ----------------------------------------------------------------- if config.replace: config.replace_frames = config.replace_masks = config.replace_segments = True # ----------------------------------------------------------------- # Inform the user log.info("Loading the images ...") # Load to_image = Image.from_file(config.add_to) from_image = Image.from_file(config.add_from) # ----------------------------------------------------------------- # Add the frames if config.frames: # Inform the user log.info("Adding the frames ...") # Loop over the frames for frame_name in from_image.frames: # Check if frame_name in to_image.frames:
#from ztv_examples.fits_faker_panel.fits_faker_panel import FitsFakerPanel #control_panels_to_load = [("Source", SourcePanel), # ("Color", ColorPanel), # ("Plot", PlotPanel), # ("Stats", StatsPanel), # ("Phot", PhotPanel), # ("Faker", FitsFakerPanel) # ] # -----> #viewer = MagicViewer(control_panels_module_path='control_panels') # Load the image first image = Image.from_file(arguments.filename) #frame = Frame.from_file(arguments.filename) # Create the viewer viewer = MagicViewer(title="Magic viewer") # Load the image into the viewer viewer.load_image(image) #viewer.load_frame(frame) # Set options viewer.control_panel('Color') viewer.cmap("hot") viewer.scaling('Log') # Wait for the GUI to be closed
if config.backup: # Inform the user log.info("Making a backup of the original image ...") # Determine new filepath and copy new_filepath = fs.appended_filepath(config.filepath, "_backup") fs.copy_file(config.filepath, new_filepath) # ----------------------------------------------------------------- # Inform the user log.info("Loading the image '" + config.filepath + "' ...") # Load the image image = Image.from_file(config.filepath) # ----------------------------------------------------------------- # Debugging sum_before = np.nansum(image.primary.data) log.debug("Sum of the primary frame before multiplication is " + str(sum_before)) # ----------------------------------------------------------------- # Inform th euser log.info("Multiplying the image with a factor of " + str(config.factor) + " ...") # Multiply