Beispiel #1
0
    def __init__(self, edilist=None, mt_objs=None, outdir=None, ptol=0.05):
        """ constructor
        :param edilist: a list of edifiles with full path, for read-only
        :param outdir:  computed result to be stored in outdir
        :param ptol: period tolerance considered as equal, default 0.05 means 5 percent
        this param controls what freqs/periods are grouped together:
        10pct may result more double counting of freq/period data than 5pct.
        eg: E:/Data/MT_Datasets/WenPingJiang_EDI 18528 rows vs 14654 rows
        """

        #self._logger = MtPyLog.get_mtpy_logger(self.__class__.__name__)  # will be EdiCollection
        self._logger = MtPyLog.get_mtpy_logger(
            __name__)  # __name__ will be  path.to.module OR __main__
        self._logger.setLevel(INFO)

        if edilist is not None:
            self.edifiles = edilist
            self._logger.info("number of edi files in this collection: %s",
                              len(self.edifiles))
        elif mt_objs is not None:
            self.edifiles = [mt_obj.fn for mt_obj in mt_objs]
        assert len(self.edifiles) > 0

        self.num_of_edifiles = len(self.edifiles)  # number of stations
        print("number of stations/edifiles = %s" % self.num_of_edifiles)

        self.ptol = ptol

        if edilist is not None:
            # if edilist is provided, always create MT objects from the list
            self._logger.debug("constructing MT objects from edi files")
            self.mt_obj_list = [mt.MT(edi) for edi in self.edifiles]
        elif mt_objs is not None:
            # use the supplied mt_objs
            self.mt_obj_list = list(mt_objs)
        else:
            self._logger.error("None Edi file set")

        # get all frequencies from all edi files
        self.all_frequencies = None
        self.mt_periods = None
        self.all_unique_periods = self._get_all_periods()

        self.geopdf = self.create_mt_station_gdf()

        self.bound_box_dict = self.get_bounding_box()  # in orginal projection

        # ensure that outdir is created if not exists.
        if outdir is None:
            #raise Exception("Error: OutputDir is not specified!!!")
            pass
        elif not os.path.exists(outdir):
            os.mkdir(outdir)

        self.outdir = outdir

        return
Beispiel #2
0
    def __init__(self, edilist=None, mt_objs=None, outdir=None, ptol=0.05):
        """
        constructor
        """

        #self._logger = MtPyLog.get_mtpy_logger(self.__class__.__name__)  # will be EdiCollection
        self._logger = MtPyLog.get_mtpy_logger(
            __name__)  # __name__ will be  path.to.module OR __main__
        self._logger.setLevel(INFO)

        if edilist is not None:
            self.edifiles = edilist
            self._logger.info("number of edi files in this collection: %s",
                              len(self.edifiles))
        elif mt_objs is not None:
            self.edifiles = [mt_obj.fn for mt_obj in mt_objs]
        assert len(self.edifiles) > 0

        self.num_of_edifiles = len(self.edifiles)  # number of stations
        print("number of stations/edifiles = %s" % self.num_of_edifiles)

        self.ptol = ptol

        if edilist is not None:
            # if edilist is provided, always create MT objects from the list
            self._logger.debug("constructing MT objects from edi files")
            self.mt_obj_list = [mt.MT(edi) for edi in self.edifiles]
        elif mt_objs is not None:
            # use the supplied mt_objs
            self.mt_obj_list = list(mt_objs)
        else:
            self._logger.error("None Edi file set")

        # get all frequencies from all edi files
        self.all_frequencies = None
        self.mt_periods = None
        self.all_unique_periods = self._get_all_periods()

        self.geopdf = self.create_mt_station_gdf()

        self.bound_box_dict = self.get_bounding_box()  # in orginal projection

        # ensure that outdir is created if not exists.
        if outdir is None:
            #raise Exception("Error: OutputDir is not specified!!!")
            pass
        elif not os.path.exists(outdir):
            os.mkdir(outdir)

        self.outdir = outdir

        return
