%load_ext autoreload
%autoreload 2
%reset
The autoreload extension is already loaded. To reload it, use: %reload_ext autoreload
import os
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from pySurf.data2D_class import Data2D
from pySurf.instrumentReader import fitsWFS_reader
Read two data with custom settings for scales:
"""INPUT SETTINGS"""
plt.ion()
file1="181016_01_PCO2S06_1009_08.fits"
file2="181016_02_PCO2S06_1009_08.fits"
scale=101.6/116 #ratio between mm and pixels
ytox=220./200 #aspect ratio of pixel
strip = True # strip nan frame
""""""
data1 = Data2D(*fitsWFS_reader(file1,scale=(scale,scale,1),center=(0,0),strip=strip,
ytox=ytox,ypix=1),units=['mm','mm','um'])
data2 = Data2D(*fitsWFS_reader(file2,scale=(scale,scale,1), center=(0,0),strip=strip,
ytox=ytox,ypix=1),units=['mm','mm','um'])
The part has been removed for the treatment and was put back in a position that can be different from the one of the first measurement. Plot the two data. Before calculating difference, I want to align the two surfaces.
data1.plot()
plt.figure()
data2.plot()
<Axes: xlabel='X (mm)', ylabel='Y (mm)'>
Level by removing low order polynomial of degree 10, to highlight features. User selects point-and-click markers on leveled data. Markers and transformation (as function) are returned:
d1l = data1.level((10,0)) # remove low order on y axis
d2l = data2.level((10,0))
mref,mtrans = data1.align_interactive(data2) # select points, return transformation
Transformation is applied to first set of data and results are visualized:
data1_trans = data1.apply_transform(mtrans) # apply transform to first (unleveled) data set
plt.figure() # python command to create figure
diff = plot_difference(data1,data2_trans) # plot data and difference
data2?
%qtconsole