Beispiel #1
0
Datei: plot.py Projekt: rolk/ert
def createPlotPage(configPanel, parent):
    configPanel.startPage("Plot")

    r = configPanel.addRow(PathChooser(parent, "Output path", "config/plot/path"))
    r.getter = lambda ert : ert.enkf.plot_config_get_path(ert.plot_config)
    r.setter = lambda ert, value : ert.enkf.plot_config_set_path(ert.plot_config, str(value))

    r = configPanel.addRow(ComboChoice(parent, ["PLPLOT", "TEXT"], "Driver", "config/plot/plot_driver"))
    r.getter = lambda ert : ert.enkf.plot_config_get_driver(ert.plot_config)
    r.setter = lambda ert, value : ert.enkf.plot_config_set_driver(ert.plot_config, str(value))

    r = configPanel.addRow(IntegerSpinner(parent, "Errorbar max", "config/plot/plot_errorbar_max", 1, 10000000))
    r.getter = lambda ert : ert.enkf.plot_config_get_errorbar_max(ert.plot_config)
    r.setter = lambda ert, value : ert.enkf.plot_config_set_errorbar_max(ert.plot_config, value)

    r = configPanel.addRow(IntegerSpinner(parent, "Width", "config/plot/width", 1, 10000))
    r.getter = lambda ert : ert.enkf.plot_config_get_width(ert.plot_config)
    r.setter = lambda ert, value : ert.enkf.plot_config_set_width(ert.plot_config, value)

    r = configPanel.addRow(IntegerSpinner(parent, "Height", "config/plot/plot_height", 1, 10000))
    r.getter = lambda ert : ert.enkf.plot_config_get_height(ert.plot_config)
    r.setter = lambda ert, value : ert.enkf.plot_config_set_height(ert.plot_config, value)

    r = configPanel.addRow(PathChooser(parent, "Image Viewer", "config/plot/image_viewer", True))
    r.getter = lambda ert : ert.enkf.plot_config_get_viewer(ert.plot_config)
    r.setter = lambda ert, value : ert.enkf.plot_config_set_viewer(ert.plot_config, str(value))

    r = configPanel.addRow(ComboChoice(parent, ["bmp", "jpg", "png", "tif"], "Image type", "config/plot/image_type"))
    r.getter = lambda ert : ert.enkf.plot_config_get_image_type(ert.plot_config)
    r.setter = lambda ert, value : ert.enkf.plot_config_set_image_type(ert.plot_config, str(value))


    configPanel.endPage()
Beispiel #2
0
    def __init__(self, parent):
        QtGui.QFrame.__init__(self, parent)

        self.setFrameShape(QtGui.QFrame.StyledPanel)
        self.setFrameShadow(QtGui.QFrame.Plain)
        self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)

        layout = QtGui.QFormLayout()
        layout.setLabelAlignment(QtCore.Qt.AlignRight)

        self.dataModel = DataModel("")

        self.input = ComboChoice(self, enums.gen_data_file_format.INPUT_TYPES, "", "config/ensemble/gen_data_param_init")
        self.modelWrap(self.input, "input_format")

        self.output = ComboChoice(self, enums.gen_data_file_format.OUTPUT_TYPES, "", "config/ensemble/gen_data_param_output")
        self.modelWrap(self.output, "output_format")

        self.template_file = PathChooser(self, "", "config/ensemble/gen_data_template_file", True , must_be_set=False)
        self.modelWrap(self.template_file, "template_file")

        self.template_key = PathChooser(self, "", "config/ensemble/gen_data_template_key", True , must_be_set=False)
        self.modelWrap(self.template_key, "template_key")

        self.init_file_fmt = PathChooser(self, "", "config/ensemble/gen_data_init_file_fmt", True , must_be_set=False)
        self.modelWrap(self.init_file_fmt, "init_file_fmt")


        self.file_generated_by_enkf = PathChooser(self, "", "config/ensemble/gen_data_file_generated_by_enkf", True, must_be_set=False)
        self.modelWrap(self.file_generated_by_enkf, "enkf_outfile")

        self.file_loaded_by_enkf = PathChooser(self, "", "config/ensemble/gen_data_file_loaded_by_enkf", True, must_be_set=False)
        self.modelWrap(self.file_loaded_by_enkf, "enkf_infile")

        self.min_std = PathChooser(self, "", "config/ensemble/gen_data_min_std", True, must_be_set=False)
        self.modelWrap(self.min_std, "min_std")

        layout.addRow("Input:", self.input)
        layout.addRow("Output:", self.output)
        layout.addRow("Template file:", self.template_file)
        layout.addRow("Template key:", self.template_key)
        layout.addRow("Init files:", self.init_file_fmt)
        layout.addRow("Include file:", self.file_generated_by_enkf)
        layout.addRow("Min. std.:", self.min_std)
        layout.addRow("File loaded by EnKF:", self.file_loaded_by_enkf)

        button = QtGui.QPushButton()
        button.setText("Reload")
        button.setMaximumWidth(70)
        self.connect(button, QtCore.SIGNAL('clicked()'), self._reload)

        layout.addRow("Reload template:", button)

        self.setLayout(layout)
