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][...]))
Example #2
0
    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][...]))
Example #3
0
    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][...]))
Example #4
0
 def test_i08_notaux(self):
     cu.populate_plugins()
     data_file = tu.get_test_big_data_path('pymca_live_processing_test/i08-10471.nxs')
     data = h5.File(data_file,'r')['/entry/xmapMca/data']
     inputs = {}
     inputs['data'] = data[0,0,0,:]
     inputs['dataset_name'] = ''
     inputs['xaxis_title'] = None
     metaOnly = False
     self.persistence = {}
     self.persistence['sys_path_0_lock'] = threading.Lock()
     self.persistence['sys_path_0_set'] = False
     self.persistence['plugin_object'] = None
     self.persistence['axis_labels'] = None
     self.persistence['axis_values'] = None
     self.persistence['string_key'] = None
     self.persistence['parameters'] = None
     self.persistence['aux'] = {}
     params={}
     params['config']={}
     params['config']['value'] = tu.get_test_big_data_path('pymca_live_processing_test/10471.cfg')
     path2plugin = pu.dawn_plugins['Pymca']['path2plugin']# set by dawn-side code
     self.runSavu(path2plugin, params, metaOnly, inputs)
Example #5
0
 def test_i08_REGRESSION(self):
     cu.populate_plugins()
     data_file = h5.File(tu.get_test_big_data_path('pymca_live_processing_test/dawn_test_result/result.nxs'),'r')
     data = data_file['/raw_entry/xmapMca/data']
     inputs = {}
     
     inputs['dataset_name'] = ''
     inputs['xaxis_title'] = None
     metaOnly = True
     self.persistence = {}
     self.persistence['sys_path_0_lock'] = threading.Lock()
     self.persistence['sys_path_0_set'] = False
     self.persistence['plugin_object'] = None
     self.persistence['axis_labels'] = None
     self.persistence['axis_values'] = None
     self.persistence['string_key'] = None
     self.persistence['parameters'] = None
     self.persistence['aux'] = {}
     params={}
     params['config']={}
     params['config']['value'] = tu.get_test_big_data_path('pymca_live_processing_test/10471.cfg')
     path2plugin = pu.dawn_plugins['Pymca']['path2plugin']# set by dawn-side code
     pts = [(39,51),
            (45,25),
            (18,29),
            (37,96),
            (8,110)] # just do 5 points for now, is full regression necessary?
     for y,x in pts:
         inputs['data'] = data[x,y,0,:]
         out = self.runSavu(path2plugin, params, metaOnly, inputs)
         aux = out['auxiliary']
         entry = 'entry/auxiliary/0-Python Script - Savu/'
         for key in aux.keys():
             print(key,x,y)
             foo=data_file[entry+key+'/data'][x,y]
             self.assertAlmostEqual(aux[key],foo,delta=0.5)
Example #6
0
 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))
Example #7
0
 def test_edf(self):
     data_file = tu.get_test_big_data_path(
         'pymca_live_processing_test/savu_test_result/test_processed.nxs')
     process_file = tu.get_test_process_path("i08_edf_saver_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('ica_test.nxs')
     run_protected_plugin_runner(tu.set_options(data_file,
                                                process_file=process_file))
Example #9
0
 def test_i13_ptycho(self):
     data_file = tu.get_test_big_data_path('68862.nxs')
     process_file = tu.get_test_process_path('basic_ptycho_process_i13.nxs')
     run_protected_plugin_runner(tu.set_options(data_file,
                                                process_file=process_file))
Example #10
0
 def test_image_interpolation(self):
     data_file = tu.get_test_big_data_path('speckle_tracking.h5')
     process_file = tu.get_test_process_path('umpa_test.nxs')
     run_protected_plugin_runner(tu.set_options(data_file,
                                                process_file=process_file))
Example #11
0
 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_nx_ptycho(self):
     data_file = tu.get_test_big_data_path('NXptychoflipped.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))
Example #13
0
 def test_i13_fluo(self):
     data_file = tu.get_test_big_data_path('i13_xrf_tomo_92713.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_i13_speckle_tracking(self):
     data_file = tu.get_test_big_data_path('speckle_tracking.h5')
     process_file = tu.get_test_process_path('i13_speckle_loader_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_big_data_path('i13_xrf_tomo_92713.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))
Example #16
0
 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_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))
Example #18
0
 def test_edf(self):
     data_file = tu.get_test_big_data_path('pymca_live_processing_test/savu_test_result/test_processed.nxs')
     process_file = tu.get_test_process_path("i08_edf_saver_process.nxs")
     run_protected_plugin_runner(tu.set_options(data_file,
                                                process_file=process_file))
Example #19
0
 def test_nx_ptycho(self):
     data_file = tu.get_test_big_data_path('NXptychoflipped.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))
Example #20
0
 def test_i08_regression(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))
Example #21
0
 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))
Example #22
0
 def test_i08(self):
     data_file = tu.get_test_big_data_path(
         'pymca_live_processing_test/i08-10471.nxs')
     process_file = tu.get_test_process_path("i08_basic_process.nxs")
     run_protected_plugin_runner(
         tu.set_options(data_file, process_file=process_file))