Beispiel #3
0
    def __init__(self, parent, file_handler, selected_files):
        """

        :param parent:
        :type parent: StartQt4
        :param file_handler:
        :type file_handler: FileHandler
        :param selected_files:
        :type selected_files: set
        """
        QWidget.__init__(self, parent)
        self._parent = parent
        self._logger = MtPyLog.get_mtpy_logger(self.__class__.__name__)
        self.file_handler = file_handler
        self.selected_stations = selected_files
        self._current_plot = None
        self.ui = Ui_PlotOption()
        self.ui.setupUi(self)

        # hide cancel button
        self.ui.pushButton_cancel.hide()

        # populate dropdown menu
        self.plotOptions = []

        # print VisualizationBase.__subclasses__()

        for child in VisualizationBase.__subclasses__():
            name = child.plot_name()
            if name not in self.plotOptions:
                self.plotOptions.append(child)
                self.ui.comboBoxSelect_Plot.addItem(name)
            else:
                raise Exception("Duplicated Plot Name: %s in class %s" % (name, child.__name__))

        # busy overlay
        self._busy_overlay = BusyOverlay(self)
        self._busy_overlay.hide()

        # connect signals
        self.ui.comboBoxSelect_Plot.currentIndexChanged.connect(self._selection_changed)
        self.ui.pushButton_plot.clicked.connect(self._create_plot)
        self.ui.pushButton_cancel.clicked.connect(self._cancel_plot)

        if VisualizationBase.__subclasses__():
            self.ui.comboBoxSelect_Plot.setEnabled(True)
            self.ui.comboBoxSelect_Plot.setCurrentIndex(0)
        else:
            self.ui.comboBoxSelect_Plot.setEnabled(False)
Beispiel #4
0
    def __init__(self, parent, edi_list, select_period_kwargs, data_kwargs, mesh_kwargs, topo_args, covariance_kwargs,
                 show=False):
        QtCore.QThread.__init__(self, parent)
        self._logger = MtPyLog.get_mtpy_logger(self.__class__.__name__)

        self._edi_list = edi_list
        self._select_period_kwargs = select_period_kwargs
        self._data_kwargs = data_kwargs
        self._mesh_kwagrs = mesh_kwargs
        self._topo_args = topo_args
        self._covariance_kwargs = covariance_kwargs

        self.output_dir = self._data_kwargs['save_path']

        self.show = show
Beispiel #5
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self._logger = MtPyLog.get_mtpy_logger(self.__class__.__name__)
        self._file_handler = FileHandler()
        self._is_file_dialog_opened = False

        self.ui = Ui_SmartMT_MainWindow()

        # init gui
        self.ui.setupUi(self)
        self.setup_menu()

        # export dialogs
        self._export_dialog = ExportDialog(self)
        self._export_dialog_modem = ExportDialogModEm(self)

        # set station viewer
        self._station_viewer = StationViewer(self,
                                             file_handler=self._file_handler)
        self._station_viewer.ui.pushButton_plot.clicked.connect(
            self.plot_selected_station)
        self._station_viewer.selection_changed.connect(
            self._selected_station_changed)
        self.ui.stackedWidget.addWidget(self._station_viewer)

        # set plot option widget
        self._plot_option = PlotOption(self, self._file_handler,
                                       self._station_viewer.selected_stations)
        self._plot_option.ui.pushButton_back.clicked.connect(
            lambda x: self.ui.stackedWidget.setCurrentWidget(self.
                                                             _station_viewer))
        self._station_viewer.selection_changed.connect(
            self._plot_option.data_changed)
        self.ui.stackedWidget.addWidget(self._plot_option)

        self.ui.stackedWidget.setCurrentWidget(self._station_viewer)

        self._subwindow_counter = 0

        self._station_summary = None

        self._progress_bar = ProgressBar(title='Loading files...')
        self.subwindows = {}
        # enable export if the activated subwindow is a image window
        self.ui.mdiArea.subWindowActivated.connect(self._subwindow_activated)
        self.setWindowState(QtCore.Qt.WindowMaximized)
Beispiel #6
0
    def __init__(self, parent):
        """
        set up ui and attributes here
        this function sets up the empty gui area for adding gui components that defines information necessary
        for visualization
        :param parent:
        """
        QtCore.QThread.__init__(self, parent)
        self._parent = parent
        self._mt_objs = None
        self._fig = None
        self._plotting_object = None
        self._logger = MtPyLog.get_mtpy_logger(self.__class__.__name__)
        self._parameter_ui = PlotParameter(self._parent)

        # add plot common setting gui
        # self._common_ui = CommonSettings(self._parameter_ui)
        # apply default common settings
        self.default_common_settings()
