Example #1
0
    def _prepare_and_get_arguments_list(self, path_to_out_run_dir_root,
                                        dir_name):
        path_to_run_input = os.path.join(TestOutput.path_to_input, dir_name)
        path_to_run_output = os.path.join(path_to_out_run_dir_root, dir_name)
        Utilities.iotools.create_dirs(path_to_run_output)

        args_dict = {}
        args_dict["--mad"] = madxrunner.get_sys_dependent_path_to_mad_x()
        args_dict[
            "--bbsource"] = Utilities.iotools.get_absolute_path_to_betabeat_root(
            )
        args_dict["--path"] = path_to_run_input
        args_dict["--save"] = path_to_run_output
        args_dict["--twiss"] = os.path.join(path_to_run_input, "model",
                                            "twiss_elements.dat")
        # model is presumed to be in subdir model of the run directory

        args_list = []
        for key in args_dict:
            args_list.append(key + " " + args_dict[key])

        args_list.append(
            self._get_args_from_file_in_run_dir(path_to_run_input))

        return args_list
Example #2
0
    def _run_Segment_by_Segment(self, output_path, sequence):
        print "Running Segment by Segment..."
        madx_bin_path = madxrunner.get_sys_dependent_path_to_mad_x()
        bb_source_path = iotools.get_absolute_path_to_betabeat_root()
        sbs_output_path = os.path.join(output_path, "sbs")
        twiss_model_path = os.path.join(output_path, "twiss_elements.dat")

        ip_segments = ""
        for ip in IP_SEGMENTS_TO_RUN:
            beam = sequence.replace("LHC", "")
            ip_segments += IP_SEGMENT_START + str(
                ip) + "." + beam + "," + IP_SEGMENT_END + str(
                    ip) + "." + beam + ",IP" + str(ip) + ","
        ip_segments = ip_segments[:-1]  # Remove last comma
        self.assertTrue(len(ip_segments) > 0, "Cannot create segment list.")

        call_command = sys.executable + " " + os.path.abspath(self._path_to_sbs) + \
        " --path=" + output_path + \
        " --save=" + sbs_output_path + \
        " --twiss=" + twiss_model_path + \
        " --mad=" + madx_bin_path + \
        " --bbsource=" + bb_source_path + \
        " --accel=" + sequence + " --start=" + ip_segments

        self._run_outer_process(call_command, "Segment by Segment")
Example #3
0
    def _run_Segment_by_Segment(self, output_path, sequence):
        print "Running Segment by Segment..."
        madx_bin_path = madxrunner.get_sys_dependent_path_to_mad_x()
        bb_source_path = iotools.get_absolute_path_to_betabeat_root()
        sbs_output_path = os.path.join(output_path, "sbs")
        twiss_model_path = os.path.join(output_path, "twiss_elements.dat")

        ip_segments = ""
        for ip in IP_SEGMENTS_TO_RUN:
            beam = sequence.replace("LHC", "")
            ip_segments += (
                IP_SEGMENT_START
                + str(ip)
                + "."
                + beam
                + ","
                + IP_SEGMENT_END
                + str(ip)
                + "."
                + beam
                + ",IP"
                + str(ip)
                + ","
            )
        ip_segments = ip_segments[:-1]  # Remove last comma
        self.assertTrue(len(ip_segments) > 0, "Cannot create segment list.")

        call_command = (
            sys.executable
            + " "
            + os.path.abspath(self._path_to_sbs)
            + " --path="
            + output_path
            + " --save="
            + sbs_output_path
            + " --twiss="
            + twiss_model_path
            + " --mad="
            + madx_bin_path
            + " --bbsource="
            + bb_source_path
            + " --accel="
            + sequence
            + " --start="
            + ip_segments
        )

        self._run_outer_process(call_command, "Segment by Segment")
Example #4
0
    def _prepare_and_get_arguments_list(self, path_to_out_run_dir_root, dir_name):
        path_to_run_input = os.path.join(TestOutput.path_to_input, dir_name)
        path_to_run_output = os.path.join(path_to_out_run_dir_root, dir_name)
        Utilities.iotools.create_dirs(path_to_run_output)

        args_dict = {}
        args_dict["--mad"] = madxrunner.get_sys_dependent_path_to_mad_x()
        args_dict["--bbsource"] = Utilities.iotools.get_absolute_path_to_betabeat_root()
        args_dict["--path"] = path_to_run_input
        args_dict["--save"] = path_to_run_output
        args_dict["--twiss"] = os.path.join(path_to_run_input, "model", "twiss_elements.dat")
        # model is presumed to be in subdir model of the run directory

        args_list = []
        for key in args_dict:
            args_list.append(key + " " + args_dict[key])

        args_list.append(self._get_args_from_file_in_run_dir(path_to_run_input))

        return args_list