Beispiel #3
0
    def __init__(self, parent):
        QtGui.QFrame.__init__(self, parent)

        self.setFrameShape(QtGui.QFrame.StyledPanel)
        self.setFrameShadow(QtGui.QFrame.Plain)
        self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)

        layout = QtGui.QFormLayout()
        layout.setLabelAlignment(QtCore.Qt.AlignRight)

        self.fieldModel = FieldModel("")

        self.fieldType = ComboChoice(self, field_type.values(), "", "config/ensemble/field_type")
        self.fieldType.setter = lambda model, value: self.typeChanged(field_type[str(value)])
        self.fieldType.getter = lambda model: str(self.fieldModel["type"])
        self.fieldType.initialize = ContentModel.emptyInitializer

        self.min = DoubleBox(self, "", "config/ensemble/field_min")
        self.modelWrap(self.min, "min")

        self.max = DoubleBox(self, "", "config/ensemble/field_max")
        self.modelWrap(self.max, "max")

        self.init = ComboChoice(self, ["None", "EXP", "EXP0", "LOG", "LN","LN0", "POW10", "ADD", "MUL", "RANDINT", "RANDFLOAT"], "", "config/ensemble/field_init")
        self.modelWrap(self.init, "init")

        self.output = ComboChoice(self, ["None", "EXP", "EXP0", "LOG", "LN","LN0", "POW10", "ADD", "MUL", "RANDINT", "RANDFLOAT"], "", "config/ensemble/field_output")
        self.modelWrap(self.output, "output")

        self.init_files = PathChooser(self, "", "config/ensemble/field_init_files", True)
        self.modelWrap(self.init_files, "init_files")

        self.file_generated_by_enkf = PathChooser(self, "", "config/ensemble/field_file_generated_by_enkf", True)
        self.modelWrap(self.file_generated_by_enkf, "enkf_outfile")

        self.file_loaded_by_enkf = PathChooser(self, "", "config/ensemble/field_file_loaded_by_enkf", True)
        self.modelWrap(self.file_loaded_by_enkf, "enkf_infile")

        self.min_std = PathChooser(self, "", "config/ensemble/field_min_std", True, must_be_set=False)
        self.modelWrap(self.min_std, "min_std")

        layout.addRow("Field type:", self.fieldType)
        layout.addRow("Include file:", self.file_generated_by_enkf) # generated by ERT
        layout.addRow("Init files:", self.init_files)
        layout.addRow("Min:", self.min)
        layout.addRow("Max:", self.max)
        layout.addRow("Init transformation:", self.init)
        layout.addRow("Output transformation:", self.output)
        layout.addRow("Min. std.:", self.min_std)
        layout.addRow("File loaded by EnKF:", self.file_loaded_by_enkf)

        self.setLayout(layout)

        self.typeChanged(field_type.ECLIPSE_RESTART)
