예제 #1
0
파일: input_view.py 프로젝트: kif/UPBL09a
    def dump(self, filename=None):
        """
        Reads all parameters and returns them as a python dictionary

        @param filename: dump the content to a file as a JSON string
        @return: dictionary

        """
        logger.debug("InputWidget.dump")
        res = {}
        res["wavelength"] = float_(self.wavelength.text()) * 1e-10

        calibrant = {"do_dspacing": bool(self.do_dspacing.isChecked())}
        calibrant["file"] = str_(self.dspacing.text()).strip()
        calibrant["calibrant"] = str_(self.detector.currentText())
        res["calibrant"] = calibrant

        detector = {"name": str_(self.detector.currentText()),
                    "file":str(self.detectorfile.text()).strip(),
                    "pixel1": float_(self.pixel1.text()),
                    "pixel2":float_(self.pixel2.text())}
        res[detector] = detector

        data = {"file": str_(self.data_file.text()).strip(),
                "hdf5": str_(self.data_file_hdf5.text()).strip() or None}
        res["data"] = data

        mask = {"file": str_(self.mask_file.text()).strip(),
                "hdf5": str_(self.mask_file_hdf5.text()).strip() or None,
                "apply":  bool(self.do_mask.isChecked())}
        res["mask"] = mask

        dark = {"file": str_(self.dark_current.text()).strip(),
                "hdf5": str_(self.dark_file_hdf5.text()).strip() or None,
                "apply":  bool(self.do_dark.isChecked())}
        res["dark"] = dark

        flat = {"file": str_(self.flat_field.text()).strip(),
                "hdf5": str_(self.flat_file_hdf5.text()).strip() or None,
                "apply":  bool(self.do_flat.isChecked())}
        res["flat"] = flat

        try:
            with open(filename, "w") as myFile:
                json.dump(res, myFile, indent=4)
        except IOError as error:
            logger.error("Error while saving config: %s" % error)
        else:
            logger.debug("Saved")

        return res
