1 3
from ._version import __version_info__, __version__
2

3 3
__author__ = "Leonhard Neuhaus <neuhaus@lkb.upmc.fr>"
4 3
__license__ = "GNU General Public License 3 (GPLv3)"
5

6
# manage warnings of numpy and scipy
7 3
import warnings
8 3
import numpy as np
9
# pyqtgraph is throwing a warning on ScatterPlotItem
10 3
warnings.simplefilter("ignore", np.VisibleDeprecationWarning)
11
# pyqtgraph is throwing a warning on ScatterPlotItem
12 3
warnings.simplefilter("error", np.ComplexWarning)
13
# former issue with IIR, now resolved
14
#from scipy.signal import BadCoefficients
15
#warnings.simplefilter("error", BadCoefficients)
16

17
#set up loggers
18 3
import logging
19 3
logging.basicConfig()
20 3
logger = logging.getLogger(name=__name__)
21
# only show errors or warnings until userdefine log level is set up
22 3
logger.setLevel(logging.INFO)
23

24
# enable ipython QtGui support if needed
25 3
try:
26 3
    from IPython import get_ipython
27 0
    IPYTHON = get_ipython()
28 0
    IPYTHON.magic("gui qt")
29 3
except BaseException as e:
30 3
    logger.debug('Could not enable IPython gui support: %s.' % e)
31

32
# get QApplication instance
33 3
from qtpy import QtCore, QtWidgets
34 3
APP = QtWidgets.QApplication.instance()
35 3
if APP is None:
36 3
    logger.debug('Creating new QApplication instance "pyrpl"')
37 3
    APP = QtWidgets.QApplication(['pyrpl'])
38

39
# get user directories
40 3
import os
41 3
try:  # first try from environment variable
42 3
    user_dir = os.environ["PYRPL_USER_DIR"]
43 3
except KeyError:  # otherwise, try ~/pyrpl_user_dir (where ~ is the user's home dir)
44 3
    user_dir = os.path.join(os.path.expanduser('~'), 'pyrpl_user_dir')
45

46
# make variable directories
47 3
user_config_dir = os.path.join(user_dir, 'config')
48 3
user_curve_dir = os.path.join(user_dir, 'curve')
49 3
user_lockbox_dir = os.path.join(user_dir, 'lockbox')
50 3
default_config_dir = os.path.join(os.path.dirname(__file__), 'config')
51
# create dirs if necessary
52 3
for path in [user_dir, user_config_dir, user_curve_dir, user_lockbox_dir]:
53 3
    if not os.path.isdir(path):
54
        os.mkdir(path)  # pragma: no cover
55

56
# try to set log level (and automatically generate custom global_config file)
57 3
from .pyrpl_utils import setloglevel
58 3
from .memory import MemoryTree
59 3
global_config = MemoryTree('global_config', source='global_config')
60 3
try:
61 3
    setloglevel(global_config.general.loglevel, loggername=logger.name)
62
except:  # pragma: no cover
63
    pass
64

65
# main imports
66 3
from .redpitaya import RedPitaya
67 3
from .hardware_modules import *
68 3
from .attributes import *
69 3
from .modules import *
70 3
from .curvedb import *
71 3
from .pyrpl import *

Read our documentation on viewing source code .

Loading