Beispiel #4
0
    def __init__(self, parent):
        QtGui.QFrame.__init__(self, parent)

        self.setFrameShape(QtGui.QFrame.StyledPanel)
        self.setFrameShadow(QtGui.QFrame.Plain)
        self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)

        layout = QtGui.QFormLayout()
        layout.setLabelAlignment(QtCore.Qt.AlignRight)

        self.dataModel = DataModel("")

        self.input = ComboChoice(self, enums.gen_data_file_format.INPUT_TYPES, "", "config/ensemble/gen_data_param_init")
        self.modelWrap(self.input, "input_format")

        self.output = ComboChoice(self, enums.gen_data_file_format.OUTPUT_TYPES, "", "config/ensemble/gen_data_param_output")
        self.modelWrap(self.output, "output_format")

        self.template_file = PathChooser(self, "", "config/ensemble/gen_data_template_file", True , must_be_set=False)
        self.modelWrap(self.template_file, "template_file")

        self.template_key = PathChooser(self, "", "config/ensemble/gen_data_template_key", True , must_be_set=False)
        self.modelWrap(self.template_key, "template_key")

        self.init_file_fmt = PathChooser(self, "", "config/ensemble/gen_data_init_file_fmt", True , must_be_set=False)
        self.modelWrap(self.init_file_fmt, "init_file_fmt")


        self.file_generated_by_enkf = PathChooser(self, "", "config/ensemble/gen_data_file_generated_by_enkf", True, must_be_set=False)
        self.modelWrap(self.file_generated_by_enkf, "enkf_outfile")

        self.file_loaded_by_enkf = PathChooser(self, "", "config/ensemble/gen_data_file_loaded_by_enkf", True, must_be_set=False)
        self.modelWrap(self.file_loaded_by_enkf, "enkf_infile")

        self.min_std = PathChooser(self, "", "config/ensemble/gen_data_min_std", True, must_be_set=False)
        self.modelWrap(self.min_std, "min_std")

        layout.addRow("Input:", self.input)
        layout.addRow("Output:", self.output)
        layout.addRow("Template file:", self.template_file)
        layout.addRow("Template key:", self.template_key)
        layout.addRow("Init files:", self.init_file_fmt)
        layout.addRow("Include file:", self.file_generated_by_enkf)
        layout.addRow("Min. std.:", self.min_std)
        layout.addRow("File loaded by EnKF:", self.file_loaded_by_enkf)

        button = QtGui.QPushButton()
        button.setText("Reload")
        button.setMaximumWidth(70)
        self.connect(button, QtCore.SIGNAL('clicked()'), self._reload)

        layout.addRow("Reload template:", button)

        self.setLayout(layout)
Beispiel #5
0
    def createCurrentCaseCombo(self):
        """Creates the combo that enables selection of the current case"""
        self.currentCase = ComboChoice(self, ["none"], help="init/current_case_selection")
        self.currentCase.combo.setMinimumWidth(150)

        def initialize_cases(ert):
            ert.prototype("long enkf_main_get_fs(long)")

            self.currentCase.updateList(self.get_case_list(ert))

        self.currentCase.initialize = initialize_cases

        def get_current_case(ert):
            fs = ert.enkf.enkf_main_get_fs(ert.main)
            tmp = self.get_case_list(ert)
            currentCase = tmp[0] #ert.enkf.enkf_fs_get_read_dir(fs)
            #print "The selected case is: " + currentCase
            return currentCase

        self.currentCase.getter = get_current_case

        @may_take_a_long_time
        def select_case(ert, case):
            case = str(case)
            if not case == "":
                ert.enkf.enkf_main_select_case( ert.main , case )
                self.casesUpdated()

        self.currentCase.setter = select_case

        return self.currentCase
Beispiel #6
0
    def createCurrentCaseCombo(self):
        """Creates the combo that enables selection of the current case"""
        self.currentCase = ComboChoice(self, ["none"], help="init/current_case_selection")
        self.currentCase.combo.setMinimumWidth(150)

        def initialize_cases(ert):
            self.currentCase.updateList(self.get_case_list(ert))

        self.currentCase.initialize = initialize_cases

        def get_current_case(ert):
            fs = ert.main.get_fs
            tmp = self.get_case_list(ert)
            currentCase = ert.main.get_current_fs
            print "The selected case is: " + currentCase
            return currentCase

        self.currentCase.getter = get_current_case

        @may_take_a_long_time
        def select_case(ert, case):
            case = str(case)
            if not case == "":
                ert.main.user_select_fs( case )
                self.casesUpdated()

        self.currentCase.setter = select_case

        return self.currentCase
