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_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_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_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 setUp(self): self.test_folder = tempfile.mkdtemp(suffix='template_test/') self.tif_folder = os.path.join(self.test_folder, 'tiffs/') os.mkdir(self.tif_folder) # copy across the process list to the working directory self.process_list_path = os.path.join(self.test_folder, 'xrd_template_test.nxs') shutil.copyfile(tu.get_test_process_path('xrd_template_test.nxs'), self.process_list_path) utils.populate_plugins() self.process_list = Content() self.process_list.fopen(self.process_list_path, update=False) for idx in self.process_list.get_positions(): self.process_list.refresh(idx) self.detX_axis_label = {'dim': '$idx_detx', 'name': 'detector_x', 'value': None, 'units': 'pixels'} self.detY_axis_label = {'dim': '$idx_dety', 'name': 'detector_y', 'value': None, 'units': 'pixels'} self.yaml = OrderedDict() # now make some standard modifications self.yaml['inherit'] = [tu.get_test_data_path(os.path.join('i18_templates', 'xrd_calibration.yml'))] self.yaml['xrd'] = OrderedDict() self.yaml['xrd']['params'] = {} self.yaml['xrd']['data'] = {} self.yaml['xrd']['data']['folder'] = self.tif_folder self.yaml['xrd']['params']['cfile'] = \ "$h5py.File('%s', 'r')" % tu.get_test_data_path('LaB6_calibration_new.nxs') self.yaml['xrd']['patterns'] = {} self.yaml['xrd']['patterns']['DIFFRACTION'] = {'core_dims': '$(idx_detx, idx_dety)', 'slice_dims': '$tuple([d for d in dims if d not in [idx_detx, idx_dety]])'} self.yaml['xrd']['axis_labels'] = {} self.yaml['xrd']['metadata'] = {} self.data_file_path = 'test_data.nxs' self.data_file = h5.File(self.data_file_path, 'w') # this will have the axes in.
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_monitor_correction(self): options = { "transport": "hdf5", "process_names": "CPU0", "data_file": tu.get_test_data_path('mm.nxs'), "process_file": tu.get_test_process_path('monitor_correction_test.nxs'), "out_path": tempfile.mkdtemp() } run_protected_plugin_runner(options)
def test_process(self): options = { "transport": "hdf5", "process_names": "CPU0", "data_file": tu.get_test_data_path('mm.nxs'), "process_file": tu.get_test_process_path('basic_stxm_process.nxs'), "out_path": tempfile.mkdtemp() } run_protected_plugin_runner(options)
def "r6"(self): options = { "transport": "hdf5", "process_names": "CPU0", "data_file": tu.get_test_data_path("r7"), "process_file": tu.get_test_process_path("r8"), "out_path": tempfile.mkdtemp() } run_protected_plugin_runner(options)
def test_fbp(self): options = { "transport": "hdf5", "process_names": "CPU0", "data_file": tu.get_test_data_path('24737.nxs'), "process_file": tu.get_test_process_path('miro_test.nxs'), "out_path": tempfile.mkdtemp() } run_protected_plugin_runner(options)
def test_cgls_astra(self): process = 'basic_tomo_iterative_process.nxs' options = { "transport": "hdf5", "process_names": "CPU0", "data_file": tu.get_test_data_path('24737.nxs'), "process_file": tu.get_test_process_path(process), "out_path": tempfile.mkdtemp() } run_protected_plugin_runner(options)
def test_multi_params_tomo(self): process = 'basic_tomo_process_preview_params_test.nxs' options = { "transport": "hdf5", "process_names": "CPU0", "data_file": tu.get_test_data_path('24737.nxs'), "process_file": tu.get_test_process_path(process), "out_path": tempfile.mkdtemp() } run_protected_plugin_runner(options)
def test_mm(self): options = { "transport": "hdf5", "process_names": "CPU0", "data_file": tu.get_test_data_path('mm.nxs'), "process_file": tu.get_test_process_path( 'multiple_mm_inputs_test.nxs'), "out_path": tempfile.mkdtemp() } run_protected_plugin_runner(options)
def test_multi_params_i12tomo(self): process = 'i12_tomo_pipeline_test.nxs' options = { "transport": "hdf5", "process_names": "CPU0", "data_file": tu.get_test_data_path( 'i12_test_data/i12_test_data.nxs'), "process_file": tu.get_test_process_path(process), "out_path": tempfile.mkdtemp() } run_protected_plugin_runner(options)
def setUp(self): self.test_folder = tempfile.mkdtemp(suffix='template_test/') self.tif_folder = os.path.join(self.test_folder, 'tiffs/') os.mkdir(self.tif_folder) # copy across the process list to the working directory self.process_list_path = os.path.join(self.test_folder, 'xrd_template_test.nxs') shutil.copyfile(tu.get_test_process_path('xrd_template_test.nxs'), self.process_list_path) utils.populate_plugins() self.process_list = Content() self.process_list.fopen(self.process_list_path, update=False) for idx in self.process_list.get_positions(): self.process_list.refresh(idx) self.detX_axis_label = { 'dim': '$idx_detx', 'name': 'detector_x', 'value': None, 'units': 'pixels' } self.detY_axis_label = { 'dim': '$idx_dety', 'name': 'detector_y', 'value': None, 'units': 'pixels' } self.yaml = OrderedDict() # now make some standard modifications self.yaml['inherit'] = [ tu.get_test_data_path( os.path.join('i18_templates', 'xrd_calibration.yml')) ] self.yaml['xrd'] = OrderedDict() self.yaml['xrd']['params'] = {} self.yaml['xrd']['data'] = {} self.yaml['xrd']['data']['folder'] = self.tif_folder self.yaml['xrd']['params']['cfile'] = \ "$h5py.File('%s', 'r')" % tu.get_test_data_path('LaB6_calibration_new.nxs') self.yaml['xrd']['patterns'] = {} self.yaml['xrd']['patterns']['DIFFRACTION'] = { 'core_dims': '$(idx_detx, idx_dety)', 'slice_dims': '$tuple([d for d in dims if d not in [idx_detx, idx_dety]])' } self.yaml['xrd']['axis_labels'] = {} self.yaml['xrd']['metadata'] = {} self.data_file_path = 'test_data.nxs' self.data_file = h5.File(self.data_file_path, 'w') # this will have the axes in.
def test_process(self): options = { "transport": "hdf5", "process_names": "CPU0", "data_file": tu.get_test_data_path('mm.nxs'), # "process_file": tu.get_test_process_path('simplefitreconstest.nxs'), "process_file": tu.get_test_process_path( 'testing_mm_sart_recon.nxs'), "out_path": tempfile.mkdtemp() } run_protected_plugin_runner(options)
def test_process_preview(self): options = { "transport": "hdf5", "process_names": "CPU0", "data_file": tu.get_test_data_path( '/i12_test_data/i12_test_data.nxs'), "process_file": tu.get_test_process_path( 'i12_tomo_pipeline_preview_test.nxs'), "out_path": tempfile.mkdtemp() } run_protected_plugin_runner(options)
def create_chunking_instance(self, current_list, nnext_list, nProcs): current = self.create_pattern('a', current_list) nnext = self.create_pattern('b', nnext_list) options = tu.set_experiment('tomoRaw') options['processes'] = range(nProcs) # set a dummy process list options['process_file'] = \ tu.get_test_process_path('basic_tomo_process.nxs') exp = Experiment(options) test_dict = {'current': current, 'next': nnext} chunking = Chunking(exp, test_dict) return chunking
def test_reload(self): process_list = 'loaders/savu_nexus_loader_test1.nxs' options1 = tu.initialise_options(data_file, experiment, process_list) run_protected_plugin_runner(options1) #read the output file using SavuNexusLoader path_to_rec = options1['out_path'] + 'test_processed.nxs' self.test_folder2 = tempfile.mkdtemp(suffix='my_test2/') options2 = tu.set_experiment('tomo') options2['data_file'] = path_to_rec options2['out_path'] = os.path.join(self.test_folder2) options2['process_file'] = tu.get_test_process_path( 'loaders/savu_nexus_loader_test2.nxs') run_protected_plugin_runner(options2) tu.cleanup(options1) tu.cleanup(options2)
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_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 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_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_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_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_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_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_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_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_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_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('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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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))
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_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))