Beispiel #7
0
    def __init__(self, grid_dimensions=None, **kwargs):
        self._logger = MtPyLog.get_mtpy_logger(self.__class__.__name__)

        self.grid_dimensions = grid_dimensions
        self.smoothing_east = 0.3
        self.smoothing_north = 0.3
        self.smoothing_z = 0.3
        self.smoothing_num = 1

        self.exception_list = []
        self.mask_arr = None

        self.save_path = os.getcwd()
        self.cov_fn_basename = 'covariance.cov'

        self.cov_fn = None

        self._header_str = '\n'.join([
            '+{0}+'.format('-' * 77),
            '| This file defines model covariance for a recursive autoregression scheme.   |',
            '| The model space may be divided into distinct areas using integer masks.     |',
            '| Mask 0 is reserved for air; mask 9 is reserved for ocean. Smoothing between |',
            '| air, ocean and the rest of the model is turned off automatically. You can   |',
            '| also define exceptions to override smoothing between any two model areas.   |',
            '| To turn off smoothing set it to zero.  This header is 16 lines long.        |',
            '| 1. Grid dimensions excluding air layers (Nx, Ny, NzEarth)                   |',
            '| 2. Smoothing in the X direction (NzEarth real values)                       |',
            '| 3. Smoothing in the Y direction (NzEarth real values)                       |',
            '| 4. Vertical smoothing (1 real value)                                        |',
            '| 5. Number of times the smoothing should be applied (1 integer >= 0)         |',
            '| 6. Number of exceptions (1 integer >= 0)                                    |',
            '| 7. Exceptions in the for e.g. 2 3 0. (to turn off smoothing between 3 & 4)  |',
            '| 8. Two integer layer indices and Nx x Ny block of masks, repeated as needed.|',
            '+{0}+'.format('-' * 77)
        ])

        for key in list(kwargs.keys()):
            if hasattr(self, key):
                setattr(self, key, kwargs[key])
            else:
                self._logger.warn(
                    "Argument {}={} is not supportted thus not been set.".
                    format(key, kwargs[key]))
Beispiel #8
0
    def __init__(self, **kwargs):
        """
        Initialise the object
        :param kwargs: keyword-value pairs
        """
        super(PlotResPhaseMaps, self).__init__(**kwargs)

        self._logger = MtPyLog.get_mtpy_logger(self.__class__.__name__)

        fn_list = kwargs.pop('fn_list', [])

        if(len(fn_list)==0): raise NameError('File list is empty.')

        # ----set attributes for the class-------------------------
        self.mt_list = mtpl.get_mtlist(fn_list=fn_list)

        # read in map scale
        self.mapscale = kwargs.pop('mapscale', 'deg')
        if self.mapscale == 'km':
            self.dscale = 1000.
        elif self.mapscale == 'm':
            self.dscale = 1.
        # end if

        self.plot_title = kwargs.pop('plot_title', None)
        self.fig_dpi = kwargs.pop('fig_dpi', 100)

        self.fig_size = kwargs.pop('fig_size', [8, 6])

        self.font_size = kwargs.pop('font_size', 7)

        self.plot_yn = kwargs.pop('plot_yn', 'y')
        self.save_fn = kwargs.pop('save_fn', "/c/tmp")

        # By this stage all keyword arguments meant to be set as class properties will have
        # been processed. Popping all class properties that still exist in kwargs
        self.kwargs = kwargs
        for key in vars(self):
            self.kwargs.pop(key, None)

        self.axesList = []
Beispiel #9
0
 def __init__(self):
     self._logger = MtPyLog.get_mtpy_logger(self.__class__.__name__)
     self._data = None
     self._fig = None
Beispiel #10
0
from tests import TEST_DIR, make_temp_dir, TEST_TEMP_DIR

if os.name == "posix" and 'DISPLAY' not in os.environ:
    print("MATPLOTLIB: No Display found, using non-interactive svg backend",
          file=sys.stderr)
    matplotlib.use('svg')
    import matplotlib.pyplot as plt
    MTPY_TEST_HAS_DISPLAY = False
else:
    # matplotlib.use('svg')
    import matplotlib.pyplot as plt
    MTPY_TEST_HAS_DISPLAY = True
    plt.ion()