Beispiel #7
0
    def __init__(self, parent):
        QtGui.QFrame.__init__(self, parent)

        self.setFrameShape(QtGui.QFrame.StyledPanel)
        self.setFrameShadow(QtGui.QFrame.Plain)
        self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)

        layout = QtGui.QFormLayout()
        layout.setLabelAlignment(QtCore.Qt.AlignRight)

        self.fieldModel = FieldModel("")

        self.fieldType = ComboChoice(self, field_type.values(), "", "config/ensemble/field_type")
        self.fieldType.setter = lambda model, value: self.typeChanged(field_type[str(value)])
        self.fieldType.getter = lambda model: str(self.fieldModel["type"])
        self.fieldType.initialize = ContentModel.emptyInitializer

        self.min = DoubleBox(self, "", "config/ensemble/field_min")
        self.modelWrap(self.min, "min")

        self.max = DoubleBox(self, "", "config/ensemble/field_max")
        self.modelWrap(self.max, "max")

        self.init = ComboChoice(self, ["None", "EXP", "LOG", "POW10", "ADD", "MUL", "RANDINT", "RANDFLOAT"], "", "config/ensemble/field_init")
        self.modelWrap(self.init, "init")

        self.output = ComboChoice(self, ["None", "EXP", "LOG", "POW10", "ADD", "MUL", "RANDINT", "RANDFLOAT"], "", "config/ensemble/field_output")
        self.modelWrap(self.output, "output")

        self.init_files = PathChooser(self, "", "config/ensemble/field_init_files", True)
        self.modelWrap(self.init_files, "init_files")

        self.file_generated_by_enkf = PathChooser(self, "", "config/ensemble/field_file_generated_by_enkf", True)
        self.modelWrap(self.file_generated_by_enkf, "enkf_outfile")

        self.file_loaded_by_enkf = PathChooser(self, "", "config/ensemble/field_file_loaded_by_enkf", True)
        self.modelWrap(self.file_loaded_by_enkf, "enkf_infile")

        self.min_std = PathChooser(self, "", "config/ensemble/field_min_std", True, must_be_set=False)
        self.modelWrap(self.min_std, "min_std")

        layout.addRow("Field type:", self.fieldType)
        layout.addRow("Include file:", self.file_generated_by_enkf) # generated by ERT
        layout.addRow("Init files:", self.init_files)
        layout.addRow("Min:", self.min)
        layout.addRow("Max:", self.max)
        layout.addRow("Init transformation:", self.init)
        layout.addRow("Output transformation:", self.output)
        layout.addRow("Min. std.:", self.min_std)
        layout.addRow("File loaded by EnKF:", self.file_loaded_by_enkf)

        self.setLayout(layout)

        self.typeChanged(field_type.ECLIPSE_RESTART)
Beispiel #8
0
def createObservationsPage(configPanel, parent):
    configPanel.startPage("Observations")

    r = configPanel.addRow(
        ComboChoice(parent, history_source_type.values(), "History source",
                    "config/observations/history_source"))

    def get_history_source(ert):
        history_source = ert.enkf.model_config_get_history_source(
            ert.model_config)
        return history_source_type.resolveValue(history_source)

    r.getter = get_history_source

    def set_history_source(ert, value):
        history_source = history_source_type.resolveName(str(value))
        ert.enkf.model_config_get_history_source(ert.model_config,
                                                 history_source.value())

    r.setter = set_history_source

    r = configPanel.addRow(
        PathChooser(parent, "Observations config",
                    "config/observations/obs_config", True))

    def get_obs(ert):
        obs = ert.enkf.enkf_main_get_obs(ert.main)
        return ert.enkf.enkf_obs_get_config_file(obs)

    r.getter = get_obs

    def set_obs(ert, value):
        ert.enkf.enkf_main_load_obs(ert.main, str(value))

    r.setter = set_obs

    r = configPanel.addRow(
        ReloadButton(parent, "Reload Observations",
                     "config/observations/reload_observation", "Reload"))
    r.getter = lambda ert: ert.enkf.enkf_main_reload_obs(ert.main)

    configPanel.endPage()