예제 #2
0
    def proceed(self):
        with self._sem:
            out = None
            self.dump()
            logger.debug("Let's work a bit")
            self.set_ai()

    #        Default Keyword arguments
            kwarg = {"unit": "2th_deg",
                     "dummy": None,
                     "delta_dummy": None,
                     "method": "lut",
                     "polarization_factor":0,
                     "filename": None,
                     "safe": False,
                     }

            if self.q_nm.isChecked():
                kwarg["unit"] = "q_nm^-1"
            elif self.tth_deg.isChecked():
                kwarg["unit"] = "2th_deg"
            elif self.r_mm.isChecked():
                kwarg["unit"] = "r_mm"
            else:
                logger.warning("Undefined unit !!! falling back on 2th_deg")


            if bool(self.do_dummy.isChecked()):
                kwarg["dummy"] = float_(self.val_dummy.text())
                delta_dummy = str(self.delta_dummy.text())
                if delta_dummy:
                    kwarg["delta_dummy"] = float(delta_dummy)
                else:
                    kwarg["delta_dummy"] = None
            if bool(self.do_polarization.isChecked()):
                kwarg["polarization_factor"] = float(self.polarization_factor.value())

            kwarg["nbPt_rad"] = int(str(self.rad_pt.text()).strip())
            if self.do_2D.isChecked():
                kwarg["nbPt_azim"] = int(str(self.rad_pt.text()).strip())

            if self.do_OpenCL.isChecked():
                platform = ocl.get_platform(self.platform.currentText())
                pid = platform.id
                did = platform.get_device(self.device.currentText()).id
                if (pid is not None) and (did is not None):
                    kwarg["method"] = "lut_ocl_%i,%i" % (pid, did)
                else:
                    kwarg["method"] = "lut_ocl"

            if self.do_radial_range:
                try:
                    rad_min = float_(self.radial_range_min.text())
                    rad_max = float_(self.radial_range_max.text())
                except ValueError as error:
                    logger.error("error in parsing radial range: %s" % error)
                else:
                    kwarg["radial_range"] = (rad_min, rad_max)

            if self.do_azimuthal_range:
                try:
                    azim_min = float_(self.azimuth_range_min.text())
                    azim_max = float_(self.azimuth_range_max.text())
                except ValueError as error:
                    logger.error("error in parsing azimuthal range: %s" % error)
                else:
                    kwarg["azimuth_range"] = (azim_min, azim_max)

            logger.info("Parameters for integration:%s%s" % (os.linesep,
                            os.linesep.join(["\t%s:\t%s" % (k, v) for k, v in kwarg.items()])))

            logger.debug("processing %s" % self.input_data)
            start_time = time.time()
            if self.input_data in [None, []]:
                logger.warning("No input data to process")
                return

            elif "ndim" in dir(self.input_data) and (self.input_data.ndim == 3):
                # We have a numpy array of dim3
                if "nbPt_azim" in kwarg:
                    out = numpy.zeros((self.input_data.shape[0], kwarg["nbPt_azim"], kwarg["nbPt_rad"]), dtype=numpy.float32)
                    for i in range(self.input_data.shape[0]):
                        self.progressBar.setValue(100.0 * i / self.input_data.shape[0])
                        kwarg["data"] = self.input_data[i]
                        out[i] = self.ai.integrate2d(kwarg)[0]

                else:
                    out = numpy.zeros((self.input_data.shape[0], kwarg["nbPt_rad"]), dtype=numpy.float32)
                    for i in range(self.input_data.shape[0]):
                        self.progressBar.setValue(100.0 * i / self.input_data.shape[0])
                        kwarg["data"] = self.input_data[i]
                        out[i] = self.ai.integrate1d(**kwarg)[1]

            elif "__len__" in dir(self.input_data):
                out = []
                for i, item in enumerate(self.input_data):
                    self.progressBar.setValue(100.0 * i / len(self.input_data))
                    logger.debug("processing %s" % item)
                    if (type(item) in types.StringTypes) and op.exists(item):
                        kwarg["data"] = fabio.open(item).data
                        if "nbPt_azim" in kwarg:
                            kwarg["filename"] = op.splitext(item)[0] + ".azim"
                        else:
                            kwarg["filename"] = op.splitext(item)[0] + ".dat"
                    else:
                        logger.warning("item is not a file ... guessing it is a numpy array")
                        kwarg["data"] = item
                        kwarg["filename"] = None
                    if "nbPt_azim" in kwarg:
                        out.append(self.ai.integrate2d(**kwarg)[0])
                    else:
                        out.append(self.ai.integrate1d(**kwarg)[0])

            logger.info("Processing Done in %.3fs !" % (time.time() - start_time))
            self.progressBar.setValue(100)
        self.die()
        return out
