__init__.py 3.34 KB
Newer Older
Yori 'AGy' Fournier's avatar
Yori 'AGy' Fournier committed
1
2
3
4
5
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# ================= FILE HEADER ========================================
#
Philipp Gast's avatar
Philipp Gast committed
6
#   myplotlib v3.0.1,
Yori 'AGy' Fournier's avatar
Yori 'AGy' Fournier committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#
#   @file      __init__.py
#   @author    Yori 'AGy' Fournier
#   @licence   CC-BY-SA
#
#   Import and Configuration file for myplotlib
#
#   @section Import
#
#   myplotlib is base on matplotlib therefore it requires
#   Figure and Axes as main classes and a few further functions.
#
#   @section Config
#
#   Default value for user parameters
#   and configuration for the default plotting
#
#   @section Module Import
#
#   Import of myplotlib classes and function
#
#   @section History
#
#   v 0.0.0 - __init__.py file for the myplotlib module
#
# ======================================================================
#
#
# IMPORT ---------------------------------------------------------------
Yori Fournier's avatar
Yori Fournier committed
36
37
from .config import INFO, WARN, SEVR, DBUG, SPCE

Yori 'AGy' Fournier's avatar
Yori 'AGy' Fournier committed
38
39
40
import os as os
import numpy as np

Yori Fournier's avatar
Yori Fournier committed
41
42
43
44
45
46
# Test mpl version:
from matplotlib import __version__ as mplvers

if int(mplvers.replace('.','')[:3]) < 143 :
    print('\n\n' + WARN + 72*'=' + '\n' + SPCE + 'The matplotlib version you are using is not supported.\n' + SPCE + 'Most of myplotlib should work, but some stuff may not.\n' + SPCE + 'ex: expect an error with test203\n' + SPCE + 72*'=' + '\n\n')

Yori 'AGy' Fournier's avatar
Yori 'AGy' Fournier committed
47
48
49
# matplotlib
from matplotlib.pyplot import figure
from matplotlib.pyplot import rc
50
51
from matplotlib.pyplot import show, draw, ion, ioff, clf
from matplotlib.pyplot import close as mpclose
Yori 'AGy' Fournier's avatar
Yori 'AGy' Fournier committed
52
53
54
from matplotlib.pyplot import fignum_exists, savefig
from matplotlib.axes import Axes
from matplotlib.figure import Figure
55
from matplotlib import is_interactive
56
#from matplotlib import rcParams
57
58
from matplotlib import use

Yori 'AGy' Fournier's avatar
Yori 'AGy' Fournier committed
59
# myplotlib
60
from .myData import MyData
Yori 'AGy' Fournier's avatar
Yori 'AGy' Fournier committed
61
62

# GLOBAL VARIABLE ------------------------------------------------------
63
G_RAWDATAS  = {'current': MyData()}  # raw data Object
64
_G_WINDOWS = []
Yori 'AGy' Fournier's avatar
Yori 'AGy' Fournier committed
65

66
67
68
69
70
71
72
# CONFIGURATION --------------------------------------------------------
from .config import D_FIGNUM, D_FIGSIZE, D_REFORMAT, D_FORMATTED
from .config import D_RAWDATA, D_INPUTARG
from .config import D_IPATH
from .config import D_OPATH, D_OFORMAT
from .config import D_DEBUG
from .config import rcParams
Yori 'AGy' Fournier's avatar
Yori 'AGy' Fournier committed
73
74
75

# FUNCTIONS ------------------------------------------------------------
# MyAxes: Overlay on matplotlib.Axes class
76
from .myAxes import MyAxes
Yori 'AGy' Fournier's avatar
Yori 'AGy' Fournier committed
77
78

# MyFig: Overlay on matplotlib.Figure class
79
from .myFig import MyFig
Yori 'AGy' Fournier's avatar
Yori 'AGy' Fournier committed
80

81
# MyFig: Overlay on matplotlib.FigureManager class
82
if rcParams['backend'] == u'TkAgg':
83
    from .myWin_TkAgg import MyWin_TkAgg as MyWin
84
elif rcParams['backend'] == u'GTKAgg':
85
    from .myWin_GTKAgg import MyWin_GTKAgg as MyWin
86
elif rcParams['backend'] == u'WXAgg':
87
    from .myWin_WXAgg import MyWin_WXAgg as MyWin
88
89
elif rcParams['backend'] == u'Qt4Agg':
    from .myWin_Qt4Agg import MyWin_Qt4Agg as MyWin
90
elif rcParams['backend'] == u'MacOSX':
Yori 'AGy' Fournier's avatar
Yori 'AGy' Fournier committed
91
    from .myWin_MacOSx import MyWin_MacOSx as MyWin
92
93
else:
    print(SEVR + "The backend you choosed is not supported interactive mode not available")
94

Yori 'AGy' Fournier's avatar
Yori 'AGy' Fournier committed
95
# myTool.*: interface functions to use myplotlib interactively
Yori 'AGy' Fournier's avatar
Yori 'AGy' Fournier committed
96
97
98
99
from .mytool import window_exists, getCurrentWindowIDs
from .mytool import print2file, print2screen, printListCurrentWindows
from .mytool import getWindow, getFigOnWindow, drawFigOnWindow, giveDataToWindow
from .mytool import closeWindow, closeAllWindows
100
from .mytool import FigOneAxes
Yori 'AGy' Fournier's avatar
Yori 'AGy' Fournier committed
101

102
from .test import myTest
103

104
# import the tests
Yori 'AGy' Fournier's avatar
Yori 'AGy' Fournier committed
105
from .test import testList