Beispiel #9
0
class DataPanel(QtGui.QFrame):

    def __init__(self, parent):
        QtGui.QFrame.__init__(self, parent)

        self.setFrameShape(QtGui.QFrame.StyledPanel)
        self.setFrameShadow(QtGui.QFrame.Plain)
        self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)

        layout = QtGui.QFormLayout()
        layout.setLabelAlignment(QtCore.Qt.AlignRight)

        self.dataModel = DataModel("")

        self.input = ComboChoice(self, enums.gen_data_file_format.INPUT_TYPES, "", "config/ensemble/gen_data_param_init")
        self.modelWrap(self.input, "input_format")

        self.output = ComboChoice(self, enums.gen_data_file_format.OUTPUT_TYPES, "", "config/ensemble/gen_data_param_output")
        self.modelWrap(self.output, "output_format")

        self.template_file = PathChooser(self, "", "config/ensemble/gen_data_template_file", True , must_be_set=False)
        self.modelWrap(self.template_file, "template_file")

        self.template_key = PathChooser(self, "", "config/ensemble/gen_data_template_key", True , must_be_set=False)
        self.modelWrap(self.template_key, "template_key")

        self.init_file_fmt = PathChooser(self, "", "config/ensemble/gen_data_init_file_fmt", True , must_be_set=False)
        self.modelWrap(self.init_file_fmt, "init_file_fmt")


        self.file_generated_by_enkf = PathChooser(self, "", "config/ensemble/gen_data_file_generated_by_enkf", True, must_be_set=False)
        self.modelWrap(self.file_generated_by_enkf, "enkf_outfile")

        self.file_loaded_by_enkf = PathChooser(self, "", "config/ensemble/gen_data_file_loaded_by_enkf", True, must_be_set=False)
        self.modelWrap(self.file_loaded_by_enkf, "enkf_infile")

        self.min_std = PathChooser(self, "", "config/ensemble/gen_data_min_std", True, must_be_set=False)
        self.modelWrap(self.min_std, "min_std")

        layout.addRow("Input:", self.input)
        layout.addRow("Output:", self.output)
        layout.addRow("Template file:", self.template_file)
        layout.addRow("Template key:", self.template_key)
        layout.addRow("Init files:", self.init_file_fmt)
        layout.addRow("Include file:", self.file_generated_by_enkf)
        layout.addRow("Min. std.:", self.min_std)
        layout.addRow("File loaded by EnKF:", self.file_loaded_by_enkf)

        button = QtGui.QPushButton()
        button.setText("Reload")
        button.setMaximumWidth(70)
        self.connect(button, QtCore.SIGNAL('clicked()'), self._reload)

        layout.addRow("Reload template:", button)

        self.setLayout(layout)

    def _reload(self):
        self.dataModel.emitUpdate()

    def modelWrap(self, widget, attribute):
        widget.initialize = ert_gui.widgets.helpedwidget.ContentModel.emptyInitializer
        widget.setter = lambda model, value: self.dataModel.set(attribute, value)
        widget.getter = lambda model: self.dataModel[attribute]

    def setDataModel(self, dataModel):
        self.dataModel = dataModel

        self.input.fetchContent()
        self.output.fetchContent()
        self.template_file.fetchContent()
        self.template_key.fetchContent()
        self.init_file_fmt.fetchContent()
        self.file_generated_by_enkf.fetchContent()
        self.file_loaded_by_enkf.fetchContent()
        self.min_std.fetchContent()
Beispiel #10
0
class InitPanel(QtGui.QFrame):
    
    def __init__(self, parent):
        QtGui.QFrame.__init__(self, parent)
        self.setFrameShape(QtGui.QFrame.Panel)
        self.setFrameShadow(QtGui.QFrame.Raised)

        initPanelLayout = QtGui.QVBoxLayout()
        self.setLayout(initPanelLayout)

        casePanel = QtGui.QFormLayout()


        def get_case_list(ert):
            fs = ert.enkf.enkf_main_get_fs(ert.main)
            caseList = ["default"] #ert.enkf.enkf_fs_alloc_dirlist(fs)

            list = caseList #ert.getStringList(caseList)
            #ert.freeStringList(caseList)
            return list

        self.get_case_list = get_case_list # convenience: used by several functions


        casePanel.addRow("Current case:", self.createCurrentCaseCombo())
        casePanel.addRow("Cases:", self.createCaseList())


        parametersPanelLayout = QtGui.QHBoxLayout()
        parametersPanelLayout.addWidget(ParametersAndMembers(self))

        initPanelLayout.addLayout(casePanel)
        initPanelLayout.addWidget(createSeparator())
        initPanelLayout.addLayout(parametersPanelLayout)

    def casesUpdated(self):
        """Emit to all listeners that the a new case has been added or the current case has changed"""
        self.currentCase.modelEmit("casesUpdated()")

    def createCaseList(self):
        """Creates a list that enables the creation of new cases. Removal has been disabled."""
        cases = KeywordList(self, "", "init/case_list")

        cases.newKeywordPopup = lambda list : ValidatedDialog(cases, "New case", "Enter name of new case:", list).showAndTell()
        cases.addRemoveWidget.enableRemoveButton(False)  #todo: add support for removal
        cases.list.setMaximumHeight(150)

        cases.initialize = lambda ert : [ert.prototype("long enkf_main_get_fs(long)"),
                                         ert.prototype("void enkf_main_select_case(long , char*)"), 
                                         ert.prototype("long enkf_fs_alloc_dirlist(long)")]

        def create_case(ert, cases):
            fs = ert.enkf.enkf_main_get_fs(ert.main)

            for case in cases:
                if not ert.enkf.enkf_fs_has_dir(fs, case):
                    ert.enkf.enkf_fs_select_write_dir(fs, case, True)
                    break

            self.currentCase.updateList(self.get_case_list(ert))
            self.currentCase.fetchContent()
            self.casesUpdated()

        cases.getter = self.get_case_list
        cases.setter = create_case

        return cases


    def createCurrentCaseCombo(self):
        """Creates the combo that enables selection of the current case"""
        self.currentCase = ComboChoice(self, ["none"], help="init/current_case_selection")
        self.currentCase.combo.setMinimumWidth(150)

        def initialize_cases(ert):
            ert.prototype("long enkf_main_get_fs(long)")

            self.currentCase.updateList(self.get_case_list(ert))

        self.currentCase.initialize = initialize_cases

        def get_current_case(ert):
            fs = ert.enkf.enkf_main_get_fs(ert.main)
            tmp = self.get_case_list(ert)
            currentCase = tmp[0] #ert.enkf.enkf_fs_get_read_dir(fs)
            #print "The selected case is: " + currentCase
            return currentCase

        self.currentCase.getter = get_current_case

        @may_take_a_long_time
        def select_case(ert, case):
            case = str(case)
            if not case == "":
                ert.enkf.enkf_main_select_case( ert.main , case )
                self.casesUpdated()

        self.currentCase.setter = select_case

        return self.currentCase
