예제 #1
0
파일: XRS_Data.py 프로젝트: kif/Py2DeX
class XRS_ImageData(Subscriptable):
    def __init__(self):
        Subscriptable.__init__(self)
        self._create_dummy_data()
        self.file_iterator = FileIterator(self.load_image_file)
        self.image_calibration = ImageCalibration(Point(1024, 1024), 14, -0.211, 201.0467e-3, 79e-6)

    def _create_dummy_data(self):
        self.img_data = plt.imread("Data/test_002.tif")
        self.file_name = "Data/test_002.tif"

    def load_image_file(self, file_name):
        self.img_data = plt.imread(file_name)
        self.file_name = file_name
        self.update_subscriber()

    def load_next_image_file(self):
        self.file_iterator.load_next_file(self.file_name)

    def load_previous_image_file(self):
        self.file_iterator.load_previous_file(self.file_name)

    def get_image_data(self):
        return self.img_data

    def get_spectrum(self):
        x, y = self.image_calibration.integrate_image(self.img_data)
        return Spectrum(x, y)
예제 #2
0
파일: XRS_Data.py 프로젝트: kif/Py2DeX
class XRS_ImageData(Subscriptable):
    def __init__(self):
        Subscriptable.__init__(self)
        self._create_dummy_data()
        self.file_iterator = FileIterator(self.load_image_file)
        self.image_calibration = ImageCalibration(Point(1024, 1024), 14,
                                                  -0.211, 201.0467e-3, 79e-6)

    def _create_dummy_data(self):
        self.img_data = plt.imread("Data/test_002.tif")
        self.file_name = "Data/test_002.tif"

    def load_image_file(self, file_name):
        self.img_data = plt.imread(file_name)
        self.file_name = file_name
        self.update_subscriber()

    def load_next_image_file(self):
        self.file_iterator.load_next_file(self.file_name)

    def load_previous_image_file(self):
        self.file_iterator.load_previous_file(self.file_name)

    def get_image_data(self):
        return self.img_data

    def get_spectrum(self):
        x, y = self.image_calibration.integrate_image(self.img_data)
        return Spectrum(x, y)
예제 #3
0
파일: XRS_Data.py 프로젝트: kif/Py2DeX
 def __init__(self):
     Subscriptable.__init__(self)
     self._create_dummy_data()
     self.file_iterator = FileIterator(self.load_image_file)
     self.image_calibration = ImageCalibration(Point(1024, 1024), 14, -0.211, 201.0467e-3, 79e-6)
예제 #4
0
__author__ = 'Doomgoroth'

import matplotlib.pyplot as plt
import numpy as np

from ImageCalibration import ImageCalibration
from utilities import Point


if __name__ == "__main__":
    #do our calibration
    #my_calibration = ImageCalibration(Point(1023.09, 1024.74),19.9932,  -0.254300, 196.730e-3, 79e-6,1)
    #img = plt.imread('Data/Fe7C3_300_020.tif')
    #chi_data=np.loadtxt('Data/Fe7C3_300_020.chi',skiprows=4).T

    my_calibration = ImageCalibration(Point(1023.058, 1025.755), 24.25411, -0.260421, 196.7255e-3, 79e-6, 1)
    img = plt.imread('Data/LaB6_p49_001.tif')
    chi_data = np.loadtxt('Data/LaB6_p49_001_norm_polar_geom.chi', skiprows=4).T
    xy_data = np.loadtxt('Data/LaB6_p49_001.xy', skiprows=17).T

    x, y = my_calibration.integrate_image(img)
    print len(x)
    plt.plot(x, y)

    plt.plot(chi_data[0, :], chi_data[1, :], "r")
    plt.plot(xy_data[0, :], xy_data[1, :], 'g')
    plt.figure()
    plt.plot(chi_data[0, :], chi_data[1, :] - np.interp(chi_data[0, :], xy_data[0, :], xy_data[1, :]))
    plt.show()

예제 #5
0
파일: XRS_Data.py 프로젝트: kif/Py2DeX
 def __init__(self):
     Subscriptable.__init__(self)
     self._create_dummy_data()
     self.file_iterator = FileIterator(self.load_image_file)
     self.image_calibration = ImageCalibration(Point(1024, 1024), 14,
                                               -0.211, 201.0467e-3, 79e-6)
예제 #6
0
__author__ = 'Doomgoroth'

import matplotlib.pyplot as plt
import numpy as np

from ImageCalibration import ImageCalibration
from utilities import Point

if __name__ == "__main__":
    #do our calibration
    #my_calibration = ImageCalibration(Point(1023.09, 1024.74),19.9932,  -0.254300, 196.730e-3, 79e-6,1)
    #img = plt.imread('Data/Fe7C3_300_020.tif')
    #chi_data=np.loadtxt('Data/Fe7C3_300_020.chi',skiprows=4).T

    my_calibration = ImageCalibration(Point(1023.058, 1025.755), 24.25411,
                                      -0.260421, 196.7255e-3, 79e-6, 1)
    img = plt.imread('Data/LaB6_p49_001.tif')
    chi_data = np.loadtxt('Data/LaB6_p49_001_norm_polar_geom.chi',
                          skiprows=4).T
    xy_data = np.loadtxt('Data/LaB6_p49_001.xy', skiprows=17).T

    x, y = my_calibration.integrate_image(img)
    print len(x)
    plt.plot(x, y)

    plt.plot(chi_data[0, :], chi_data[1, :], "r")
    plt.plot(xy_data[0, :], xy_data[1, :], 'g')
    plt.figure()
    plt.plot(
        chi_data[0, :], chi_data[1, :] -
        np.interp(chi_data[0, :], xy_data[0, :], xy_data[1, :]))