예제 #3
0
    def dump(self, filename=".azimint.json"):
        """
        Dump the status of the current widget to a file in JSON

        @param filename: path where to save the config
        @type filename: str

        """
        print "Dump!"
        to_save = { "poni": str(self.poni.text()).strip(),
                    "detector": str(self.detector.currentText()).lower(),
                    "wavelength":float_(self.wavelength.text()),
                    "splineFile":str(self.splineFile.text()).strip(),
                    "pixel1": float_(self.pixel1.text()),
                    "pixel2":float_(self.pixel2.text()),
                    "dist":float_(self.dist.text()),
                    "poni1":float_(self.poni1.text()).strip(),
                    "poni2":float_(self.poni2.text()).strip(),
                    "rot1":float_(self.rot1.text()).strip(),
                    "rot2":float_(self.rot2.text()).strip(),
                    "rot3":float_(self.rot3.text()).strip(),
                    "do_dummy": bool(self.do_dummy.isChecked()),
                    "do_mask":  bool(self.do_mask.isChecked()),
                    "do_dark": bool(self.do_dark.isChecked()),
                    "do_flat": bool(self.do_flat.isChecked()),
                    "do_polarization":bool(self.do_polarization.isChecked()),
                    "val_dummy":float_(self.val_dummy.text()).strip(),
                    "delta_dummy":float_(self.delta_dummy.text()).strip(),
                    "mask_file":str(self.mask_file.text()).strip(),
                    "dark_current":str(self.dark_current.text()).strip(),
                    "flat_field":str(self.flat_field.text()).strip(),
                    "polarization_factor":float_(self.polarization_factor.value()),
                    "rad_pt":int_(self.rad_pt.text()),
                    "do_2D":bool(self.do_2D.isChecked()),
                    "azim_pt":int_(self.rad_pt.text()),
                    "chi_discontinuity_at_0": bool(self.chi_discontinuity_at_0.isChecked()),
                    "do_radial_range": bool(self.do_radial_range.isChecked()),
                    "do_azimuthal_range": bool(self.do_azimuthal_range.isChecked()),
                    "radial_range_min":float_(self.radial_range_min.text()),
                    "radial_range_max":float_(self.radial_range_max.text()),
                    "azimuth_range_min":float_(self.azimuth_range_min.text()),
                    "azimuth_range_max":float_(self.azimuth_range_max.text()),
                   }
        if self.q_nm.isChecked():
            to_save["unit"] = "q_nm^-1"
        elif self.tth_deg.isChecked():
            to_save["unit"] = "2th_deg"
        elif self.r_mm.isChecked():
            to_save["unit"] = "r_mm"
        with open(filename, "w") as myFile:
            json.dump(to_save, myFile, indent=4)
        logger.debug("Saved")
예제 #4
0
파일: input_view.py 프로젝트: kif/dahu
    def dump(self, filename=None):
        """
        Reads all parameters and returns them as a python dictionary

        @param filename: dump the content to a file as a JSON string
        @return: dictionary

        """
        logger.debug("InputWidget.dump")
        res = {}
        res["wavelength"] = float_(self.wavelength.text()) * 1e-10

        calibrant = {"do_dspacing": bool(self.do_dspacing.isChecked())}
        calibrant["file"] = str_(self.dspacing.text()).strip()
        calibrant["calibrant"] = str_(self.detector.currentText())
        res["calibrant"] = calibrant

        detector = {
            "name": str_(self.detector.currentText()),
            "file": str(self.detectorfile.text()).strip(),
            "pixel1": float_(self.pixel1.text()),
            "pixel2": float_(self.pixel2.text())
        }
        res[detector] = detector

        data = {
            "file": str_(self.data_file.text()).strip(),
            "hdf5": str_(self.data_file_hdf5.text()).strip() or None
        }
        res["data"] = data

        mask = {
            "file": str_(self.mask_file.text()).strip(),
            "hdf5": str_(self.mask_file_hdf5.text()).strip() or None,
            "apply": bool(self.do_mask.isChecked())
        }
        res["mask"] = mask

        dark = {
            "file": str_(self.dark_current.text()).strip(),
            "hdf5": str_(self.dark_file_hdf5.text()).strip() or None,
            "apply": bool(self.do_dark.isChecked())
        }
        res["dark"] = dark

        flat = {
            "file": str_(self.flat_field.text()).strip(),
            "hdf5": str_(self.flat_file_hdf5.text()).strip() or None,
            "apply": bool(self.do_flat.isChecked())
        }
        res["flat"] = flat

        try:
            with open(filename, "w") as myFile:
                json.dump(res, myFile, indent=4)
        except IOError as error:
            logger.error("Error while saving config: %s" % error)
        else:
            logger.debug("Saved")

        return res
