示例#1
0
    def test_reduction_method(self):
        # a quick smoke test to check that the reduction can occur
        a = ReducePlatypus('PLP0000711.nx.hdf', data_folder=self.path,
                           rebin_percent=4)

        # try reduction with the reduce method
        a.reduce('PLP0000708.nx.hdf', data_folder=self.path, rebin_percent=4)

        # try reduction with the __call__ method
        a('PLP0000708.nx.hdf', data_folder=self.path, rebin_percent=4)

        # try writing offspecular data
        a.write_offspecular('offspec.xml', 0)
示例#2
0
    def test_accumulate_files_reduce(self):
        # test by adding a file to itself. Should have smaller stats
        fnames = ["PLP0000708.nx.hdf", "PLP0000708.nx.hdf"]
        pths = [os.path.join(self.path, fname) for fname in fnames]
        plp.accumulate_HDF_files(pths)

        # it should be processable
        fadd = PlatypusNexus(os.path.join(os.getcwd(), "ADD_PLP0000708.nx.hdf"))
        fadd.process()

        # it should also be reduceable
        reducer = ReducePlatypus(os.path.join(self.path, "PLP0000711.nx.hdf"))
        reduced = reducer.reduce(os.path.join(os.getcwd(), "ADD_PLP0000708.nx.hdf"))
        assert_("ydata" in reduced)

        # the error bars should be smaller
        reduced2 = reducer.reduce(os.path.join(self.path, "PLP0000708.nx.hdf"))

        assert_(np.all(reduced["ydata_sd"] < reduced2["ydata_sd"]))