def test_normalize_noDF(): dir = os.path.dirname(__file__) datadir = os.path.join(dir, "..", "..", "iMars3D_data_set", "turbine") # dark field dfs = None # open beam pattern = os.path.join(datadir, "*DF*.fits") # hack obs = io.imageCollection(pattern, name="Open Beam") # ct angles = np.arange(0, 52, 8.5) ct_series = io.ImageFileSeries( os.path.join(datadir, "*CT*_%.3f_*.fits"), identifiers=angles, name="CT", ) # output normalized_ct = io.ImageFileSeries( "_tmp/test_normalizer/out/normalized_%.3f.npy", identifiers=angles, decimal_mark_replacement=".", mode="w", name="Normalized") normalizer.normalize(ct_series, dfs, obs, "_tmp/test_normalizer/work", normalized_ct) return
def test3(): dir = os.path.join(here, "..", "iMars3D_data_set", "autocrop", "dark-bottom") dir = os.path.abspath(dir) series = io.ImageFileSeries(os.path.join(dir, "sm-estimate-ave%s.tiff"), ['']) assert np.allclose(autocrop.calculateCropWindow(series), (0, 2047, 1163, 2047)) return
def test_iter(): datadir = os.path.join(dir, "../../iMars3D_data_set/turbine") ct_series = io.ImageFileSeries( os.path.join(datadir, "*CT*_%.3f_*.fits"), identifiers=np.arange(0, 52, 8.5), ) for img in ct_series: print(img) return
def test2(): dir = os.path.join(here, "..", "iMars3D_data_set", "autocrop", "darkboundaries") dir = os.path.abspath(dir) angles = np.arange(0., 10, 0.85) series = io.ImageFileSeries( os.path.join(dir, "20180704_Transmission_CT_%s_0080.*"), ['0010']) assert np.allclose(autocrop.calculateCropWindow(series), (627, 1442, 648, 1468)) return
def test(): dir = os.path.join(here, "..", "iMars3D_data_set", "turbine", "normalized") dir = os.path.abspath(dir) angles = np.arange(0., 10, 0.85) series = io.ImageFileSeries(os.path.join(dir, "normalized_%07.3f.*"), angles, decimal_mark_replacement='.') assert np.allclose(autocrop.calculateCropWindow(series), (0, 2047, 30, 2047)) return
def test(): datadir = os.path.join(dir, "../../iMars3D_data_set/turbine") ct_series = io.ImageFileSeries( os.path.join(datadir, "*CT*_%.3f_*.fits"), identifiers=np.arange(0, 52, 8.5), ) assert (os.path.basename( ct_series.getFilename(0)) == "20120618_TURBINECT_0180_0_000_0000.fits") img = ct_series.getImage(0) data = img.getData() data = ct_series.getData(0) return
def test_Calculator(): # ct angles = np.arange(0, 180.5, 1.) ct_series = io.ImageFileSeries( os.path.join(datadir, "cropped*_%07.3f.tiff"), identifiers=angles, decimal_mark_replacement=".", name="CT", ) calculator = direct.DirectMinimization() t = tilt._compute(ct_series, "_tmp/test_direct/work", calculator=calculator) assert np.isclose(t, 0.4) return
def test_tilt(): dir = os.path.dirname(__file__) datadir = os.path.join(dir, "..", "..", "iMars3D_data_set", "turbine") # ct angles = np.arange(0, 181, .85) ct_series = io.ImageFileSeries( os.path.join(datadir, "*CT*_%.3f_*.fits"), identifiers=angles, name="CT", ) from imars3d.tilt.phasecorrelation import PhaseCorrelation calculator = PhaseCorrelation() t = tilt._compute(ct_series, "_tmp/test_tilt/work", calculator=calculator) print(t) assert t > -2 and t < -1 return
def test_tilt2(): dir = os.path.dirname(__file__) datadir = os.path.join(dir, "..", "..", "iMars3D_data_set", "turbine", "cleaned") # ct angles = np.arange(0, 181, .85) ct_series = io.ImageFileSeries( os.path.join(datadir, "smoothed*_%07.3f.tiff"), identifiers=angles, decimal_mark_replacement=".", name="CT", ) from imars3d.tilt.use_centers import Calculator calculator = Calculator(sigma=15, maxshift=200) t = tilt._compute(ct_series, "_tmp/test_tilt2/work", calculator=calculator) print(t) assert t > -1.5 and t < -.5 return