Ejemplo n.º 1
0
    def create_autoproc_input(self, event, params):
        """Creates processing input xml

        :param event: processing type (after, before, image)
        :type event: str
        :param params: collection parameters
        :type params: dict
        """
        xds_input_file_wait_timeout = 20
        xds_input_file_wait_resolution = 1

        file_name_timestamp = time.strftime("%Y%m%d_%H%M%S")

        autoproc_path = params.get("xds_dir")
        autoproc_xds_filename = os.path.join(autoproc_path, "XDS.INP")
        autoproc_input_filename = os.path.join(\
            autoproc_path,
            "edna-autoproc-input-%s.xml" % \
            file_name_timestamp)
        autoproc_output_file_name = os.path.join(\
            autoproc_path,
            "edna-autoproc-results-%s.xml" % \
            file_name_timestamp)

        autoproc_input = XSDataAutoprocInput()
        autoproc_xds_file = XSDataFile()
        autoproc_xds_file.setPath(XSDataString(autoproc_xds_filename))
        autoproc_input.setInput_file(autoproc_xds_file)

        autoproc_output_file = XSDataFile()
        autoproc_output_file.setPath(XSDataString(autoproc_output_file_name))
        autoproc_input.setOutput_file(autoproc_output_file)

        autoproc_input.setData_collection_id(\
            XSDataInteger(params.get("collection_id")))
        residues_num = float(params.get("residues", 0))
        if residues_num != 0:
            autoproc_input.setNres(XSDataDouble(residues_num))
        space_group = params.get("sample_reference").get("spacegroup", "")
        if len(space_group) > 0:
            autoproc_input.setSpacegroup(XSDataString(space_group))
        unit_cell = params.get("sample_reference").get("cell", "")
        if len(unit_cell) > 0:
            autoproc_input.setUnit_cell(XSDataString(unit_cell))

        autoproc_input.setCc_half_cutoff(XSDataDouble(18.0))

        #Maybe we have to check if directory is there.
        #Maybe create dir with mxcube
        xds_appeared = False
        wait_xds_start = time.time()
        logging.debug("EMBLAutoprocessing: Waiting for XDS.INP " +\
                      "file: %s" % autoproc_xds_filename)
        while not xds_appeared and time.time(
        ) - wait_xds_start < xds_input_file_wait_timeout:
            if os.path.exists(autoproc_xds_filename) and \
               os.stat(autoproc_xds_filename).st_size > 0:
                xds_appeared = True
                logging.debug('EMBLAutoprocessing: XDS.INP file is there, size={0}'.\
                        format(os.stat(autoproc_xds_filename).st_size))
            else:
                os.system("ls %s> /dev/null" %
                          (os.path.dirname(autoproc_path)))
                gevent.sleep(xds_input_file_wait_resolution)
        if not xds_appeared:
            logging.error("EMBLAutoprocessing: XDS.INP file ({0}) failed " +\
                          "to appear after {1} seconds".\
                    format(autoproc_xds_filename, xds_input_file_wait_timeout))
            return None, False

        autoproc_input.exportToFile(autoproc_input_filename)

        return autoproc_input_filename, True
    def create_autoproc_input(self, event, params):
        """
        Descript. :
        """
        WAIT_XDS_TIMEOUT = 20
        WAIT_XDS_RESOLUTION = 1

        file_name_timestamp = time.strftime("%Y%m%d_%H%M%S")

        autoproc_path = params.get("xds_dir")
        autoproc_xds_filename = os.path.join(autoproc_path, "XDS.INP")
        autoproc_input_filename = os.path.join(
            autoproc_path, "edna-autoproc-input-%s" % file_name_timestamp
        )
        autoproc_output_file_name = os.path.join(
            autoproc_path, "edna-autoproc-results-%s" % file_name_timestamp
        )

        autoproc_input = XSDataAutoprocInput()
        autoproc_xds_file = XSDataFile()
        autoproc_xds_file.setPath(XSDataString(autoproc_xds_filename))
        autoproc_input.setInput_file(autoproc_xds_file)

        autoproc_output_file = XSDataFile()
        autoproc_output_file.setPath(XSDataString(autoproc_output_file_name))
        autoproc_input.setOutput_file(autoproc_output_file)

        autoproc_input.setData_collection_id(XSDataInteger(params.get("collection_id")))
        residues_num = float(params.get("residues", 0))
        if residues_num != 0:
            autoproc_input.setNres(XSDataDouble(residues_num))
        space_group = params.get("sample_reference").get("spacegroup", "")
        if not isinstance(space_group, int) and len(space_group) > 0:
            autoproc_input.setSpacegroup(XSDataString(space_group))
        unit_cell = params.get("sample_reference").get("cell", "")
        if len(unit_cell) > 0:
            autoproc_input.setUnit_cell(XSDataString(unit_cell))

        autoproc_input.setCc_half_cutoff(XSDataDouble(18.0))

        # Maybe we have to check if directory is there. Maybe create dir with mxcube
        xds_appeared = False
        wait_xds_start = time.time()
        logging.info(
            "MAXIVAutoprocessing: Waiting for XDS.INP file: %s" % autoproc_xds_filename
        )
        while not xds_appeared and time.time() - wait_xds_start < WAIT_XDS_TIMEOUT:
            if (
                os.path.exists(autoproc_xds_filename)
                and os.stat(autoproc_xds_filename).st_size > 0
            ):
                xds_appeared = True
                logging.debug(
                    "MAXIVAutoprocessing: XDS.INP file is there, size={0}".format(
                        os.stat(autoproc_xds_filename).st_size
                    )
                )
            else:
                os.system("ls %s> /dev/null" % (os.path.dirname(autoproc_path)))
                gevent.sleep(WAIT_XDS_RESOLUTION)
        if not xds_appeared:
            logging.error(
                "MAXIVAutoprocessing: XDS.INP file ({0}) failed to appear after {1} seconds".format(
                    autoproc_xds_filename, WAIT_XDS_TIMEOUT
                )
            )
            return None, False

        autoproc_input.exportToFile(autoproc_input_filename)

        return autoproc_input_filename, True