MtPyLog.get_mtpy_logger(__name__).info(
    "Testing using matplotlib backend {}".format(
        matplotlib.rcParams['backend']))


def reset_matplotlib():
    # save some important params
    interactive = matplotlib.rcParams['interactive']
    backend = matplotlib.rcParams['backend']
    # reset
    matplotlib.rcdefaults()  # reset the rcparams to default
    # recover
    matplotlib.rcParams['backend'] = backend
    matplotlib.rcParams['interactive'] = interactive
    logger = MtPyLog().get_mtpy_logger(__name__)
    logger.info("Testing using matplotlib backend {}".format(
        matplotlib.rcParams['backend']))
Beispiel #11
0
import matplotlib.pyplot as plt
import numpy as np

import mtpy.core.mt as mt
from mtpy.imaging.penetration import get_index, load_edi_files, Depth3D
from mtpy.utils.decorator import deprecated
from mtpy.utils.mtpylog import MtPyLog

# mpl.rcParams['lines.linewidth'] = 2
# mpl.rcParams['lines.color'] = 'r'

# mpl.rcParams['figure.figsize'] = [20, 10]

# get a logger object for this module, using the utility class MtPyLog to
# config the logger
_logger = MtPyLog.get_mtpy_logger(__name__)

# logger =
# MtPyLog(path2configfile='logging.yml').get_mtpy_logger(__name__) #
# specific