예제 #5
0
    def proceed(self):
        with self._sem:
            out = None
            self.dump()
            logger.debug("Let's work a bit")
            self.set_ai()

            #        Default Keyword arguments
            kwarg = {
                "unit": "2th_deg",
                "dummy": None,
                "delta_dummy": None,
                "method": "lut",
                "polarization_factor": None,
                "filename": None,
                "safe": False,
            }

            if self.q_nm.isChecked():
                kwarg["unit"] = "q_nm^-1"
            elif self.tth_deg.isChecked():
                kwarg["unit"] = "2th_deg"
            elif self.tth_rad.isChecked():
                kwarg["unit"] = "2th_rad"
            elif self.r_mm.isChecked():
                kwarg["unit"] = "r_mm"
            elif self.q_A.isChecked():
                kwarg["unit"] = "q_A^-1"
            else:
                logger.warning("Undefined unit !!! falling back on 2th_deg")

            kwarg["correctSolidAngle"] = bool(self.do_solid_angle.isChecked())

            if bool(self.do_dummy.isChecked()):
                kwarg["dummy"] = float_(self.val_dummy.text())
                delta_dummy = str(self.delta_dummy.text())
                if delta_dummy:
                    kwarg["delta_dummy"] = float(delta_dummy)
                else:
                    kwarg["delta_dummy"] = None
            if bool(self.do_polarization.isChecked()):
                kwarg["polarization_factor"] = float(
                    self.polarization_factor.value())
            else:
                kwarg["polarization_factor"] = None

            kwarg["nbPt_rad"] = int(str(self.rad_pt.text()).strip())
            if self.do_2D.isChecked():
                kwarg["nbPt_azim"] = int(str(self.azim_pt.text()).strip())

            if self.do_OpenCL.isChecked():
                platform = ocl.get_platform(self.platform.currentText())
                pid = platform.id
                did = platform.get_device(self.device.currentText()).id
                if (pid is not None) and (did is not None):
                    kwarg["method"] = "lut_ocl_%i,%i" % (pid, did)
                else:
                    kwarg["method"] = "lut_ocl"

            if self.do_radial_range.isChecked():
                try:
                    rad_min = float_(self.radial_range_min.text())
                    rad_max = float_(self.radial_range_max.text())
                except ValueError as error:
                    logger.error("error in parsing radial range: %s" % error)
                else:
                    kwarg["radial_range"] = (rad_min, rad_max)
                if kwarg["radial_range"] == (None, None):
                    kwarg["radial_range"] = None

            if self.do_azimuthal_range.isChecked():
                try:
                    azim_min = float_(self.azimuth_range_min.text())
                    azim_max = float_(self.azimuth_range_max.text())
                except ValueError as error:
                    logger.error("error in parsing azimuthal range: %s" %
                                 error)
                else:
                    kwarg["azimuth_range"] = (azim_min, azim_max)
                if kwarg["azimuth_range"] == (None, None):
                    kwarg["azimuth_range"] = None
            if self.do_poisson.isChecked():
                kwarg["error_model"] = "poisson"
            else:
                kwarg["error_model"] = None
            logger.info("Parameters for integration:%s%s" %
                        (os.linesep,
                         os.linesep.join(
                             ["\t%s:\t%s" % (k, v)
                              for k, v in kwarg.items()])))

            logger.debug("processing %s" % self.input_data)
            start_time = time.time()
            if self.input_data in [None, []]:
                logger.warning("No input data to process")
                return

            elif "ndim" in dir(self.input_data) and (self.input_data.ndim
                                                     == 3):
                # We have a numpy array of dim3
                if "nbPt_azim" in kwarg:
                    out = numpy.zeros((self.input_data.shape[0],
                                       kwarg["nbPt_azim"], kwarg["nbPt_rad"]),
                                      dtype=numpy.float32)
                    for i in range(self.input_data.shape[0]):
                        self.progressBar.setValue(100.0 * i /
                                                  self.input_data.shape[0])
                        kwarg["data"] = self.input_data[i]
                        out[i] = self.ai.integrate2d(**kwarg)[0]

                else:
                    if "nbPt_rad" in kwarg:  # convert nbPt_rad -> nbPt
                        kwarg["nbPt"] = kwarg.pop("nbPt_rad")
                    out = numpy.zeros(
                        (self.input_data.shape[0], kwarg["nbPt"]),
                        dtype=numpy.float32)
                    for i in range(self.input_data.shape[0]):
                        self.progressBar.setValue(100.0 * i /
                                                  self.input_data.shape[0])
                        kwarg["data"] = self.input_data[i]
                        out[i] = self.ai.integrate1d(**kwarg)[1]

            elif "__len__" in dir(self.input_data):
                out = []
                if self.hdf5_path:
                    import h5py
                    hdf5 = h5py.File(self.output_path)
                    if self.fast_dim:
                        if "nbPt_azim" in kwarg:
                            ds = hdf5.create_dataset(
                                "diffraction",
                                (1, self.fast_dim, kwarg["nbPt_azim"],
                                 kwarg["nbPt_rad"]),
                                dtype=numpy.float32,
                                chunks=(1, self.fast_dim, kwarg["nbPt_azim"],
                                        kwarg["nbPt_rad"]),
                                maxshape=(None, self.fast_dim,
                                          kwarg["nbPt_azim"],
                                          kwarg["nbPt_rad"]))
                        else:
                            ds = hdf5.create_dataset(
                                "diffraction",
                                (1, self.fast_dim, kwarg["nbPt_rad"]),
                                dtype=numpy.float32,
                                chunks=(1, self.fast_dim, kwarg["nbPt_rad"]),
                                maxshape=(None, self.fast_dim,
                                          kwarg["nbPt_rad"]))
                    else:
                        if "nbPt_azim" in kwarg:
                            ds = hdf5.create_dataset(
                                "diffraction",
                                (1, kwarg["nbPt_azim"], kwarg["nbPt_rad"]),
                                dtype=numpy.float32,
                                chunks=(1, kwarg["nbPt_azim"],
                                        kwarg["nbPt_rad"]),
                                maxshape=(None, kwarg["nbPt_azim"],
                                          kwarg["nbPt_rad"]))
                        else:
                            ds = hdf5.create_dataset(
                                "diffraction", (1, kwarg["nbPt_rad"]),
                                dtype=numpy.float32,
                                chunks=(1, kwarg["nbPt_rad"]),
                                maxshape=(None, kwarg["nbPt_rad"]))

                for i, item in enumerate(self.input_data):
                    self.progressBar.setValue(100.0 * i / len(self.input_data))
                    logger.debug("processing %s" % item)
                    if (type(item) in types.StringTypes) and op.exists(item):
                        kwarg["data"] = fabio.open(item).data
                        if self.hdf5_path is None:
                            if self.output_path and op.isdir(self.output_path):
                                outpath = op.join(
                                    self.output_path,
                                    op.splitext(op.basename(item))[0])
                            else:
                                outpath = op.splitext(item)[0]
                            if "nbPt_azim" in kwarg:
                                kwarg["filename"] = outpath + ".azim"
                            else:
                                kwarg["filename"] = outpath + ".dat"
                    else:
                        logger.warning(
                            "item is not a file ... guessing it is a numpy array"
                        )
                        kwarg["data"] = item
                        kwarg["filename"] = None
                    if kwarg.get("nbPt_azim"):
                        res = self.ai.integrate2d(**kwarg)[0]
                    else:
                        if "nbPt_rad" in kwarg:  # convert nbPt_rad -> nbPt
                            kwarg["nbPt"] = kwarg.pop("nbPt_rad")
                        res = self.ai.integrate1d(**kwarg)[0]
                    out.append(res)
                    #TODO manage HDF5 stuff !!!
            logger.info("Processing Done in %.3fs !" %
                        (time.time() - start_time))
            self.progressBar.setValue(100)
        self.die()
        return out
