def load_data(self, loadPath, imFile, refFile = None, plotting = False): """ Load data into the class from file """ import loadDataToNumpy_class ld_image = loadDataToNumpy_class.loadInDataToNumpy(loadPath + imFile) self.im = ld_image.loadData() self.imShape = np.shape(self.im) if refFile is not None: ld_image = loadDataToNumpy_class.loadInDataToNumpy(loadPath + refFile) self.ref = ld_image.loadData() self.refExists = True else: self.refExists = False if plotting: self.plot_raw_input()
def __init__(self, filePath): # The input is the whole file path self.filePath = filePath self.fileIdentifier = self.filePath.split("/")[-1].split("_")[0] ld = loadDataToNumpy_class.loadInDataToNumpy(filePath) self.im_raw = ld.loadData()
def loadData(self, filePath, line_of_pchannel, width_pchannel): import loadDataToNumpy_class ld = loadDataToNumpy_class.loadInDataToNumpy(filePath) self.im = ld.loadData() self.imShape = np.shape(self.im) self.line_of_pchannel = line_of_pchannel self.width_pchannel = width_pchannel
def load_data(self, loadPath, phaseFile, plotting = False): import loadDataToNumpy_class ld_image = loadDataToNumpy_class.loadInDataToNumpy(loadPath + phaseFile) self.phase = ld_image.loadData() self.phaseShape = np.shape(self.phase) if plotting: plt.pcolormesh(self.phase) plt.colorbar() plt.show()
def test_findRotation(self): filePath = "/Volumes/GoogleDrive/My Drive/Experimental_Codes/Interferometry_Data_Extraction/Test_Data/" fileName = filePath + "SyntheticReference.tiff" testData = loadDataToNumpy_class.loadInDataToNumpy(fileName) d = testData.loadData() rot = rotateArray.rotateFringesToVertical(d) rotation = rot.findRotation(startIndex = 0, numberOfLineouts = 15, horzStart = 100, horzEnd = 500) print ("Angle in Degrees", rotation) print ("Expected Angle ", 0) self.assertAlmostEqual(rotation, 0, places = 5)
def LoadData(self, fileName): """ Load the data using the class """ import loadDataToNumpy_class ld = loadDataToNumpy_class.loadInDataToNumpy(fileName) self.im = ld.loadData() self.shape = np.shape(self.im) if self.plotting: plt.imshow(self.im, vmin = np.average(self.im) - (self.im.max() - np.average(self.im))) plt.colorbar() plt.show()
def test_loading_txt(self): # rootExperimentFolder = "/Volumes/GoogleDrive/My Drive/2019 RR Analysis/BG_sub_Rot_F2Vert/" filePath = rootExperimentFolder + "cropROI20190211r008s103.txt" ld = loadDataToNumpy_class.loadInDataToNumpy(filePath) im =ld.loadData() typeName = str(type(im)) ndarray = False if "ndarray" in typeName: ndarray = True self.assertEqual(ndarray, True)
def test_loading_tiff(self): # rootExperimentFolder = "/Volumes/GoogleDrive/Shared drives/Murphy Group/GeminiRR_2019/" filePath = rootExperimentFolder + "20190208/20190208r011/20190208r011s001_Probe_Interfero.tiff" ld = loadDataToNumpy_class.loadInDataToNumpy(filePath) im =ld.loadData() typeName = str(type(im)) ndarray = False if "ndarray" in typeName: ndarray = True self.assertEqual(ndarray, True)
def load_data(self, filePath, plotting=False): import loadDataToNumpy_class ld = loadDataToNumpy_class.loadInDataToNumpy(filePath) self.phase = ld.loadData() self.phaseShape = np.shape(self.phase) if plotting: plt.figure(figsize=(8, 4)) plt.title("Input phase") plt.imshow(self.phase, cmap=plt.cm.seismic, norm=func.MidpointNormalize(midpoint=0)) plt.colorbar() plt.show()
def loadReference(self, filepath, plotting = False): ld = loadDataToNumpy_class.loadInDataToNumpy(filepath) self.ref = ld.loadData() if plotting: plt.imshow(self.ref); plt.colorbar(); plt.title("Reference Image") plt.show()
plt.imshow(im) plt.show() def lin(x, *params): # linear fit function m = params[0] c = params[1] return x *m + c if __name__ == "__main__": # Load the data import loadDataToNumpy_class rootExperimentFolder = "/Volumes/GoogleDrive/Shared drives/Murphy Group/GeminiRR_2019/" filePath = rootExperimentFolder + "20190208/20190208r011/20190208r011s001_Probe_Interfero.tiff" ld = loadDataToNumpy_class.loadInDataToNumpy(filePath) im_raw = ld.loadData() plotImage(im_raw, "Raw Data") # Run the rotateArray class rotAnal = rotateFringesToVertical(im_raw) angle = rotAnal.findRotation(startIndex = 5, endIndex = 200, plotting = True) # print (angle) rotatedImage = rotAnal.applyRotation(angle) savePath = "/Volumes/GoogleDrive/My Drive/Experimental_Codes/Interferometry_Data_Extraction/" np.savetxt(savePath + "verticalFrings.txt", rotatedImage)