# This is the major function to be maintained!!!
# use the Zcompotent=[det, zxy, zyx]
def plot_latlon_depth_profile(edi_dir,
                              period,
                              zcomponent='det',
                              showfig=True,
                              savefig=True,
                              savepath=None,
                              fig_dpi=400,
Beispiel #12
0
class gdal_data_check(object):
    _has_checked = False
    _gdal_data_found = False
    _logger = MtPyLog.get_mtpy_logger(__name__)

    def __init__(self, func):
        """
        this decorator should only be used for the function that requres gdal and gdal-data
        to function correctly.

        the decorator will check if the GDAL_DATA is set and the path in GDAL_DATA is exist.
        If GDAL_DATA is not set, then try to use external program "gdal-config --datadir" to
        findout where the data files are installed.

        If failed to find the data file, then ImportError will be raised.

        :param func: function to be decorated
        """
        self._func = func
        if not self._has_checked:
            self._gdal_data_found = self._check_gdal_data()
            self._has_checked = True
        if not self._gdal_data_found:
            raise ImportError("GDAL_DATA environment variable not set. Please see "
                              "https://trac.osgeo.org/gdal/wiki/FAQInstallationAndBuilding#HowtosetGDAL_DATAvariable for "
                              "more information.")

    def __call__(self, *args, **kwargs):  # pragma: no cover
        return self._func(*args, **kwargs)

    def _check_gdal_data(self):
        if 'GDAL_DATA' not in os.environ:
            # gdal data not defined, try to define
            from subprocess import Popen, PIPE
            self._logger.warn("GDAL_DATA environment variable is not set")
            try:
                # try to find out gdal_data path using gdal-config
                self._logger.info("Trying to find gdal-data path ...")
                process = Popen(['gdal-config', '--datadir'], stdout=PIPE)
                (output, err) = process.communicate()
                exit_code = process.wait()
                output = output.strip()
                if exit_code == 0 and os.path.exists(output):
                    os.environ['GDAL_DATA'] = output
                    self._logger.info("Found gdal-data path: {}".format(output))
                    return True
                else:
                    self._logger.error(
                        "\tCannot find gdal-data path. Please find the gdal-data path of your installation and set it to "
                        "\"GDAL_DATA\" environment variable. Please see "
                        "https://trac.osgeo.org/gdal/wiki/FAQInstallationAndBuilding#HowtosetGDAL_DATAvariable for "
                        "more information.")
                    return False
            except Exception:
                return False
        else:
            if os.path.exists(os.environ['GDAL_DATA']):
                self._logger.info("GDAL_DATA is set to: {}".format(os.environ['GDAL_DATA']))
                return True
            else:
                self._logger.error("GDAL_DATA is set to: {}, but the path does not exist.".format(os.environ['GDAL_DATA']))
                return False
Beispiel #13
0
 def __init__(self):
     self._station_dict = dict()
     self._logger = MtPyLog.get_mtpy_logger(self.__class__.__name__)
     self._file_dict = dict()
     self._group_dict = dict()
     self._file_to_groups = dict()
Beispiel #14
0
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from mpl_toolkits.axes_grid1 import make_axes_locatable
from shapely.geometry import Point, Polygon, LineString, LinearRing

from mtpy.core.edi_collection import EdiCollection
from mtpy.utils.mtpy_decorator import deprecated
from mtpy.utils.mtpylog import MtPyLog
from mtpy.utils.edi_folders import recursive_glob

mpl.rcParams['lines.linewidth'] = 2
# mpl.rcParams['lines.color'] = 'r'
mpl.rcParams['figure.figsize'] = [10, 6]

_logger = MtPyLog.get_mtpy_logger(__name__)  # logger inside this file/module
_logger.setLevel(logging.DEBUG)  # set your logger level


class ShapefilesCreator(EdiCollection):
    """ Extend the EdiCollection parent class,
    create phase tensor and tipper shapefiles for a list of edifiles

    :param edifile_list: [path2edi,...]
    :param outdir: path2output dir, where the shp file will be written.
    :param orig_crs = {'init': 'epsg:4283'}  # GDA94
    """

    def __init__(self, edifile_list, outdir, epsg_code=4326):
        """
        loop through a list of edi files, create required shapefiles
"""
import os
import sys
import csv
import glob

import numpy as np
import mtpy.core.mt as mt
import mtpy.imaging.mtplottools as mtplottools
from mtpy.utils.decorator import deprecated
from mtpy.utils.matplotlib_utils import gen_hist_bins

from logging import DEBUG, INFO, ERROR, WARNING
from mtpy.utils.mtpylog import MtPyLog

_logger = MtPyLog.get_mtpy_logger(
    __name__)  # __name__ will be  path.to.module OR __main__
_logger.setLevel(INFO)


def get_resistivity_from_edi_file(edifile, rholist=['det']):
    """Compute the resistivity values of an edi file
    :param edifile: input edifile
    :param rholist: flag the method to compute penetration depth: det zxy zyx
    :return: a tuple:(station_lat, statoin_lon, periods_list, pendepth_list)
    """
    _logger.debug("processing the edi file %s", edifile)

    mt_obj = mt.MT(edifile)
    zeta = mt_obj.Z  # the attribute Z represent the impedance tensor 2X2 matrix
    freqs = zeta.freq  # frequencies
Beispiel #16
0
    def __init__(self, parent=None):
        QWizard.__init__(self, parent)
        self.ui = Ui_Wizard_esport_modem()
        self.ui.setupUi(self)

        self._logger = MtPyLog.get_mtpy_logger(self.__class__.__name__)
        # setup gui
        # self.setWindowTitle("ModEM input file generator")

        # add math label
        self._math_label_sign_impedances = MathTextLabel(
            self,
            self._math_label_sign_text.format(
                "+" if self.ui.radioButton_impedance_sign_plus.isChecked() else "-"
            )
        )
        self.ui.horizontalLayout_sign_impedance.addWidget(self._math_label_sign_impedances)
        self._math_label_sign_vertical = MathTextLabel(
            self,
            self._math_label_sign_text.format(
                "+" if self.ui.radioButton_vertical_sign_plus.isChecked() else "-"
            )
        )
        self.ui.horizontalLayout_sign_vertical.addWidget(self._math_label_sign_vertical)

        # add math formulae of each error type
        self._math_label_elbert = MathTextLabel(
            self,
            "$E_{egbert}=e_Z\\times |Z_{xy}\\times Z_{yx}|^\\frac{1}{2}$",
        )
        self.ui.verticalLayout_error_types.addWidget(self._math_label_elbert)

        self._math_label_mean = MathTextLabel(self, "$E_{mean} = e_Z\\times mean(|Z_{xy}, Z_{yx}|)$")
        self._math_label_mean.setHidden(True)
        self.ui.verticalLayout_error_types.addWidget(self._math_label_mean)

        self._math_label_eigen = MathTextLabel(self, "$E_{eigen} = e_Z\\times eigenvalues(Z)$")
        self._math_label_eigen.setHidden(True)
        self.ui.verticalLayout_error_types.addWidget(self._math_label_eigen)

        self._math_label_median = MathTextLabel(self, "$E_{median} = e_Z\\times median(|Z_{xx},Z_{xy},Z_{yx},Z_{yy}|)$")
        self._math_label_median.setHidden(True)
        self.ui.verticalLayout_error_types.addWidget(self._math_label_median)

        self._math_label_error_type_note = MathTextLabel(self, "where $E$ is the error and $e$ is the error value (z).")
        self.ui.verticalLayout_error_types.addWidget(self._math_label_error_type_note)

        # add period selection
        self._period_select_ui = FrequencySelection(
            self.ui.wizardPage_period,
            show_period=True,
            show_frequency=False,
            allow_range_select=True,
            select_multiple=True
        )
        self._period_select_ui.ui.checkBox_show_existing.setChecked(True)
        self._period_select_ui.setEnabled(False)
        self._period_select_ui.setHidden(True)
        self.ui.wizardPage_period.layout().addWidget(self._period_select_ui)

        self._period_select_from_file_ui = FrequencySelectionFromFile(self.ui.wizardPage_period)
        self._period_select_from_file_ui.setEnabled(False)
        self._period_select_from_file_ui.setHidden(True)
        self.ui.wizardPage_period.layout().addWidget(self._period_select_from_file_ui)

        # add rotation
        self._rotation_ui = Rotation(self.ui.wizardPage_data)
        self._rotation_ui.setTitle('Data Rotation Angle')
        self.ui.horizontalLayout_data.addWidget(self._rotation_ui)

        self._mesh_rotation_ui = Rotation(self.ui.wizardPage_mesh)
        self._mesh_rotation_ui.setTitle('Mesh Rotation Angle')
        self.ui.gridLayout_mesh.addWidget(self._mesh_rotation_ui)

        # hide error percents
        self._component_error_type_z_changed()

        # hide bottom in vertical mesh as it is not used in mesh gen
        self.ui.doubleSpinBox_bottom.hide()
        self.ui.label_bottom.hide()

        # epsg
        self.ui.comboBox_epsg.addItems(
            [str(epsg) for epsg in sorted(epsg_dict.keys())]
        )

        # set validators
        self._double_validator = QDoubleValidator(-np.inf, np.inf, 1000)
        self._double_validator.setNotation(QDoubleValidator.ScientificNotation)
        self.ui.lineEdit_resistivity_init.setValidator(self._double_validator)
        self.ui.lineEdit_resistivity_air.setValidator(self._double_validator)
        self.ui.lineEdit_resistivity_sea.setValidator(self._double_validator)

        self._file_validator = FileValidator()
        self.ui.comboBox_topography_file.lineEdit().setValidator(self._file_validator)
        self.ui.comboBox_topography_file.lineEdit().setMaxLength(256)

        self._dir_validator = DirectoryValidator()
        self.ui.comboBox_directory.lineEdit().setValidator(self._dir_validator)

        # setup directory and dir dialog
        self._dir_dialog = QFileDialog(self)
        # self._dir_dialog.setDirectory(os.path.expanduser("~"))
        self.ui.comboBox_directory.addItem(os.path.expanduser("~"))
        self._update_full_output()

        # set maximum
        # self.ui.spinBox_cell_num_ew.setMaximum(0xFFFFFFFF)
        # self.ui.spinBox_cell_num_ns.setMaximum(0xFFFFFFFF)

        # tooltip for error types
        for index, tooltip in enumerate(self._error_type_z_tool_tip):
            self.ui.comboBox_error_type_z.setItemData(index, tooltip, QtCore.Qt.ToolTipRole)
            self.ui.comboBox_error_type_zxx.setItemData(index, tooltip, QtCore.Qt.ToolTipRole)
            self.ui.comboBox_error_type_zxy.setItemData(index, tooltip, QtCore.Qt.ToolTipRole)
            self.ui.comboBox_error_type_zyx.setItemData(index, tooltip, QtCore.Qt.ToolTipRole)
            self.ui.comboBox_error_type_zyy.setItemData(index, tooltip, QtCore.Qt.ToolTipRole)

        # hide parts
        self.ui.groupBox_component_error_types.setHidden(True)
        self.ui.label_component_error_types.setHidden(True)

        # connect signals
        self.ui.radioButton_impedance_sign_plus.toggled.connect(
            lambda is_checked: self._math_label_sign_impedances.set_math_text(
                self._math_label_sign_text.format("+" if is_checked else "-"))
        )
        self.ui.radioButton_vertical_sign_plus.toggled.connect(
            lambda is_checked: self._math_label_sign_vertical.set_math_text(
                self._math_label_sign_text.format("+" if is_checked else "-")
            )
        )

        self.ui.radioButton_impedance_full.toggled.connect(self._impedance_full_toggled)
        self.ui.radioButton_impedance_off_diagonal.toggled.connect(self._impedance_off_diagonal_toggled)
        self.ui.radioButton_impedance_none.toggled.connect(self._impedance_none_toggled)
        self.ui.radioButton_vertical_full.toggled.connect(self._vertical_full_toggled)

        self.ui.comboBox_error_type_z.currentIndexChanged.connect(self._error_type_z_changed)
        for component in self._impedance_components:
            combobox = getattr(self.ui, 'comboBox_error_type_{}'.format(component))
            checkbox = getattr(self.ui, 'checkBox_{}'.format(component))
            combobox.currentIndexChanged.connect(self._component_error_type_z_changed)
            checkbox.toggled.connect(self._error_component_checkbox_toggled(combobox))

        self.ui.comboBox_output_name.currentIndexChanged.connect(self._update_full_output)
        self.ui.comboBox_output_name.lineEdit().editingFinished.connect(self._output_name_changed)
        self.ui.comboBox_output_name.editTextChanged.connect(self._update_full_output)
        self.ui.comboBox_directory.currentIndexChanged.connect(self._update_full_output)
        self.ui.comboBox_directory.lineEdit().editingFinished.connect(self._output_dir_changed)
        self.ui.comboBox_directory.editTextChanged.connect(self._update_full_output)
        self.ui.pushButton_browse.clicked.connect(self._browse)

        # self.ui.doubleSpinBox_target_depth.valueChanged.connect(self._target_depth_changed)
        self.ui.doubleSpinBox_target_depth.lineEdit().editingFinished.connect(self._target_depth_changed)
        self.ui.doubleSpinBox_bottom.lineEdit().editingFinished.connect(self._bottom_changed)
        # self.ui.doubleSpinBox_bottom.valueChanged.connect(self._bottom_changed)

        # self.ui.comboBox_topography_file.currentIndexChanged.connect()
        self.ui.comboBox_topography_file.lineEdit().editingFinished.connect(
            self._topography_file_changed
        )
        self.ui.pushButton_browse_topography_file.clicked.connect(self._browse_topography_file)

        self.ui.pushButton_test.clicked.connect(self._test_button_clicked)

        self.ui.checkBox_cell_num_ew.stateChanged.connect(
            lambda p_int: self.ui.spinBox_cell_num_ew.setEnabled(p_int != 0)
        )
        self.ui.checkBox_cell_num_ns.stateChanged.connect(
            lambda p_int: self.ui.spinBox_cell_num_ns.setEnabled(p_int != 0)
        )

        self.ui.checkBox_component_error_types.setEnabled(False)  # disabled due to missing implementations todo implement this option in modem.Data
        self.ui.checkBox_component_error_types.toggled.connect(self._component_error_type_toggled)
        self.ui.radioButton_select_period_percent.toggled.connect(
            lambda checked: self.ui.doubleSpinBox_select_period_percent.setEnabled(checked))
        self.ui.radioButton_select_period.toggled.connect(
            lambda checked: self._period_select_ui.setEnabled(checked))
        self.ui.radioButton_select_period.toggled.connect(
            lambda checked: self._period_select_ui.setHidden(not checked))
        self.ui.radioButton_select_by_file.toggled.connect(
            lambda checked: self._period_select_from_file_ui.setEnabled(checked))
        self.ui.radioButton_select_by_file.toggled.connect(
            lambda checked: self._period_select_from_file_ui.setHidden(not checked))

        # register fields
        self.ui.wizardPage_output.registerField('output_path*', self.ui.lineEdit_full_output)
        self.ui.wizardPage_topography.registerField('topography_file*', self.ui.comboBox_topography_file)
        self.ui.wizardPage_topography.registerField('sea_resistivity',
                                                    self.ui.lineEdit_resistivity_sea)
        self.ui.wizardPage_topography.registerField('air_resistivity',
                                                    self.ui.lineEdit_resistivity_air)

        # attribute
        self._mt_objs = None

        self._progress_bar = ProgressBar()