# Script for forming a mosaic of images # Replace the directory and image names below with actual ones # Comments are preceded by #s # Specify the names of the source and destination directories source_directory = Label( "F:\Images astro\ASI094\CruCar" ) # When lexicographically (alphabetically) ordered, each image in unregistered_directory # must overlap a preceding image; rearrange images into subdirectories if necessary unregistered_directory = Label( "Preprocessed" ) registered_directory = Label( "Registered" ) calibrated_directory = Label( "Calibrated" ) # The registration reference image must be the lexicographically first one # in unregistered_directory register_ref_name = Label( "Preprocessed/1230-56.6_122_46.2001_df_ff.fit" ) # Specify the calibration reference image # Pick an image with large overlap with adjacent images and whose color you want to preserve # The !IgnoreWarnings directive ignores the warning generated by the nonexistence of # this image (it will have been created by this script by the time this line is reached) !IgnoreWarnings calibrate_ref_name = Label( "Registered/1045-60.0_141_64.4001_df_ff_reg.fit" ) # Specify the name of the saved mosaic # FITS format is selected to preserve history in the header mosaic_name = Label( "CruCarMosaic.fit" ) # Change to the directory containing the images and open the registration reference image SetDirectory( source_directory ) register_ref = Open( register_ref_name ) # Register all other images in the source directory to the registration reference image # The [0,0,0,0,0,0,0,1] option includes subdirectories # Save registered images to registered_directory # Save images in FITS format to preserve history in the headers, using SetPreference command SetPreference[1]( 1 ) Register[0,0,0,0,0,0,0,1]( unregistered_directory, register_ref, registered_directory ) # Calibrate the registered images to the calibration reference image # The [1] option closes uncalibrated images after they have been calibrated calibrate_ref = Open( calibrate_ref_name ) Calibrate[1]( calibrate_ref ) # Save calibrated images to reg_directory SaveAll( calibrated_directory ) # Combine the registered, calibrated images into a mosaic # The [3] option does a median Combine mosaic = Combine[3]( calibrate_ref ) # Save the calibrated mosaic, which is left open SaveAs( mosaic, mosaic_name )