Beispiel #11
0
def createAnalysisPage(configPanel, parent):
    configPanel.startPage("Analysis")

    r = configPanel.addRow(CheckBox(parent, "ENKF rerun", "config/analysis/enkf_rerun", "Perform rerun"))
    r.getter = lambda ert : ert.enkf.analysis_config_get_rerun(ert.analysis_config)
    r.setter = lambda ert, value : ert.enkf.analysis_config_set_rerun(ert.analysis_config, value)

    r = configPanel.addRow(IntegerSpinner(parent, "Rerun start", "config/analysis/rerun_start",  0, 100000))
    r.getter = lambda ert : ert.enkf.analysis_config_get_rerun_start(ert.analysis_config)
    r.setter = lambda ert, value : ert.enkf.analysis_config_set_rerun_start(ert.analysis_config, value)

    r = configPanel.addRow(PathChooser(parent, "ENKF schedule file", "config/analysis/enkf_sched_file"))
    r.getter = lambda ert : ert.enkf.model_config_get_enkf_sched_file(ert.enkf.enkf_main_get_model_config(ert.main))
    r.setter = lambda ert, value : ert.enkf.model_config_set_enkf_sched_file(ert.enkf.enkf_main_get_model_config(ert.main), str(value))

    r = configPanel.addRow(ert_gui.widgets.tablewidgets.KeywordList(parent, "Local config", "config/analysis/local_config"))
    r.newKeywordPopup = lambda list : QtGui.QFileDialog.getOpenFileName(r, "Select a path", "")

    def get_local_config_files(ert):
        local_config = ert.enkf.enkf_main_get_local_config(ert.main)
        config_files_pointer = ert.enkf.local_config_get_config_files(local_config)
        return ert.getStringList(config_files_pointer)

    r.getter = get_local_config_files

    def add_config_file(ert, value):
        local_config = ert.enkf.enkf_main_get_local_config(ert.main)
        ert.enkf.local_config_clear_config_files(local_config)

        for file in value:
            ert.enkf.local_config_add_config_file(local_config, file)

    r.setter = add_config_file

    r = configPanel.addRow(PathChooser(parent, "Update log", "config/analysis/update_log"))
    r.getter = lambda ert : ert.enkf.analysis_config_get_log_path(ert.analysis_config)
    r.setter = lambda ert, value : ert.enkf.analysis_config_set_log_path(ert.analysis_config, str(value))


    configPanel.startGroup("EnKF")

    r = configPanel.addRow(DoubleSpinner(parent, "Alpha", "config/analysis/enkf_alpha", 0, 100000, 2))
    r.getter = lambda ert : ert.enkf.analysis_config_get_alpha(ert.analysis_config)
    r.setter = lambda ert, value : ert.enkf.analysis_config_set_alpha(ert.analysis_config, value)

    r = configPanel.addRow(CheckBox(parent, "Merge Observations", "config/analysis/enkf_merge_observations", "Perform merge"))
    r.getter = lambda ert : ert.enkf.analysis_config_get_merge_observations(ert.analysis_config)
    r.setter = lambda ert, value : ert.enkf.analysis_config_set_merge_observations(ert.analysis_config, value)


    enkf_mode_type = {"ENKF_STANDARD" : 10, "ENKF_SQRT" : 20}
    enkf_mode_type_inverted = {10 : "ENKF_STANDARD" , 20 : "ENKF_SQRT"}
    r = configPanel.addRow(ComboChoice(parent, enkf_mode_type.keys(), "Mode", "config/analysis/enkf_mode"))
    r.getter = lambda ert : enkf_mode_type_inverted[ert.enkf.analysis_config_get_enkf_mode(ert.analysis_config)]
    r.setter = lambda ert, value : ert.enkf.analysis_config_set_enkf_mode(ert.analysis_config, enkf_mode_type[str(value)])


    r = configPanel.addRow(DoubleSpinner(parent, "Truncation", "config/analysis/enkf_truncation", 0, 1, 2))
    r.getter = lambda ert : ert.enkf.analysis_config_get_truncation(ert.analysis_config)
    r.setter = lambda ert, value : ert.enkf.analysis_config_set_truncation(ert.analysis_config, value)



    configPanel.endGroup()
    configPanel.endPage()
