Example #1
0
    def test_smoke(self):
        # a quick smoke test to check that the reduction can occur
        # warnings filter for pixel size
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", RuntimeWarning)
            a, fname = reduce_stitch(
                [708, 709, 710],
                [711, 711, 711],
                data_folder=self.pth,
                reduction_options={"rebin_percent": 2},
            )
            a.save("test1.dat")
            assert os.path.isfile("./test1.dat")

            # reduce_stitch should take a ReductionOptions dict
            opts = ReductionOptions()
            opts["rebin_percent"] = 2

            a2, fname = reduce_stitch(
                [708, 709, 710],
                [711, 711, 711],
                data_folder=self.pth,
                reduction_options=[opts] * 3,
            )
            a2.save("test2.dat")
            assert os.path.isfile("./test2.dat")
            assert_allclose(a.y, a2.y)
Example #2
0
    def test_smoke(self):
        # a quick smoke test to check that the reduction can occur
        # warnings filter for pixel size
        a, fname = reduce_stitch(
            [660, 661],
            [658, 659],
            data_folder=self.pth,
            prefix="SPZ",
            reduction_options={"rebin_percent": 2},
        )
        a.save("test1.dat")
        assert os.path.isfile("./test1.dat")

        # reduce_stitch should take a list of ReductionOptions dict,
        # separate dicts are used for different angles
        opts = ReductionOptions()
        opts["rebin_percent"] = 2

        a2, fname = reduce_stitch(
            [660, 661],
            [658, 659],
            data_folder=self.pth,
            prefix="SPZ",
            reduction_options=[opts] * 2,
        )
        a2.save("test2.dat")
        assert os.path.isfile("./test2.dat")
        assert_allclose(a.y, a2.y)
Example #3
0
 def test_smoke(self):
     # a quick smoke test to check that the reduction can occur
     # warnings filter for pixel size
     with warnings.catch_warnings():
         warnings.simplefilter('ignore', RuntimeWarning)
         a, fname = reduce_stitch([708, 709, 710], [711, 711, 711],
                                  data_folder=self.pth,
                                  rebin_percent=2)
         a.save('test1.dat')
Example #4
0
    def _reduce_row(self, entry):
        """Process a single row using reduce_stitch

        Parameters
        ----------
        entry : pandas.Series
            Spreadsheet row for this data set
        """
        # Identify the runs to be used for reduction
        runs = run_list(entry, "refl")
        directs = run_list(entry, "directs")

        if self.verbose:
            fmt = "Reducing %s [%s]/[%s]"

            print(fmt % (
                entry["name"],
                ", ".join("%d" % r for r in runs),
                ", ".join("%d" % r for r in directs),
            ))
            sys.stdout.flush()  # keep progress updated

        if not runs:
            warnings.warn("Row %d (%s) has no reflection runs. Skipped." %
                          (entry["source"], entry["name"]))
            return None, None
        if not directs:
            warnings.warn("Row %d (%s) has no direct beam runs. Skipped." %
                          (entry["source"], entry["name"]))
            return None, None

        if len(runs) > len(directs):
            warnings.warn("Row %d (%s) has differing numbers of"
                          " direct & reflection runs. Skipped." %
                          (entry["source"], entry["name"]))
            return None, None

        ds, fname = reduce_stitch(
            runs,
            directs,
            trim_trailing=self.trim_trailing,
            data_folder=self.data_folder,
            reduction_options=self.reduction_options,
            prefix=self.prefix,
        )

        return ds, fname
Example #5
0
    def _reduce_row(self, entry):
        """ Process a single row using reduce_stitch

        Parameters
        ----------
        entry : pandas.Series
            Spreadsheet row for this data set
        """
        # Identify the runs to be used for reduction
        runs = run_list(entry, 'refl')
        directs = run_list(entry, 'directs')

        if self.verbose:
            fmt = "Reducing %s [%s]/[%s]"

            print(fmt % (entry['name'],
                         ", ".join('%d' % r for r in runs),
                         ", ".join('%d' % r for r in directs)))
            sys.stdout.flush()   # keep progress updated

        if not runs:
            warnings.warn("Row %d (%s) has no reflection runs" %
                          (entry['source'], entry['name']))
            return None, None
        if not directs:
            warnings.warn("Row %d (%s) has no direct beam runs" %
                          (entry['source'], entry['name']))
            return None, None

        if len(runs) != len(directs):
            warnings.warn("Row %d (%s) has differing numbers of"
                          " direct & refln runs" %
                          (entry['source'], entry['name']))
            return None, None

        ds, fname = reduce_stitch(runs, directs, **self.kwds)

        return ds, fname
Example #6
0
    def _reduce_row(self, entry):
        """ Process a single row using reduce_stitch

        Parameters
        ----------
        entry : pandas.Series
            Spreadsheet row for this data set
        """
        # Identify the runs to be used for reduction
        runs = run_list(entry, 'refl')
        directs = run_list(entry, 'directs')

        if self.verbose:
            fmt = "Reducing %s [%s]/[%s]"

            print(fmt % (entry['name'], ", ".join(
                '%d' % r for r in runs), ", ".join('%d' % r for r in directs)))
            sys.stdout.flush()  # keep progress updated

        if not runs:
            warnings.warn("Row %d (%s) has no reflection runs. Skipped." %
                          (entry['source'], entry['name']))
            return None, None
        if not directs:
            warnings.warn("Row %d (%s) has no direct beam runs. Skipped." %
                          (entry['source'], entry['name']))
            return None, None

        if len(runs) > len(directs):
            warnings.warn("Row %d (%s) has differing numbers of"
                          " direct & reflection runs. Skipped." %
                          (entry['source'], entry['name']))
            return None, None

        ds, fname = reduce_stitch(runs, directs, **self.kwds)

        return ds, fname
Example #7
0
 def test_smoke(self):
     # a quick smoke test to check that the reduction can occur
     a, fname = reduce_stitch([708, 709, 710], [711, 711, 711],
                       data_folder=self.path, rebin_percent=2)
     a.save('test1.dat')
Example #8
0
 def test_smoke(self):
     # a quick smoke test to check that the reduction can occur
     a, fname = reduce_stitch([708, 709, 710], [711, 711, 711],
                              data_folder=self.pth, rebin_percent=2)
     a.save('test1.dat')