testedge = ede.edgedetector(croppedex1, background, *imaparam) fig = plt.figure(figsize=(8, 4)) plt.imshow(croppedex1, cmap=plt.cm.gray) plt.plot(testedge[:, 0], testedge[:, 1], 'b.', markersize=1) croppedforfit = testedge[(testedge[:, 1] < yanalysisc[1]) & (testedge[:, 1] > yanalysisc[0])] testfit = df.datafitter(croppedforfit, False, pixrange, 1, fitfunc, fitguess) xvals = np.arange(0, 10) yvals = df.pol2ndorder(xvals, *testfit[-2]) plt.plot(xvals + testfit[0], yvals + testfit[1], 'r-') plt.ylim(np.min(testedge[:, 1]), np.max(testedge[:, 1])) #%% specfolder = "E:/SpeedScan/5umreturn_1/" allimages = ito.omestackimport(specfolder) allimages = ede.cropper(allimages, *croppoints) #%% noshift = croppedbase #Find the cross correlation xvt and save to position arrays xvals, allcorr = crco.xvtfinder(allimages, noshift, cutpoint, guassfitl) np.save(dataDR + foldername + 'CCorcents.npy', xvals) np.save(dataDR + foldername + 'CCorall.npy', allcorr) #%% stackedges = ede.seriesedgedetect(allimages, background, *imaparam) ito.savelistnp(os.path.join(specfolder, 'edgedata.npy'), stackedges) #Fit the edges and extract angles and positions #%% stackedgecrop = [ arr[(arr[:, 1] < yanalysisc[1]) & (arr[:, 1] > yanalysisc[0])]
#Set working directory to data location os.chdir(dataDR) #%% allimages = ito.stackimport(dataDR + "\Translate1ums5xob.tif") #Select the minimum (1s) and maximum (2s) crop locations x1c = 9 x2c = 750 y1c = 715 y2c = 898 croppoints = [x1c, x2c, y1c, y2c] fig, ax = plt.subplots(nrows=2, ncols=2) testimage1 = allimages[0] testimage2 = allimages[-1] croptest1 = ede.cropper(testimage1, *croppoints) croptest2 = ede.cropper(testimage2, *croppoints) ax[0, 0].imshow(testimage1) ax[0, 1].imshow(testimage2) ax[1, 0].imshow(croptest1) ax[1, 1].imshow(croptest2) #%% a = croppedimages[0, -10] b = croppedimages[-1, -10] plt.plot(a) plt.plot(b) #%% alldat = np.zeros([croppedimages.shape[0], croppedimages.shape[2] * 2 - 1, 2])
#%% #Import the image imagestack = ito.stackimport(dataDR + r"\1ums.tif") #%% #Select the minimum (1s) and maximum (2s) crop locations x1c = 300 x2c = 900 y1c = 400 y2c = 1000 croppoints = [x1c, x2c, y1c, y2c] fig, ax = plt.subplots(nrows=2, ncols=2) testimage1 = imagestack[0] testimage2 = imagestack[-1] croptest1 = ede.cropper(testimage1, *croppoints) croptest2 = ede.cropper(testimage2, *croppoints) ax[0, 0].imshow(testimage1) ax[0, 1].imshow(testimage2) ax[1, 0].imshow(croptest1) ax[1, 1].imshow(croptest2) #%% #Crop all of the images and plot a cut at a y value to test correlation shift croppedimages = ede.cropper(imagestack, *croppoints) cutpixely = -50 a = croppedimages[0, cutpixely]
#%% #Import images imagestack = ito.stackimport(dataDR + r"\1ums.tif") #%% #Select the minimum (1s) and maximum (2s) crop locations x1c = 300 x2c = 900 y1c = 400 y2c = 1000 croppoints = [x1c, x2c, y1c, y2c] fig, ax = plt.subplots(nrows=2, ncols=2) testimage1 = imagestack[0] testimage2 = imagestack[-1] croptest1 = ede.cropper(testimage1, *croppoints) croptest2 = ede.cropper(testimage2, *croppoints) ax[0, 0].imshow(testimage1) ax[0, 1].imshow(testimage2) ax[1, 0].imshow(croptest1) ax[1, 1].imshow(croptest2) #%% #check that edge detection is working properly #Create a zero background or could import one and crop background = np.zeros(croptest1.shape) #[threshval,obsSize,cannysigma]