예제 #6
0
    def proceed(self):
        with self._sem:
            out = None
            self.dump()
            logger.debug("Let's work a bit")
            self.set_ai()

    #        Default Keyword arguments
            kwarg = {"unit": "2th_deg",
                     "dummy": None,
                     "delta_dummy": None,
                     "method": "lut",
                     "polarization_factor":None,
                     "filename": None,
                     "safe": False,
                     }

            if self.q_nm.isChecked():
                kwarg["unit"] = "q_nm^-1"
            elif self.tth_deg.isChecked():
                kwarg["unit"] = "2th_deg"
            elif self.tth_rad.isChecked():
                kwarg["unit"] = "2th_rad"
            elif self.r_mm.isChecked():
                kwarg["unit"] = "r_mm"
            elif self.q_A.isChecked():
                kwarg["unit"] = "q_A^-1"
            else:
                logger.warning("Undefined unit !!! falling back on 2th_deg")

            kwarg["correctSolidAngle"] = bool(self.do_solid_angle.isChecked())

            if bool(self.do_dummy.isChecked()):
                kwarg["dummy"] = float_(self.val_dummy.text())
                delta_dummy = str(self.delta_dummy.text())
                if delta_dummy:
                    kwarg["delta_dummy"] = float(delta_dummy)
                else:
                    kwarg["delta_dummy"] = None
            if bool(self.do_polarization.isChecked()):
                kwarg["polarization_factor"] = float(self.polarization_factor.value())
            else:
                kwarg["polarization_factor"] = None

            kwarg["nbPt_rad"] = int(str(self.rad_pt.text()).strip())
            if self.do_2D.isChecked():
                kwarg["nbPt_azim"] = int(str(self.azim_pt.text()).strip())

            if self.do_OpenCL.isChecked():
                platform = ocl.get_platform(self.platform.currentText())
                pid = platform.id
                did = platform.get_device(self.device.currentText()).id
                if (pid is not None) and (did is not None):
                    kwarg["method"] = "lut_ocl_%i,%i" % (pid, did)
                else:
                    kwarg["method"] = "lut_ocl"

            if self.do_radial_range.isChecked():
                try:
                    rad_min = float_(self.radial_range_min.text())
                    rad_max = float_(self.radial_range_max.text())
                except ValueError as error:
                    logger.error("error in parsing radial range: %s" % error)
                else:
                    kwarg["radial_range"] = (rad_min, rad_max)
                if kwarg["radial_range"] == (None, None):
                    kwarg["radial_range"] = None

            if self.do_azimuthal_range.isChecked():
                try:
                    azim_min = float_(self.azimuth_range_min.text())
                    azim_max = float_(self.azimuth_range_max.text())
                except ValueError as error:
                    logger.error("error in parsing azimuthal range: %s" % error)
                else:
                    kwarg["azimuth_range"] = (azim_min, azim_max)
                if kwarg["azimuth_range"] == (None, None):
                    kwarg["azimuth_range"] = None
            if self.do_poisson.isChecked():
                kwarg["error_model"] = "poisson"
            else:
                kwarg["error_model"] = None
            logger.info("Parameters for integration:%s%s" % (os.linesep,
                            os.linesep.join(["\t%s:\t%s" % (k, v) for k, v in kwarg.items()])))

            logger.debug("processing %s" % self.input_data)
            start_time = time.time()
            if self.input_data in [None, []]:
                logger.warning("No input data to process")
                return

            elif "ndim" in dir(self.input_data) and (self.input_data.ndim == 3):
                # We have a numpy array of dim3
                if "nbPt_azim" in kwarg:
                    out = numpy.zeros((self.input_data.shape[0], kwarg["nbPt_azim"], kwarg["nbPt_rad"]), dtype=numpy.float32)
                    for i in range(self.input_data.shape[0]):
                        self.progressBar.setValue(100.0 * i / self.input_data.shape[0])
                        kwarg["data"] = self.input_data[i]
                        out[i] = self.ai.integrate2d(**kwarg)[0]

                else:
                    if "nbPt_rad" in kwarg:  # convert nbPt_rad -> nbPt
                            kwarg["nbPt"] = kwarg.pop("nbPt_rad")
                    out = numpy.zeros((self.input_data.shape[0], kwarg["nbPt"]), dtype=numpy.float32)
                    for i in range(self.input_data.shape[0]):
                        self.progressBar.setValue(100.0 * i / self.input_data.shape[0])
                        kwarg["data"] = self.input_data[i]
                        out[i] = self.ai.integrate1d(**kwarg)[1]

            elif "__len__" in dir(self.input_data):
                out = []
                if self.hdf5_path:
                    import h5py
                    hdf5 = h5py.File(self.output_path)
                    if self.fast_dim:
                        if "nbPt_azim" in kwarg:
                            ds = hdf5.create_dataset("diffraction",(1,self.fast_dim,kwarg["nbPt_azim"],kwarg["nbPt_rad"]),
                                                      dtype = numpy.float32,
                                                      chunks=(1,self.fast_dim,kwarg["nbPt_azim"],kwarg["nbPt_rad"]),
                                                      maxshape=(None,self.fast_dim,kwarg["nbPt_azim"],kwarg["nbPt_rad"]))
                        else:
                            ds = hdf5.create_dataset("diffraction",(1,self.fast_dim,kwarg["nbPt_rad"]),
                                                      dtype = numpy.float32,
                                                      chunks=(1,self.fast_dim,kwarg["nbPt_rad"]),
                                                      maxshape=(None,self.fast_dim,kwarg["nbPt_rad"]))
                    else:
                        if "nbPt_azim" in kwarg:
                            ds = hdf5.create_dataset("diffraction",(1,kwarg["nbPt_azim"],kwarg["nbPt_rad"]),
                                                      dtype = numpy.float32,
                                                      chunks=(1,kwarg["nbPt_azim"],kwarg["nbPt_rad"]),
                                                      maxshape=(None,kwarg["nbPt_azim"],kwarg["nbPt_rad"]))
                        else:
                            ds = hdf5.create_dataset("diffraction",(1,kwarg["nbPt_rad"]),
                                                      dtype = numpy.float32,
                                                      chunks=(1,kwarg["nbPt_rad"]),
                                                      maxshape=(None,kwarg["nbPt_rad"]))

                for i, item in enumerate(self.input_data):
                    self.progressBar.setValue(100.0 * i / len(self.input_data))
                    logger.debug("processing %s" % item)
                    if (type(item) in types.StringTypes) and op.exists(item):
                        kwarg["data"] = fabio.open(item).data
                        if self.hdf5_path is None:
                            if self.output_path and op.isdir(self.output_path):
                                outpath = op.join(self.output_path,op.splitext(op.basename(item))[0])
                            else:
                                outpath = op.splitext(item)[0]
                            if "nbPt_azim" in kwarg:
                                kwarg["filename"] = outpath + ".azim"
                            else:
                                kwarg["filename"] = outpath + ".dat"
                    else:
                        logger.warning("item is not a file ... guessing it is a numpy array")
                        kwarg["data"] = item
                        kwarg["filename"] = None
                    if kwarg.get("nbPt_azim"):
                        res=self.ai.integrate2d(**kwarg)[0]
                    else:
                        if "nbPt_rad" in kwarg:  # convert nbPt_rad -> nbPt
                            kwarg["nbPt"] = kwarg.pop("nbPt_rad")
                        res=self.ai.integrate1d(**kwarg)[0]
                    out.append(res)
                    #TODO manage HDF5 stuff !!!
            logger.info("Processing Done in %.3fs !" % (time.time() - start_time))
            self.progressBar.setValue(100)
        self.die()
        return out