Ejemplo n.º 3
0
    def create_input_files(self, xds_dir, mosflm_dir, dc_pars):

        fileinfo = dc_pars["fileinfo"]
        osc_seq = dc_pars["oscillation_sequence"][0]

        prefix = fileinfo["prefix"]
        runno = fileinfo["run_number"]

        exp_time = osc_seq["exposure_time"]

        start_angle = osc_seq["start"]
        nb_images = osc_seq["number_of_images"]
        start_img_num = osc_seq["start_image_number"]
        angle_increment = osc_seq["range"]

        wavelength = osc_seq.get("wavelength", 0)

        xds_template_name = "XDS_TEMPLATE.INP"
        mosflm_template_name = "mosflm_template.dat"

        xds_template_path = os.path.join(self.template_dir, xds_template_name)
        mosflm_template_path = os.path.join(self.template_dir,
                                            mosflm_template_name)

        xds_file = os.path.join(xds_dir, "XDS.INP")
        mosflm_file = os.path.join(mosflm_dir, "mosflm.dat")

        t = datetime.now()

        # PREPARE VARIABLES
        detsamdis = self.var_ds.detsamdis
        beamx, beamy = self.var_ds.beamx, self.var_ds.beamy

        mbeamx, mbeamy = beamy * 0.172, beamx * 0.172

        datarangestartnum = start_img_num
        datarangefinishnum = start_img_num + nb_images - 1
        backgroundrangestartnum = start_img_num
        spotrangestartnum = start_img_num
        if angle_increment != 0:
            minimumrange = int(round(20 / angle_increment))
        elif angle_increment == 0:
            minimumrange = 1
        if nb_images >= minimumrange:
            backgroundrangefinishnum = start_img_num + minimumrange - 1
        if nb_images >= minimumrange:
            spotrangefinishnum = start_img_num + minimumrange - 1
        if nb_images < minimumrange:
            backgroundrangefinishnum = start_img_num + nb_images - 1
        if nb_images < minimumrange:
            spotrangefinishnum = start_img_num + nb_images - 1

        testlowres = 8.0
        largestvector = (0.172 * ((max(beamx, 2463 - beamx))**2 +
                                  (max(beamy, 2527 - beamy))**2)**0.5)
        testhighres = round(
            wavelength /
            (2 * math.sin(0.5 * math.atan(largestvector / detsamdis))), 2)
        lowres = 50.0
        highres = testhighres
        datafilename = prefix + "_" + str(runno) + "_????"
        mdatafilename = prefix + "_" + str(runno) + "_####.cbf"
        seconds = 5 * exp_time

        if angle_increment < 1 and not angle_increment == 0:
            seconds = 5 * exp_time / angle_increment

        # DEFINE SG/UNIT CELL
        spacegroupnumber = ""
        unitcellconstants = ""

        datapath_dir = os.path.abspath(xds_file).replace(
            "PROCESS_DATA", "RAW_DATA")
        datapath_dir = os.path.dirname(
            os.path.dirname(datapath_dir)) + os.path.sep

        # CREATE XDS.INP FILE
        xds_templ = open(xds_template_path, "r").read()

        xds_templ = xds_templ.replace("###BEAMX###", str(round(beamx, 2)))
        xds_templ = xds_templ.replace("###BEAMY###", str(round(beamy, 2)))
        xds_templ = xds_templ.replace("###DETSAMDIS###",
                                      str(round(detsamdis, 2)))
        xds_templ = xds_templ.replace("###ANGLEINCREMENT###",
                                      str(angle_increment))
        xds_templ = xds_templ.replace("###WAVELENGTH###", str(wavelength))
        xds_templ = xds_templ.replace("###DATARANGESTARTNUM###",
                                      str(datarangestartnum))
        xds_templ = xds_templ.replace("###DATARANGEFINISHNUM###",
                                      str(datarangefinishnum))
        xds_templ = xds_templ.replace("###BACKGROUNDRANGESTART###",
                                      str(backgroundrangestartnum))
        xds_templ = xds_templ.replace("###BACKGROUNDRANGEFINISHNUM###",
                                      str(backgroundrangefinishnum))
        xds_templ = xds_templ.replace("###SPOTRANGESTARTNUM###",
                                      str(spotrangestartnum))
        xds_templ = xds_templ.replace("###SPOTRANGEFINISHNUM###",
                                      str(spotrangefinishnum))
        xds_templ = xds_templ.replace("###TESTLOWRES###", str(testlowres))
        xds_templ = xds_templ.replace("###TESTHIGHRES###", str(testhighres))
        xds_templ = xds_templ.replace("###LOWRES###", str(lowres))
        xds_templ = xds_templ.replace("###HIGHRES###", str(highres))
        xds_templ = xds_templ.replace("###DIRECTORY###", str(datapath_dir))
        xds_templ = xds_templ.replace("###FILENAME###", str(datafilename))
        xds_templ = xds_templ.replace("###SECONDS###", str(int(seconds)))
        xds_templ = xds_templ.replace("###LYSOZYME_SPACE_GROUP_NUMBER###",
                                      str(spacegroupnumber))
        xds_templ = xds_templ.replace("###LYSOZYME_UNIT_CELL_CONSTANTS###",
                                      str(unitcellconstants))

        open(xds_file, "w").write(xds_templ)

        # CREATE MOSFLM.DAT FILE

        mosflm_templ = open(mosflm_template_path, "r").read()

        mosflm_templ = mosflm_templ.replace("###DETSAMDIS###",
                                            str(round(detsamdis, 2)))
        mosflm_templ = mosflm_templ.replace("###BEAMX###",
                                            str(round(mbeamx, 2)))
        mosflm_templ = mosflm_templ.replace("###BEAMY###",
                                            str(round(mbeamy, 2)))
        mosflm_templ = mosflm_templ.replace("###DIRECTORY###",
                                            str(datapath_dir))
        mosflm_templ = mosflm_templ.replace("###FILENAME###",
                                            str(mdatafilename))
        mosflm_templ = mosflm_templ.replace("###WAVELENGTH###",
                                            str(wavelength))
        mosflm_templ = mosflm_templ.replace("###DATARANGESTARTNUM###",
                                            str(datarangestartnum))

        open(mosflm_file, "w").write(mosflm_templ)

        # CREATE EDNAPROC XML FILE
        collection_id = dc_pars["collection_id"]
        output_dir = dc_pars["ednaproc_dir"]

        ednaproc_input_file = os.path.join(
            output_dir, "EDNAprocInput_%d.xml" % collection_id)

        ednaproc_input = XSDataAutoprocInput()

        input_file = XSDataFile()
        path = XSDataString()
        path.set_value(xds_file)
        input_file.setPath(path)

        ednaproc_input.setInput_file(input_file)
        ednaproc_input.setData_collection_id(XSDataInteger(collection_id))

        # output_dir = XSDataFile()
        # outpath = XSDataString()
        # outpath.set_value(output_dir)
        # output_dir.setPath(path)

        # ednaproc_input.setOutput_directory( output_dir )

        ednaproc_input.exportToFile(ednaproc_input_file)

        self.input_file = ednaproc_input_file
    def create_input_files(self, xds_dir, mosflm_dir, dc_pars):

        fileinfo = dc_pars["fileinfo"]
        osc_seq = dc_pars["oscillation_sequence"][0]

        prefix = fileinfo["prefix"]
        runno = fileinfo["run_number"]

        exp_time = osc_seq["exposure_time"]

        start_angle = osc_seq["start"]
        nb_images = osc_seq["number_of_images"]
        start_img_num = osc_seq["start_image_number"]
        angle_increment = osc_seq["range"]

        wavelength = osc_seq.get("wavelength", 0)

        xds_template_name = "XDS_TEMPLATE.INP"
        mosflm_template_name = "mosflm_template.dat"

        xds_template_path = os.path.join(self.template_dir, xds_template_name)
        mosflm_template_path = os.path.join(self.template_dir, mosflm_template_name)

        xds_file = os.path.join(xds_dir, "XDS.INP")
        mosflm_file = os.path.join(mosflm_dir, "mosflm.dat")

        t = datetime.now()

        # PREPARE VARIABLES
        detsamdis = self.var_ds.detsamdis
        beamx, beamy = self.var_ds.beamx, self.var_ds.beamy

        mbeamx, mbeamy = beamy * 0.172, beamx * 0.172

        datarangestartnum = start_img_num
        datarangefinishnum = start_img_num + nb_images - 1
        backgroundrangestartnum = start_img_num
        spotrangestartnum = start_img_num
        if angle_increment != 0:
            minimumrange = int(round(20 / angle_increment))
        elif angle_increment == 0:
            minimumrange = 1
        if nb_images >= minimumrange:
            backgroundrangefinishnum = start_img_num + minimumrange - 1
        if nb_images >= minimumrange:
            spotrangefinishnum = start_img_num + minimumrange - 1
        if nb_images < minimumrange:
            backgroundrangefinishnum = start_img_num + nb_images - 1
        if nb_images < minimumrange:
            spotrangefinishnum = start_img_num + nb_images - 1

        testlowres = 8.0
        largestvector = (
            0.172
            * ((max(beamx, 2463 - beamx)) ** 2 + (max(beamy, 2527 - beamy)) ** 2) ** 0.5
        )
        testhighres = round(
            wavelength / (2 * math.sin(0.5 * math.atan(largestvector / detsamdis))), 2
        )
        lowres = 50.0
        highres = testhighres
        datafilename = prefix + "_" + str(runno) + "_????"
        mdatafilename = prefix + "_" + str(runno) + "_####.cbf"
        seconds = 5 * exp_time

        if angle_increment < 1 and not angle_increment == 0:
            seconds = 5 * exp_time / angle_increment

        # DEFINE SG/UNIT CELL
        spacegroupnumber = ""
        unitcellconstants = ""

        datapath_dir = os.path.abspath(xds_file).replace("PROCESS_DATA", "RAW_DATA")
        datapath_dir = os.path.dirname(os.path.dirname(datapath_dir)) + os.path.sep

        # CREATE XDS.INP FILE
        xds_templ = open(xds_template_path, "r").read()

        xds_templ = xds_templ.replace("###BEAMX###", str(round(beamx, 2)))
        xds_templ = xds_templ.replace("###BEAMY###", str(round(beamy, 2)))
        xds_templ = xds_templ.replace("###DETSAMDIS###", str(round(detsamdis, 2)))
        xds_templ = xds_templ.replace("###ANGLEINCREMENT###", str(angle_increment))
        xds_templ = xds_templ.replace("###WAVELENGTH###", str(wavelength))
        xds_templ = xds_templ.replace("###DATARANGESTARTNUM###", str(datarangestartnum))
        xds_templ = xds_templ.replace(
            "###DATARANGEFINISHNUM###", str(datarangefinishnum)
        )
        xds_templ = xds_templ.replace(
            "###BACKGROUNDRANGESTART###", str(backgroundrangestartnum)
        )
        xds_templ = xds_templ.replace(
            "###BACKGROUNDRANGEFINISHNUM###", str(backgroundrangefinishnum)
        )
        xds_templ = xds_templ.replace("###SPOTRANGESTARTNUM###", str(spotrangestartnum))
        xds_templ = xds_templ.replace(
            "###SPOTRANGEFINISHNUM###", str(spotrangefinishnum)
        )
        xds_templ = xds_templ.replace("###TESTLOWRES###", str(testlowres))
        xds_templ = xds_templ.replace("###TESTHIGHRES###", str(testhighres))
        xds_templ = xds_templ.replace("###LOWRES###", str(lowres))
        xds_templ = xds_templ.replace("###HIGHRES###", str(highres))
        xds_templ = xds_templ.replace("###DIRECTORY###", str(datapath_dir))
        xds_templ = xds_templ.replace("###FILENAME###", str(datafilename))
        xds_templ = xds_templ.replace("###SECONDS###", str(int(seconds)))
        xds_templ = xds_templ.replace(
            "###LYSOZYME_SPACE_GROUP_NUMBER###", str(spacegroupnumber)
        )
        xds_templ = xds_templ.replace(
            "###LYSOZYME_UNIT_CELL_CONSTANTS###", str(unitcellconstants)
        )

        open(xds_file, "w").write(xds_templ)

        # CREATE MOSFLM.DAT FILE

        mosflm_templ = open(mosflm_template_path, "r").read()

        mosflm_templ = mosflm_templ.replace("###DETSAMDIS###", str(round(detsamdis, 2)))
        mosflm_templ = mosflm_templ.replace("###BEAMX###", str(round(mbeamx, 2)))
        mosflm_templ = mosflm_templ.replace("###BEAMY###", str(round(mbeamy, 2)))
        mosflm_templ = mosflm_templ.replace("###DIRECTORY###", str(datapath_dir))
        mosflm_templ = mosflm_templ.replace("###FILENAME###", str(mdatafilename))
        mosflm_templ = mosflm_templ.replace("###WAVELENGTH###", str(wavelength))
        mosflm_templ = mosflm_templ.replace(
            "###DATARANGESTARTNUM###", str(datarangestartnum)
        )

        open(mosflm_file, "w").write(mosflm_templ)

        # CREATE EDNAPROC XML FILE
        collection_id = dc_pars["collection_id"]
        output_dir = dc_pars["ednaproc_dir"]

        ednaproc_input_file = os.path.join(
            output_dir, "EDNAprocInput_%d.xml" % collection_id
        )

        ednaproc_input = XSDataAutoprocInput()

        input_file = XSDataFile()
        path = XSDataString()
        path.setValue(xds_file)
        input_file.setPath(path)

        ednaproc_input.setInput_file(input_file)
        ednaproc_input.setData_collection_id(XSDataInteger(collection_id))

        # output_dir = XSDataFile()
        # outpath = XSDataString()
        # outpath.setValue(output_dir)
        # output_dir.setPath(path)

        # ednaproc_input.setOutput_directory( output_dir )

        ednaproc_input.exportToFile(ednaproc_input_file)

        self.input_file = ednaproc_input_file
    def create_autoproc_input(self, event, params):
        """Creates processing input xml

        :param event: processing type (after, before, image)
        :type event: str
        :param params: collection parameters
        :type params: dict
        """
        xds_input_file_wait_timeout = 20
        xds_input_file_wait_resolution = 1

        file_name_timestamp = time.strftime("%Y%m%d_%H%M%S")

        autoproc_path = params.get("xds_dir")
        autoproc_xds_filename = os.path.join(autoproc_path, "XDS.INP")
        autoproc_input_filename = os.path.join(\
            autoproc_path,
            "edna-autoproc-input-%s.xml" % \
            file_name_timestamp)
        autoproc_output_file_name = os.path.join(\
            autoproc_path,
            "edna-autoproc-results-%s.xml" % \
            file_name_timestamp)

        autoproc_input = XSDataAutoprocInput()
        autoproc_xds_file = XSDataFile()
        autoproc_xds_file.setPath(XSDataString(autoproc_xds_filename))
        autoproc_input.setInput_file(autoproc_xds_file)

        autoproc_output_file = XSDataFile()
        autoproc_output_file.setPath(XSDataString(autoproc_output_file_name))
        autoproc_input.setOutput_file(autoproc_output_file)

        autoproc_input.setData_collection_id(\
            XSDataInteger(params.get("collection_id")))
        residues_num = float(params.get("residues", 0))
        if residues_num != 0:
            autoproc_input.setNres(XSDataDouble(residues_num))
        space_group = params.get("sample_reference").get("spacegroup", "")
        if len(space_group) > 0:
            autoproc_input.setSpacegroup(XSDataString(space_group))
        unit_cell = params.get("sample_reference").get("cell", "")
        if len(unit_cell) > 0:
            autoproc_input.setUnit_cell(XSDataString(unit_cell))

        autoproc_input.setCc_half_cutoff(XSDataDouble(18.0))

        #Maybe we have to check if directory is there.
        #Maybe create dir with mxcube
        xds_appeared = False
        wait_xds_start = time.time()
        logging.debug("EMBLAutoprocessing: Waiting for XDS.INP " +\
                      "file: %s" % autoproc_xds_filename)
        while not xds_appeared and time.time() - wait_xds_start < xds_input_file_wait_timeout:
            if os.path.exists(autoproc_xds_filename) and \
               os.stat(autoproc_xds_filename).st_size > 0:
                xds_appeared = True
                logging.debug('EMBLAutoprocessing: XDS.INP file is there, size={0}'.\
                        format(os.stat(autoproc_xds_filename).st_size))
            else:
                os.system("ls %s> /dev/null"%(os.path.dirname(autoproc_path)))
                gevent.sleep(xds_input_file_wait_resolution)
        if not xds_appeared:
            logging.error("EMBLAutoprocessing: XDS.INP file ({0}) failed " +\
                          "to appear after {1} seconds".\
                    format(autoproc_xds_filename, xds_input_file_wait_timeout))
            return None, False

        autoproc_input.exportToFile(autoproc_input_filename)

        return autoproc_input_filename, True
    def create_autoproc_input(self, event, params):
        """
        Descript. :
        """
        WAIT_XDS_TIMEOUT = 20
        WAIT_XDS_RESOLUTION = 1

        file_name_timestamp = time.strftime("%Y%m%d_%H%M%S")

        autoproc_path = params.get("xds_dir")
        autoproc_xds_filename = os.path.join(autoproc_path, "XDS.INP")
        autoproc_input_filename = os.path.join(
            autoproc_path, "edna-autoproc-input-%s" % file_name_timestamp
        )
        autoproc_output_file_name = os.path.join(
            autoproc_path, "edna-autoproc-results-%s" % file_name_timestamp
        )

        autoproc_input = XSDataAutoprocInput()
        autoproc_xds_file = XSDataFile()
        autoproc_xds_file.setPath(XSDataString(autoproc_xds_filename))
        autoproc_input.setInput_file(autoproc_xds_file)

        autoproc_output_file = XSDataFile()
        autoproc_output_file.setPath(XSDataString(autoproc_output_file_name))
        autoproc_input.setOutput_file(autoproc_output_file)

        autoproc_input.setData_collection_id(XSDataInteger(params.get("collection_id")))
        residues_num = float(params.get("residues", 0))
        if residues_num != 0:
            autoproc_input.setNres(XSDataDouble(residues_num))
        space_group = params.get("sample_reference").get("spacegroup", "")
        if not isinstance(space_group, int) and len(space_group) > 0:
            autoproc_input.setSpacegroup(XSDataString(space_group))
        unit_cell = params.get("sample_reference").get("cell", "")
        if len(unit_cell) > 0:
            autoproc_input.setUnit_cell(XSDataString(unit_cell))

        autoproc_input.setCc_half_cutoff(XSDataDouble(18.0))

        # Maybe we have to check if directory is there. Maybe create dir with mxcube
        xds_appeared = False
        wait_xds_start = time.time()
        logging.info(
            "MAXIVAutoprocessing: Waiting for XDS.INP file: %s" % autoproc_xds_filename
        )
        while not xds_appeared and time.time() - wait_xds_start < WAIT_XDS_TIMEOUT:
            if (
                os.path.exists(autoproc_xds_filename)
                and os.stat(autoproc_xds_filename).st_size > 0
            ):
                xds_appeared = True
                logging.debug(
                    "MAXIVAutoprocessing: XDS.INP file is there, size={0}".format(
                        os.stat(autoproc_xds_filename).st_size
                    )
                )
            else:
                os.system("ls %s> /dev/null" % (os.path.dirname(autoproc_path)))
                gevent.sleep(WAIT_XDS_RESOLUTION)
        if not xds_appeared:
            logging.error(
                "MAXIVAutoprocessing: XDS.INP file ({0}) failed to appear after {1} seconds".format(
                    autoproc_xds_filename, WAIT_XDS_TIMEOUT
                )
            )
            return None, False

        autoproc_input.exportToFile(autoproc_input_filename)

        return autoproc_input_filename, True