Beispiel #12
0
def createQueueSystemPage(configPanel, parent):
    configPanel.startPage("Queue System")

    r = configPanel.addRow(
        ComboChoice(parent, ["LSF", "RSH", "LOCAL"], "Queue system",
                    "config/queue_system/queue_system"))
    r.getter = lambda ert: ert.enkf.site_config_get_queue_name(ert.site_config)
    r.setter = lambda ert, value: ert.enkf.site_config_set_job_queue(
        ert.site_config, str(value))

    internalPanel = ConfigPanel(parent)

    internalPanel.startPage("LSF")

    r = internalPanel.addRow(
        StringBox(parent, "LSF Queue", "config/queue_system/lsf_queue"))
    r.getter = lambda ert: ert.enkf.site_config_get_lsf_queue(ert.site_config)
    r.setter = lambda ert, value: ert.enkf.site_config_set_lsf_queue(
        ert.site_config, str(value))

    r = internalPanel.addRow(
        IntegerSpinner(parent, "Max running",
                       "config/queue_system/max_running_lsf", 1, 1000))
    r.getter = lambda ert: ert.enkf.site_config_get_max_running_lsf(
        ert.site_config)
    r.setter = lambda ert, value: ert.enkf.site_config_set_max_running_lsf(
        ert.site_config, value)

    r = internalPanel.addRow(
        StringBox(parent, "Resources", "config/queue_system/lsf_resources"))
    r.getter = lambda ert: ert.enkf.site_config_get_lsf_request(ert.site_config
                                                                )
    r.setter = lambda ert, value: ert.enkf.site_config_set_lsf_request(
        ert.site_config, str(value))

    internalPanel.endPage()

    internalPanel.startPage("RSH")

    r = internalPanel.addRow(
        PathChooser(parent,
                    "Command",
                    "config/queue_system/rsh_command",
                    show_files=True,
                    must_exist=True,
                    is_executable_file=True))
    r.getter = lambda ert: ert.enkf.site_config_get_rsh_command(ert.site_config
                                                                )
    r.setter = lambda ert, value: ert.enkf.site_config_set_rsh_command(
        ert.site_config, str(value))

    r = internalPanel.addRow(
        IntegerSpinner(parent, "Max running",
                       "config/queue_system/max_running_rsh", 1, 1000))
    r.getter = lambda ert: ert.enkf.site_config_get_max_running_rsh(
        ert.site_config)
    r.setter = lambda ert, value: ert.enkf.site_config_set_max_running_rsh(
        ert.site_config, value)

    r = internalPanel.addRow(
        KeywordTable(parent, "Host List", "config/queue_system/rsh_host_list",
                     "Host", "Number of jobs"))
    r.getter = lambda ert: ert.getHash(
        ert.enkf.site_config_get_rsh_host_list(ert.site_config), True)

    def add_rsh_host(ert, listOfKeywords):
        ert.enkf.site_config_clear_rsh_host_list(ert.site_config)

        for keyword in listOfKeywords:
            if keyword[1].strip() == "":
                max_running = 1
            else:
                max_running = int(keyword[1])

            ert.enkf.site_config_add_rsh_host(ert.site_config, keyword[0],
                                              max_running)

    r.setter = add_rsh_host

    internalPanel.endPage()

    internalPanel.startPage("LOCAL")

    r = internalPanel.addRow(
        IntegerSpinner(parent, "Max running",
                       "config/queue_system/max_running_local", 1, 1000))
    r.getter = lambda ert: ert.enkf.site_config_get_max_running_local(
        ert.site_config)
    r.setter = lambda ert, value: ert.enkf.site_config_set_max_running_local(
        ert.site_config, value)

    internalPanel.endPage()
    configPanel.addRow(internalPanel)

    configPanel.endPage()
