import logging
from pathlib import Path

from hyo2.abc.lib.logging import set_logging
from hyo2.abc.lib.testing_paths import TestingPaths
from hyo2.openbst.lib.openbst import OpenBST

set_logging(ns_list=[
    "hyo2.openbst",
])
logger = logging.getLogger(__name__)

# Set up project
testing = TestingPaths(root_folder=Path(__file__).parents[2].resolve())
bst = OpenBST(prj_name="default", force_new=True)
bst.prj.open_project_folder()

# add file
raw_path = testing.download_data_folder().joinpath('reson',
                                                   '20190321_185116.s7k')
bst.prj.add_raw(raw_path)

raw_path = testing.download_data_folder().joinpath('reson',
                                                   '20190730_144835.s7k')
bst.prj.add_raw(raw_path)

# import raws via project health check
bst.prj.check_health()

# remove a raw
bst.prj.remove_raw(raw_path)
Beispiel #2
0
import time
import logging
from PySide2 import QtWidgets

from hyo2.abc.app.qt_progress import QtProgress
from hyo2.abc.lib.logging import set_logging

logger = logging.getLogger(__name__)
set_logging(ns_list=["hyo2.abc"])

app = QtWidgets.QApplication([])

widget = QtWidgets.QWidget()
widget.show()

progress = QtProgress(parent=widget)

progress.start(title='Test Bar', text='Doing stuff')

time.sleep(.1)

progress.update(value=30, text='Updating')

time.sleep(.1)

print("canceled? %s" % progress.canceled)

progress.end()
import logging

from PySide2 import QtWidgets

from hyo2.abc.app.qt_progress import QtProgress
from hyo2.soundspeedmanager import app_info
from hyo2.soundspeed.soundspeed import SoundSpeedLibrary
from hyo2.soundspeedmanager.qt_callbacks import QtCallbacks
from hyo2.abc.lib.logging import set_logging

ns_list = [
    "hyo2.soundspeed", "hyo2.soundspeedmanager", "hyo2.soundspeedsettings"
]
set_logging(ns_list=ns_list)

logger = logging.getLogger(__name__)

# examples of test position:
# - offshore Portsmouth: 43.026480, -70.318824
# - Indian Ocean: -19.1, 74.16
# - middle of Africa (in land): 18.2648113, 16.1761115

switch = "LEOFS"  # WOA09 or WOA13 or RTOFS or GoMOFS or LEOFS or LHOFS

app = QtWidgets.QApplication([])  # PySide stuff (start)
mw = QtWidgets.QMainWindow()
mw.show()

lib = SoundSpeedLibrary(progress=QtProgress(parent=mw),
                        callbacks=QtCallbacks(parent=mw))
Beispiel #4
0
import traceback
from pathlib import Path
from PySide2 import QtCore, QtWidgets

import logging

from hyo2.abc.app.app_style import AppStyle
from hyo2.abc.lib.logging import set_logging
from hyo2.qax.app.gui_settings import GuiSettings
from hyo2.qax.app.mainwin import MainWin
from hyo2.qax.lib.config import QaxConfig
from hyo2.qax.lib.plugin import QaxPlugins

logger = logging.getLogger(__name__)
set_logging(ns_list=[
    "hyo2.qax",
])


def qt_custom_handler(error_type: QtCore.QtMsgType,
                      error_context: QtCore.QMessageLogContext, message: str):
    if "Cannot read property 'id' of null" in message:
        return
    if "The event loop is already running" in message:
        return

    logger.info("Qt error: %s [%s] -> %s" %
                (error_type, error_context, message))

    for line in traceback.format_stack():
        logger.debug("- %s" % line.strip())
Beispiel #5
0
import logging
import sys
from PySide2 import QtWidgets

from hyo2.abc.lib.logging import set_logging
from hyo2.kng.sis.app.mainwin import MainWin

logger = logging.getLogger(__name__)
set_logging(ns_list=[
    "hyo2.kng",
])


def gui():
    """create the main windows and the event loop"""
    app = QtWidgets.QApplication(sys.argv)

    main = MainWin()
    main.show()

    sys.exit(app.exec_())
Beispiel #6
0
import sys
import traceback
import logging

from PySide2 import QtCore, QtWidgets

from hyo2.abc.lib.logging import set_logging
from hyo2.abc.app.app_style import AppStyle

set_logging(ns_list=["hyo2.abc", "hyo2.soundspeed", "hyo2.soundspeedmanager", "hyo2.soundspeedsettings",
                     "hyo2.surveydatamonitor"])
logger = logging.getLogger(__name__)


def qt_custom_handler(error_type: QtCore.QtMsgType, error_context: QtCore.QMessageLogContext, message: str):

    logger.info("Qt error: %s [%s, %s:%s:%d, v.%s] -> %s"
                % (error_type, error_context.category, error_context.file, error_context.function,
                   error_context.line, error_context.version, message))

    for line in traceback.format_stack():
        logger.debug("- %s" % line.strip())


QtCore.qInstallMessageHandler(qt_custom_handler)


def gui():
    """Create the application and show the Sound Speed Manager gui"""
    from hyo2.soundspeedmanager.mainwin import MainWin
Beispiel #7
0
 def setUp(self):
     set_logging(ns_list=["test_logging"])
     self.logger = logging.getLogger(__name__)
Beispiel #8
0
import sys
import traceback
import logging

from PySide2 import QtCore, QtWidgets

from hyo2.abc.lib.logging import set_logging
from hyo2.abc.app.app_style import AppStyle

set_logging(ns_list=["hyo2.abc", "hyo2.soundspeed", "hyo2.soundspeedmanager", "hyo2.soundspeedsettings"])
logger = logging.getLogger(__name__)


def qt_custom_handler(error_type, error_context, message):
    logger.info("Qt error: %s [%s] -> %s" % (str(error_type), str(error_context), message))

    for line in traceback.format_stack():
        logger.debug("- %s" % line.strip())


QtCore.qInstallMessageHandler(qt_custom_handler)


def gui():
    """Run the Sound Speed Settings gui"""
    from hyo2.soundspeedsettings.mainwin import MainWin
    from hyo2.soundspeed.soundspeed import SoundSpeedLibrary

    app = QtWidgets.QApplication(sys.argv)
    app.setStyleSheet(AppStyle.load_stylesheet())
import os
import numpy as np
import logging

from hyo2.abc.lib.logging import set_logging
from hyo2.qc.survey.anomaly.anomaly_detector_v1_thresholds import ThresholdsV1

logger = logging.getLogger(__name__)
set_logging(ns_list=["hyo2.ca", ])

np.random.seed(0)

arr_sz = 1000
array = np.random.rand(arr_sz, arr_sz) * 150.0
array[5:8, 5:7] = np.nan
array[15:18, 25:27] = np.nan
# array[int(array.shape[0]*.2), int(array.shape[1]*.1)] = np.nan
# array[int(array.shape[0]*.3), int(array.shape[1]*.1)] = np.nan
# array[int(array.shape[0]*.1), int(array.shape[1]*.7)] = np.nan

prev = None

for j in range(2):

    # array = ThresholdsV1.nan_gaussian_filter(array)

    ths = ThresholdsV1()
    ths.calculate(array)

    # ths.plot()