def test_reload(self): data_file = tu.get_test_data_path('24737.nxs') process_file = tu.get_test_process_path('savu_nexus_loader_test1.nxs') exp = run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file)) data_file = exp.meta_data.get('nxs_filename') process_file = tu.get_test_process_path('savu_nexus_loader_test2.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_simple_fit_runs(self): data_file = tu.get_test_data_path('mm.nxs') process_file = tu.get_test_process_path( 'multimodal/simple_fit_test_XRF.nxs') options = tu.set_options(data_file, process_file=process_file) self.datapath = options['out_path'] run_protected_plugin_runner(options)
def test_i08_REGRESSION(self): data_file = tu.get_test_big_data_path('pymca_live_processing_test/i08-10471.nxs') process_file = tu.get_test_process_path('i08_pymca_process.nxs') outdir = tempfile.mkdtemp(prefix="pymca_i08_test") if os.path.exists(outdir): shutil.rmtree(outdir) os.makedirs(outdir, stat.S_IRWXO | stat.S_IRWXU) options = tu.set_options(data_file, process_file=process_file, out_path=outdir) run_protected_plugin_runner(options) change_permissions_recursive(options['out_path'], stat.S_IRWXO | stat.S_IRWXU | stat.S_IRWXG) output_filename = ("%(out_path)s"+os.sep+"%(out_folder)s_processed.nxs") % options f_test = h5.File(output_filename, 'r') # the result of this test test_path = tu.get_test_big_data_path('pymca_live_processing_test/savu_test_result/test_processed.nxs') f_known = h5.File(test_path, 'r') # a known good result from the same data # first we just do a direct comparison of the data. This should be equal exactly. data = '/entry/final_result_fluo/data' elements = 'entry/final_result_fluo/PeakElements' self.assertTrue((f_test[data][...] == f_known[data][...]).any()) self.assertListEqual(list(f_test[elements][...]), list(f_known[elements][...]))
def test_i08_REGRESSION(self): data_file = tu.get_test_big_data_path( 'pymca_live_processing_test/i08-10471.nxs') process_file = tu.get_test_process_path('i08_pymca_process.nxs') outdir = tempfile.mkdtemp(prefix="pymca_i08_test") if os.path.exists(outdir): shutil.rmtree(outdir) os.makedirs(outdir, stat.S_IRWXO | stat.S_IRWXU) options = tu.set_options(data_file, process_file=process_file, out_path=outdir) run_protected_plugin_runner(options) change_permissions_recursive( options['out_path'], stat.S_IRWXO | stat.S_IRWXU | stat.S_IRWXG) output_filename = ("%(out_path)s" + os.sep + "%(out_folder)s_processed.nxs") % options f_test = h5.File(output_filename, 'r') # the result of this test test_path = tu.get_test_big_data_path( 'pymca_live_processing_test/savu_test_result/test_processed.nxs') f_known = h5.File(test_path, 'r') # a known good result from the same data # first we just do a direct comparison of the data. This should be equal exactly. data = '/entry/final_result_fluo/data' elements = 'entry/final_result_fluo/PeakElements' self.assertTrue((f_test[data][...] == f_known[data][...]).any()) self.assertListEqual(list(f_test[elements][...]), list(f_known[elements][...]))
def test_i18_stxm(self): # data_file = '/dls/i18/data/2016/sp12601-1/processing/Savu_Test_Data/70214_Cat2_RT_1.nxs' data_file = tu.get_test_data_path('i18_test_data.nxs') process_file = tu.get_test_process_path('basic_stxm_process_i18.nxs') # process_file = tu.get_process_list_path('stxm_tomo_i18.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_1D_data(self): A = 11 X = 10 Y = 13 expected_output_shape = (A, X, Y) expected_top_corners = np.arange(A, dtype=np.float32) self.create_N_tiffs(A, frame_size=(X, Y)) # create a data file with the axis information self.data_file['entry/A'] = np.arange(A) self.data_file.close() # edit and save the yaml self.yaml['xrd']['data']['shape'] = '$(len(A_vals),)' self.yaml['xrd']['params'].update({ 'idx_A': 0, 'idx_detx': 1, 'idx_dety': 2, 'A_vals': "$dfile['entry/A'].value", 'dims': "$range(0, 3)" }) # add some axis labels self.yaml['xrd']['axis_labels'] = { 0: { 'dim': '$idx_A', 'name': 'A', 'value': '$A_vals', 'units': 'pixels' }, 1: self.detX_axis_label, 2: self.detY_axis_label } self.save_yaml_and_change_process_list() run_protected_plugin_runner( tu.set_options(self.data_file_path, process_file=self.process_list_path, out_path=self.test_folder)) # now check the result result = h5.File(os.path.join(self.test_folder, 'test_processed.nxs'), 'r')['entry/final_result_xrd/data'] np.testing.assert_array_equal( result.shape, expected_output_shape, err_msg='The output shape is not as expected.') result_corners = result[..., -1, -1] np.testing.assert_equal( result_corners.dtype, expected_top_corners.dtype, err_msg='The array does not output the correct type.') np.testing.assert_array_equal( result_corners, expected_top_corners, err_msg="The output values are not as expected")
def test_stxm_tomo_astra(self): print "Hi2" data_file = tu.get_test_data_path('mm.nxs') process_file = \ tu.get_test_process_path('simple_stxm_tomo_test_astra.nxs') run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file))
def test_diffraction_correction(self): data_file = tu.get_test_data_path('i18_test_data.nxs') # data_file = '/dls/i18/data/2016/sp13939-1/Experiment_1/nexus/75996_alphanitrateRT_1.nxs' process_file = tu.get_test_process_path('diffraction_absorption_correction_test.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_simple_fit_runs(self): # data_file = '/dls/i13-1/data/2016/mt14190-1/raw/91318.nxs'# data_file = tu.get_test_data_path('i18_test_data.nxs') process_file = tu.get_test_process_path('pymca_test.nxs') # process_file = '/dls/i13-1/data/2016/mt14190-1/processing/savu/process_lists/pymca_process.nxs' options = tu.set_options(data_file, process_file=process_file) self.datapath = options['out_path'] run_protected_plugin_runner(options)
def test_pyfai(self): data_file = tu.get_test_data_path( 'i18_test_data.nxs' ) #'/dls/i18/data/2016/sp12601-1/processing/Savu_Test_Data/70214_Cat2_RT_1.nxs'# process_file = tu.get_test_process_path( 'PyFAI_azimuth_new_calib_i18_test.nxs') run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file))
def test_3D_data(self): A = 3 B = 4 C = 5 X = 10 Y = 13 expected_output_shape = (A, B, C, X, Y) expected_top_corners = np.arange(A*B*C, dtype=np.float32).reshape((A, B, C)) self.create_N_tiffs(A*B*C, frame_size=(X, Y)) # create a data file with the axis information self.data_file['entry/A'] = np.arange(A) self.data_file['entry/B'] = np.arange(B) self.data_file['entry/C'] = np.arange(C) self.data_file.close() # edit and save the yaml self.yaml['xrd']['data']['shape'] = '$(len(A_vals), len(B_vals), len(C_vals))' self.yaml['xrd']['params'].update({'idx_A': 0, 'idx_B': 1, 'idx_C': 2, 'idx_detx': 3, 'idx_dety': 4, 'A_vals': "$dfile['entry/A'].value", 'B_vals': "$dfile['entry/B'].value", 'C_vals': "$dfile['entry/C'].value", 'dims': "$range(0, 4)"}) self.yaml['xrd']['axis_labels'] = {0: {'dim': '$idx_A', 'name': 'A', 'value': '$A_vals', 'units': 'pixels'}, 1: {'dim': '$idx_B', 'name': 'B', 'value': '$B_vals', 'units': 'pixels'}, 2: {'dim': '$idx_C', 'name': 'C', 'value': '$C_vals', 'units': 'pixels'}, 3: self.detX_axis_label, 4: self.detY_axis_label} self.save_yaml_and_change_process_list() run_protected_plugin_runner(tu.set_options(self.data_file_path, process_file=self.process_list_path, out_path=self.test_folder)) result = h5.File(os.path.join(self.test_folder, 'test_processed.nxs'), 'r')['entry/final_result_xrd/data'] np.testing.assert_array_equal(result.shape, expected_output_shape, err_msg='The output shape is not as expected.') result_corners = result[..., -1, -1] np.testing.assert_equal(result_corners.dtype, expected_top_corners.dtype, err_msg='The array does not output the correct type.') np.testing.assert_array_equal(result_corners, expected_top_corners, err_msg="The output values are not as expected")
def test_i08_REGRESSION(self): data_file = tu.get_test_big_data_path('pymca_live_processing_test/i08-10471.nxs') process_file = tu.get_test_process_path('i08_pymca_process.nxs') outdir = '/tmp/pymca_i08_test'+strftime("%Y%m%d%H%M%S", gmtime())+'/' if os.path.exists(outdir): shutil.rmtree(outdir) os.makedirs(outdir, stat.S_IRWXO | stat.S_IRWXU) options = tu.set_options(data_file,process_file=process_file,out_path=outdir) run_protected_plugin_runner(options) change_permissions_recursive(options['out_path'], stat.S_IRWXO | stat.S_IRWXU | stat.S_IRWXG) f_test = h5.File(options['out_path']+os.sep+options['out_folder']+'_processed.nxs','r') # the result of this test f_known = h5.File(tu.get_test_big_data_path('pymca_live_processing_test/savu_test_result/test_processed.nxs'),'r')# a known good result from the same data # first we just do a direct comparison of the data. This should be equal exactly. data = '/entry/final_result_fluo/data' elements = 'entry/final_result_fluo/PeakElements' # test=np.around(f_test[data][...], decimals=-1) # known=np.around(f_known[data][...], decimals=-1) # self.assertEqual(test, known) self.assertTrue((f_test[data][...]==f_known[data][...]).any()) # np.testing.assert_array_almost_equal(f_test[data][...], f_known[data][...], 0) # this needs to be -1 self.assertListEqual(list(f_test[elements][...]), list(f_known[elements][...]))
def test_nx_stxm(self): data_file = tu.get_test_data_path('mm.nxs') process_file = tu.get_test_process_path('basic_stxm_process.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_pyfai(self): data_file = tu.get_test_data_path('i18_test_data.nxs')#'/dls/i18/data/2016/sp12601-1/processing/Savu_Test_Data/70214_Cat2_RT_1.nxs'# process_file = tu.get_test_process_path('PyFAI_azimuth_new_calib_i18_test.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_cgls_recon(self): data_file = tu.get_test_data_path('24737.nxs') process_file = tu.get_test_process_path('ccpi_cgls_recon_test.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_stxm_tomo_scikit(self): data_file = tu.get_test_data_path('mm.nxs') process_file = \ tu.get_test_process_path('simple_stxm_tomo_test_scikit.nxs') run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file))
def test_chunking(self): data_file = tu.get_test_data_path('xrd_single_sino.nxs') process_file = tu.get_test_process_path( 'pyfai_tomo_chunking_single_sino_test.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_process(self): data_file = tu.get_test_data_path('i18_test_data.nxs') process_file = '/dls/mx-scratch/aaron/data/I18/paper_processing/devel_process_lists/xrd_tomo_i18.nxs' # process_file = tu.get_process_list_path('xrd_tomo_i18.nxs') run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file))
def tiff_test_stitch_dim(self): data_file = tu.get_test_data_path('image_test/tiffs') process_file = tu.get_test_process_path( 'tiff_loader_test_change_stitching_dim.nxs') run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file))
def test_process(self): data_file = tu.get_test_data_path('mm.nxs') process_file = \ tu.get_test_process_path('simple_stxm_tomo_test_astra.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_hilbert(self): data_file = tu.get_test_data_path('24737.nxs') process_file = tu.get_test_process_path('hilbert_test.nxs') run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file))
def test_ptycho(self): data_file = '/dls/mx-scratch/savu_test_data/NXptychoflipped.nxs' process_file = tu.get_test_process_path('ptycho_test.nxs') run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file))
def test_mm(self): data_file = tu.get_test_data_path('mm.nxs') process_file = tu.get_test_process_path('multiple_mm_inputs_test.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_ptycho(self): data_file = '/dls/mx-scratch/savu_test_data/NXptychoflipped.nxs' process_file = tu.get_test_process_path('ptycho_test.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_process(self): data_file = tu.get_test_big_data_path('xrd_tomo_p3_astra_recon_cpu.h5') process_file = tu.get_test_process_path('ica_test.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_binary_quantisation_filter(self): data_file = tu.get_test_data_path('24737.nxs') process_file = tu.get_test_process_path('threshold_filter_test.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_multi_params_tomo(self): data_file = tu.get_test_data_path('24737.nxs') process_file = tu.get_test_process_path( 'basic_tomo_process_preview_params_test.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_i13_fluo(self): data_file = tu.get_test_data_path('i13_fluo_data.nxs') process_file = tu.get_test_process_path('basic_fluo_process_i13.nxs') run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file))
def test_stage_motion(self): data_file = tu.get_test_data_path('kinematics_data.nxs') process_file = tu.get_test_process_path('kinematic_parser_test.nxs') run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file))
def test_process(self): data_file = tu.get_test_data_path('fluo_single_sino.nxs') process_file = tu.get_test_process_path('simple_fit_test_XRF_tomo.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_fbp(self): data_file = tu.get_test_data_path('24737.nxs') process_file = tu.get_test_process_path('raven_filter_test.nxs') run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file))
def test_astra_recon_init_vol(self): data_file = tu.get_test_data_path('24737.nxs') process_file = tu.get_test_process_path('astra_init_vol_test.nxs') run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file))
def test_process(self): data_file = tu.get_test_data_path('/i12_test_data/i12_test_data.nxs') process_file = tu.get_test_process_path('i12_tomo_pipeline_test.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_pyfai_filtered(self): data_file = tu.get_test_data_path('mm.nxs') process_file = tu.get_test_process_path('PyFAI_azimuth_test_bragg.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_process(self): data_file = tu.get_test_data_path('mm.nxs') process_file = tu.get_test_process_path('spectrum_crop_test.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_process_preview(self): data_file = tu.get_test_data_path('24737.nxs') process_file = \ tu.get_test_process_path('tomo_pipeline_preview_test.nxs') run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file))
def test_ccpi_regul_cpu(self): data_file = tu.get_test_data_path('24737.nxs') process_file = tu.get_test_process_path('CcpiRegulToolkitCpu_test.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_nx_xrd(self): data_file = '/dls/i18/data/2016/sp12601-1/processing/Savu_Test_Data/70214_Cat2_RT_1.nxs' process_file = tu.get_test_process_path('basic_xrd_process_i18.nxs') run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file))
def test_process(self): data_file = tu.get_test_data_path('mm.nxs') process_file = tu.get_test_process_path( 'I18_pipeline_just_xrd_from_raw_filtered_adp_mod2.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_tomopy_gridrec(self): data_file = tu.get_test_data_path('24737.nxs') process_file = tu.get_test_process_path('tomopy_test.nxs') run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file))
def test_dezinger_sinogram(self): data_file = tu.get_test_data_path('24737.nxs') process_file = tu.get_test_process_path('dezinger_sinogram_test.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_simple_fit_XRD(self): data_file = tu.get_test_data_path('mm.nxs') process_file = tu.get_test_process_path('findpeakstest.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_multi_params_tomo(self): data_file = tu.get_test_data_path('24737.nxs') process_file = tu.get_test_process_path( 'basic_tomo_process_preview_params_test.nxs') run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file))
def test_tomobar_recon(self): data_file = tu.get_test_data_path('24737.nxs') process_file = tu.get_test_process_path('tomobar2d_recon.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_stage_motion(self): data_file = tu.get_test_data_path('kinematics_data.nxs') process_file = tu.get_test_process_path('kinematic_parser_test.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_process_preview(self): data_file = tu.get_test_data_path('24737.nxs') process_file = \ tu.get_test_process_path('tomo_pipeline_preview_test.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_image_interpolation(self): data_file = tu.get_test_big_data_path('speckle_tracking.h5') process_file = tu.get_test_process_path('to_revise/umpa_test.nxs') run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file))
def test_distortion_correction(self): data_file = tu.get_test_data_path('24737.nxs') process_file = \ tu.get_test_process_path('distortion_correction_test.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_i14_software(self): data_file = tu.get_test_big_data_path('i14-5195.nxs') process_file = tu.get_test_process_path('i14_basic_process.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_i14_software(self): data_file = tu.get_test_big_data_path('i14-5195.nxs') process_file = tu.get_test_process_path('i14_pymca_process.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_i13_speckle_tracking(self): data_file = tu.get_test_big_data_path('speckle_tracking.h5') process_file = tu.get_test_process_path('to_revise/i13_speckle_loader_process.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_process(self): data_file = tu.get_test_big_data_path('xrd_tomo_p3_astra_recon_cpu.h5') process_file = tu.get_test_process_path('pca_test.nxs') run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file))
def test_subpixel_shift(self): data_file = tu.get_test_data_path('24737.nxs') process_file = \ tu.get_test_process_path('subpixel_shift.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))
def test_nx_ptycho(self): data_file = tu.get_test_data_path('NXptycho.nxs') process_file = tu.get_test_process_path('basic_ptycho_process.nxs') run_protected_plugin_runner( tu.set_options(data_file, process_file=process_file))
def test_process(self): data_file = tu.get_test_data_path('mm.nxs') process_file = tu.get_test_process_path('mm_template_processing.nxs') run_protected_plugin_runner(tu.set_options(data_file, process_file=process_file))