Beispiel #13
0
class DataPanel(QtGui.QFrame):

    def __init__(self, parent):
        QtGui.QFrame.__init__(self, parent)

        self.setFrameShape(QtGui.QFrame.StyledPanel)
        self.setFrameShadow(QtGui.QFrame.Plain)
        self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)

        layout = QtGui.QFormLayout()
        layout.setLabelAlignment(QtCore.Qt.AlignRight)

        self.dataModel = DataModel("")

        self.input = ComboChoice(self, enums.gen_data_file_format.INPUT_TYPES, "", "config/ensemble/gen_data_param_init")
        self.modelWrap(self.input, "input_format")

        self.output = ComboChoice(self, enums.gen_data_file_format.OUTPUT_TYPES, "", "config/ensemble/gen_data_param_output")
        self.modelWrap(self.output, "output_format")

        self.template_file = PathChooser(self, "", "config/ensemble/gen_data_template_file", True , must_be_set=False)
        self.modelWrap(self.template_file, "template_file")

        self.template_key = PathChooser(self, "", "config/ensemble/gen_data_template_key", True , must_be_set=False)
        self.modelWrap(self.template_key, "template_key")

        self.init_file_fmt = PathChooser(self, "", "config/ensemble/gen_data_init_file_fmt", True , must_be_set=False)
        self.modelWrap(self.init_file_fmt, "init_file_fmt")


        self.file_generated_by_enkf = PathChooser(self, "", "config/ensemble/gen_data_file_generated_by_enkf", True, must_be_set=False)
        self.modelWrap(self.file_generated_by_enkf, "enkf_outfile")

        self.file_loaded_by_enkf = PathChooser(self, "", "config/ensemble/gen_data_file_loaded_by_enkf", True, must_be_set=False)
        self.modelWrap(self.file_loaded_by_enkf, "enkf_infile")

        self.min_std = PathChooser(self, "", "config/ensemble/gen_data_min_std", True, must_be_set=False)
        self.modelWrap(self.min_std, "min_std")

        layout.addRow("Input:", self.input)
        layout.addRow("Output:", self.output)
        layout.addRow("Template file:", self.template_file)
        layout.addRow("Template key:", self.template_key)
        layout.addRow("Init files:", self.init_file_fmt)
        layout.addRow("Include file:", self.file_generated_by_enkf)
        layout.addRow("Min. std.:", self.min_std)
        layout.addRow("File loaded by EnKF:", self.file_loaded_by_enkf)

        button = QtGui.QPushButton()
        button.setText("Reload")
        button.setMaximumWidth(70)
        self.connect(button, QtCore.SIGNAL('clicked()'), self._reload)

        layout.addRow("Reload template:", button)

        self.setLayout(layout)

    def _reload(self):
        self.dataModel.emitUpdate()

    def modelWrap(self, widget, attribute):
        widget.initialize = ert_gui.widgets.helpedwidget.ContentModel.emptyInitializer
        widget.setter = lambda model, value: self.dataModel.set(attribute, value)
        widget.getter = lambda model: self.dataModel[attribute]

    def setDataModel(self, dataModel):
        self.dataModel = dataModel

        self.input.fetchContent()
        self.output.fetchContent()
        self.template_file.fetchContent()
        self.template_key.fetchContent()
        self.init_file_fmt.fetchContent()
        self.file_generated_by_enkf.fetchContent()
        self.file_loaded_by_enkf.fetchContent()
        self.min_std.fetchContent()