Example #1
0
        info=image.info

        #Read site info file
        camera={}
        processing={}
        header=image.info.copy() #copy header data stored in image
        
        with open(info_filename,"r") as info_file:
            for line in info_file: #read file line by line
                if line.isspace(): 
                    continue #ignore blank lines
                words=line.split("=") #split the line at the = sign
                
                if len(words) != 2:
                    print("Error! allskyImagePlugins.UiO_Allsky_LYR.open(): Cannot read site info file, too many words per line")
                    sys.exit()
                    
                camera[words[0].lstrip().rstrip()] = words[1].lstrip().rstrip() #store the values (minus white space) in a dictionary
        
        #create a dictionary containing all the metadata
        info={'header':header,'camera':camera,'processing':processing}
    
        #return new allskyImage object
        return allskyImage.allskyImage(image,image.filename,info)
        
    ###################################################################################
###################################################################################

#register the plugin with PASKIL
allskyImagePlugins.register(UiO_Allsky_LYR_PNG())
Example #2
0
        
        with open(info_filename,"r") as info_file:
            for line in info_file: #read file line by line
                if line.isspace(): 
                    continue #ignore blank lines
                words=line.split("=") #split the line at the = sign
                
                if len(words) != 2:
                    print("Error! allskyImagePlugins.DSLR_LYR.open(): Cannot read site info file, too many words per line")
                    sys.exit()
                    
                camera[words[0].lstrip().rstrip()] = words[1].lstrip().rstrip() #store the values (minus white space) in a dictionary
        
        #Read creation time from filename
        filename = os.path.basename(image_filename)
        creation_time=datetime.datetime.strptime(filename.rstrip(".NEF"), "LYR-SLR-%Y%m%d_%H%M%S")
        
        creation_time=creation_time.strftime("%d %b %Y %H:%M:%S %Z")
        header = {'Wavelength':"RGGB",'Creation Time': creation_time}
        
        info={'header':header,'camera':camera,'processing':processing}
        
        #return new allskyImage object
        return allskyRaw.rawImage(image_filename,info)
        
    ###################################################################################
###################################################################################

#register the plugin with PASKIL, without this step the plugin will just be ignored! The argument to the register function should be an instance of your plugin class
allskyImagePlugins.register(NEF_Format())
Example #3
0
                if line.isspace():
                    continue  # ignore blank lines
                words = line.split("=")  # split the line at the = sign

                if len(words) != 2:
                    print("Error! allskyImagePlugins.DSLR_LYR.open(): Cannot read site info file, too many words per line")
                    sys.exit()

                # store the values (minus white space) in a dictionary
                camera[words[0].lstrip().rstrip()] = words[1].lstrip().rstrip()

        # Read creation time from filename
        filename = image.filename
        filename = filename.split("/")
        filename = filename[len(filename) - 1]
        creation_time = datetime.datetime.strptime(
            filename.rstrip(".JPG"), "LYR-SLR-%Y%m%d_%H%M%S")

        creation_time = creation_time.strftime("%d %b %Y %H:%M:%S %Z")
        header = {'Wavelength': "Visible", 'Creation Time': creation_time}

        info = {'header': header, 'camera': camera, 'processing': processing}

        # return new allskyImage object
        return allskyImage.allskyImage(image, image.filename, info)

    ##########################################################################
##########################################################################

allskyImagePlugins.register(DSLR_LYR_JPG())
Example #4
0
                    if len(words) != 2:
                        raise ValueError(
                            "Error! allskyImagePlugins.UiO_Allsky_PMIS.open(): Cannot read site info file, too many words per line"
                        )

                    # store the values (minus white space) in a dictionary
                    camera[words[0].lstrip().rstrip()] = words[1].lstrip().rstrip()

            # convert the creation time data stored in the PMIS header into the
            # PASKIL format
            try:
                creation_time = datetime.datetime.strptime(header["Creation Time"], "%Y-%m-%d_%H:%M:%S")
            except:
                # different date format for 1997
                creation_time = datetime.datetime.strptime(header["Creation Time"], "%Y-%m-%d_%H.%M.%S")

            header["Creation Time"] = creation_time.strftime("%d %b %Y %H:%M:%S %Z")

            info = {"header": header, "camera": camera, "processing": processing}

            # return new allskyImage object
            return allskyImage(image.convert("I"), image.filename, info)

    ##########################################################################


##########################################################################

register(UiO_Allsky_PMIS())
Example #5
0
        return True

    ##########################################################################

    def open(self, image_filename, info_filename):
        """
        Returns a PASKIL allskyImage object containing the image data and its
        associated meta-data.
        """
        image = Image.open(image_filename)

        with open(info_filename, "rb") as fp:
            info = pickle.load(fp)

        # attempt to load the exif data
        try:
            info['exif'] = misc.readExifData(image_filename)
        except:
            print("Couldn't read the exif")
            pass

        # return new allskyImage object
        return allskyImage.allskyImage(image, image.filename, info)

    ##########################################################################
##########################################################################

# register this plugin with PASKIL
allskyImagePlugins.register(Pysces_DSLR_LYR_JPG())