Commit 14799dd9 authored by Yori's avatar Yori
Browse files

further pre-cleaning before installing

parent 243b21ac
from .mpl_data import MplData
from matplotlib import rcParams
# FORM -----------------------------------------------------------------
INFO = " > info-: "
WARN = " > warn-: "
SEVR = " > sevr-: "
DBUG = " > dbug-: "
SPCE = " > -----: "
# CONFIGURATION --------------------------------------------------------
# myFig
D_FIGNUM = 0 # default figure number
D_FIGSIZE = (8., 6.) # default figure size
D_REFORMAT = True # default reformat value
D_FORMATTED = False # default formatted value
D_RAWDATA = MplData() # default raw data
D_INPUTARG = 'current' # default Input argument
# myIOs
D_IPATH = '../' # default path to project
# print2file
D_OPATH = 'myplotlib/img/' # default path to ouput
D_OFORMAT = 'png' # default format for ouput
# Debug
D_DEBUG = True # default debug value
# PLOTTING CONFIGURATION -----------------------------------------------
# BACKEND: u'TKAgg', u'GTKAgg', u'WXAgg', u'Qt4Agg', u'MacOSX'
rcParams['backend'] = u'TkAgg'
# FONT
rcParams['font.family'] = 'serif'
rcParams['font.size'] = '22'
try:
rcParams['text.usetex'] = False # need dvipng, ghostscript, and Agg
except:
print(WARN + "I couls not set the LaTeX font sorry...")
# LINES
rcParams['lines.linewidth'] = 1.5
rcParams['lines.markersize'] = 6
# AXES
rcParams['axes.linewidth'] = 1.5
# TICKS
rcParams['xtick.major.pad'] = 10.
rcParams['xtick.major.size'] = 10.
rcParams['ytick.major.pad'] = 8.
rcParams['ytick.major.size'] = 10.
rcParams['xtick.minor.size'] = 5.
rcParams['ytick.minor.size'] = 5.
# Not compatible with old version of matplotlib
try:
rcParams['xtick.major.width'] = 1.5
rcParams['ytick.major.width'] = 1.5
rcParams['xtick.minor.width'] = 1.5
rcParams['ytick.minor.width'] = 1.5
rcParams['xtick.minor.visible'] = False
rcParams['ytick.minor.visible'] = False
except:
print(WARN + 'Some of the options of your config file could not be setted')
# DPI
rcParams['figure.dpi'] = 75.0
from .mpl_data import MplData
from matplotlib import rcParams
# FORM -----------------------------------------------------------------
INFO = " > info-: "
WARN = " > warn-: "
SEVR = " > sevr-: "
DBUG = " > dbug-: "
SPCE = " > -----: "
# CONFIGURATION --------------------------------------------------------
# myFig
D_FIGNUM = 0 # default figure number
D_FIGSIZE = (8., 6.) # default figure size
D_REFORMAT = True # default reformat value
D_FORMATTED = False # default formatted value
D_RAWDATA = MplData() # default raw data
D_INPUTARG = 'current' # default Input argument
# myIOs
D_IPATH = '../' # default path to project
# print2file
D_OPATH = 'myplotlib/img/' # default path to ouput
D_OFORMAT = 'png' # default format for ouput
# Debug
D_DEBUG = True # default debug value
# PLOTTING CONFIGURATION -----------------------------------------------
# BACKEND: u'TKAgg', u'GTKAgg', u'WXAgg', u'Qt4Agg', u'MacOSX'
rcParams['backend'] = u'GTKAgg'
# FONT
rcParams['font.family'] = 'serif'
rcParams['font.size'] = '22'
try:
rcParams['text.usetex'] = False # need dvipng, ghostscript, and Agg
except:
print(WARN + "I couls not set the LaTeX font sorry...")
# LINES
rcParams['lines.linewidth'] = 1.5
rcParams['lines.markersize'] = 6
# AXES
rcParams['axes.linewidth'] = 1.5
# TICKS
rcParams['xtick.major.pad'] = 10.
rcParams['xtick.major.size'] = 10.
rcParams['ytick.major.pad'] = 8.
rcParams['ytick.major.size'] = 10.
rcParams['xtick.minor.size'] = 5.
rcParams['ytick.minor.size'] = 5.
# Not compatible with old version of matplotlib
try:
rcParams['xtick.major.width'] = 1.5
rcParams['ytick.major.width'] = 1.5
rcParams['xtick.minor.width'] = 1.5
rcParams['ytick.minor.width'] = 1.5
rcParams['xtick.minor.visible'] = False
rcParams['ytick.minor.visible'] = False
except:
pass
# DPI
rcParams['figure.dpi'] = 75.0
from .mpl_data import MplData
from matplotlib import rcParams
# FORM -----------------------------------------------------------------
INFO = " > info-: "
WARN = " > warn-: "
SEVR = " > sevr-: "
DBUG = " > dbug-: "
SPCE = " > -----: "
# CONFIGURATION --------------------------------------------------------
# myFig
D_FIGNUM = 0 # default figure number
D_FIGSIZE = (8., 6.) # default figure size
D_REFORMAT = True # default reformat value
D_FORMATTED = False # default formatted value
D_RAWDATA = MplData() # default raw data
D_INPUTARG = 'current' # default Input argument
# myIOs
D_IPATH = '../' # default path to project
# print2file
D_OPATH = 'myplotlib/img/' # default path to ouput
D_OFORMAT = 'png' # default format for ouput
# Debug
D_DEBUG = True # default debug value
# PLOTTING CONFIGURATION -----------------------------------------------
# DPI
rcParams['figure.dpi'] = 75.0
from .mpl_data import MplData
# TECHNICAL ------------------------------------------------------------
D_VERSION='v5'
CONTEXT='LOCAL'
D_HOST='localhost'
D_PORT=50803
# FORM -----------------------------------------------------------------
INFO = " > info-: "
WARN = " > warn-: "
SEVR = " > sevr-: "
DBUG = " > dbug-: "
SPCE = " > -----: "
# CONFIGURATION --------------------------------------------------------
# myFig
D_FIGNUM = 0 # default figure number
D_FIGSIZE = (8., 6.) # default figure size
D_REFORMAT = True # default reformat value
D_FORMATTED = False # default formatted value
D_INPUTARG = 'current' # default Input argument
# myIOs
D_IPATH = '../' # default path to project
# print2file
D_OPATH = 'myplotlib/img/' # default path to ouput
D_OFORMAT = 'png' # default format for ouput
# Debug
D_DEBUG = True # default debug value
from matplotlib import rcParams
# BACKEND: u'TKAgg', u'GTKAgg', u'WXAgg', u'Qt4Agg', u'MacOSX'
rcParams['backend'] = u'TKAgg'
# FONT
rcParams['font.family'] = 'serif'
rcParams['font.size'] = '22'
try:
rcParams['text.usetex'] = True # need dvipng, ghostscript, and Agg
except:
print(WARN + "I couls not set the LaTeX font sorry...")
# LINES
rcParams['lines.linewidth'] = 1.5
rcParams['lines.markersize'] = 6
# AXES
rcParams['axes.linewidth'] = 1.5
# TICKS
rcParams['xtick.major.pad'] = 10.
rcParams['xtick.major.size'] = 10.
rcParams['ytick.major.pad'] = 8.
rcParams['ytick.major.size'] = 10.
rcParams['xtick.minor.size'] = 5.
rcParams['ytick.minor.size'] = 5.
# Not compatible with old version of matplotlib
try:
rcParams['xtick.major.width'] = 1.5
rcParams['ytick.major.width'] = 1.5
rcParams['xtick.minor.width'] = 1.5
rcParams['ytick.minor.width'] = 1.5
rcParams['xtick.minor.visible'] = False
rcParams['ytick.minor.visible'] = False
except:
pass
# DPI
rcParams['figure.dpi'] = 75.0
......@@ -39,7 +39,7 @@ from .config import CONTEXT
import os as os
import numpy as np
from .signal import Signal, Query, Status, Answer
from .mpl_signal import Signal, Query, Status, Answer
from .mpl_unpickler import MplUnpickler
#np.set_printoptions(threshold='nan')
......
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# ================= FILE HEADER ========================================
#
# myplotlib v3.0.1,
#
# @file __main__.py
# @author Yori 'AGy' Fournier
# @licence CC-BY-SA
#
# main program of the module to use in command-line mode.
# for printing usage:
#
# > python myplotlib -h
#
# @section Test
#
# run a few Test to verify integrity of library.
#
# @section Plot
#
# interface to the plot scripts
#
# @section History
#
# v 0.0.0 - __main__.py file for the myplotlib module
# no tests and no plots
#
# ======================================================================
#
#
# IMPORT ---------------------------------------------------------------
from . import CONTEXT
from . import INFO, SPCE, DBUG
if CONTEXT in ('CLIENT', 'client', 'local', 'LOCAL'):
from . import myTest
from .test import __dict__ as avail_tests
else:
from socket import socket, AF_INET, SOCK_STREAM
from . import D_HOST, D_PORT
import sys
import getopt
# LOCAL VARIABLE
run4Plot = False
arg4Plot = ''
run4Test = False
debug = False
# GET PASSED OPTIONS ---------------------------------------------------
usage = '''
{0}Usage: python mfdPlot [-h]
{1} [-t/--test [all/<num of test>]
{1} [-p/--plot <Name of the Plot>]
{1} [-a/--args <String of the arguments>]
{1} [--debug]
'''.format(INFO, SPCE)
# GET OPT
try:
opts, args = getopt.getopt(
sys.argv[1:], "htp:", ["test=", "plot=", "args=", "debug", "server"])
except getopt.GetoptError:
print(usage)
sys.exit(1)
# CASE OPT
for opt, arg in opts:
if(opt == '-h'):
print(usage)
sys.exit(0)
elif opt in ("-t"):
run4Test = True
elif opt in ("--test"):
run4Test = True
tests = arg.split(', ')
testList = []
for test in tests:
if test in avail_tests.keys():
testList.append(avail_tests[test])
if len(testList) == 0:
print(" > sevr-: you need to give valid tests to be tested.")
exit(1)
elif opt in ("-p", "--plot"):
run4Plot = True
arg4Plot = str(arg)
elif opt in ("--debug"):
debug = True
elif opt in ("--server"):
run4server = True
# SECTION: TESTS ------------------------------------------------------
if run4Test:
if debug:
print(
DBUG +
'{title:{c}^{n}}'.format(
title=' Run for Test ',
c='=',
n=72))
else:
print(
INFO +
'{title:{c}^{n}}'.format(
title=' Run for Test ',
c='=',
n=72))
fail = []
status = True
print(INFO + "TESTS: ")
for test in testList:
print('\n')
print(INFO + '{title:{c}^{n}}'.format(title=' ' +
str(test.__name__) + ' ', c='=', n=72))
# function, expected, fail, debug
testStatus = myTest(test, True, fail, debug)
if testStatus:
print(INFO + 72 * '-' + " [PASSED]")
else:
print(INFO + 72 * '-' + " [FAILED] !")
status = status and testStatus
# Print final status
print('\n')
print(INFO + 'Status of test series: ' + str(status))
if not status:
print(SPCE + 'Number of Failed Tests: ' + str(len(fail)))
print(SPCE + 'List of Failed Tests: ')
for test in fail:
print(SPCE + '\t- ' + str(test))
# SECTION: PLOTS ------------------------------------------------------
elif run4Plot:
print(INFO + '{title:{c}^{n}}'.format(title=' Run for Plot ', c='=', n=72))
# try:
# data = arg4Plot
# somePlottingRoutine(data)
# except:
# print('\n'+SEVR+"There is something wrong with your arguments.")
# print(usage)
# print(INFO+"To start interactively:")
# print(SPCE+">> from mfdPlot import * \n")
elif run4server:
from . import Server
from . import readStupidData
server = Server()
server.init()
server.run()
else:
print(usage)
from .mpl_data import MplData
from matplotlib import rcParams
# FORM -----------------------------------------------------------------
INFO = " > info-: "
WARN = " > warn-: "
SEVR = " > sevr-: "
DBUG = " > dbug-: "
SPCE = " > -----: "
# CONFIGURATION --------------------------------------------------------
CONTEXT= 'CLIENT'
# myFig
D_FIGNUM = 0 # default figure number
D_FIGSIZE = (8., 6.) # default figure size
D_REFORMAT = True # default reformat value
D_FORMATTED = False # default formatted value
D_RAWDATA = MplData() # default raw data
D_INPUTARG = 'current' # default Input argument
# myIOs
D_IPATH = '../' # default path to project
# print2file
D_OPATH = 'myplotlib/img/' # default path to ouput
D_OFORMAT = 'png' # default format for ouput
# Debug
D_DEBUG = True # default debug value
# PLOTTING CONFIGURATION -----------------------------------------------
# BACKEND: u'TKAgg', u'GTKAgg', u'WXAgg', u'Qt4Agg', u'MacOSX'
rcParams['backend'] = u'WXAgg'
# FONT
rcParams['font.family'] = 'serif'
rcParams['font.size'] = '22'
try:
rcParams['text.usetex'] = True # need dvipng, ghostscript, and Agg
except Exception:
print(WARN + "I could not set the LaTeX font sorry...")
# LINES
rcParams['lines.linewidth'] = 1.5
rcParams['lines.markersize'] = 6
# AXES
rcParams['axes.linewidth'] = 1.5
# TICKS
rcParams['xtick.major.pad'] = 10.
rcParams['xtick.major.size'] = 10.
rcParams['ytick.major.pad'] = 8.
rcParams['ytick.major.size'] = 10.
rcParams['xtick.minor.size'] = 5.
rcParams['ytick.minor.size'] = 5.
# Not compatible with old version of matplotlib
try:
rcParams['xtick.major.width'] = 1.5
rcParams['ytick.major.width'] = 1.5
rcParams['xtick.minor.width'] = 1.5
rcParams['ytick.minor.width'] = 1.5
rcParams['xtick.minor.visible'] = False
rcParams['ytick.minor.visible'] = False
except Exception:
pass
# DPI
rcParams['figure.dpi'] = 75.0
from .mpl_Data import MplData
# TECHNICAL ------------------------------------------------------------
D_VERSION = 'v5'
D_HIERARCHY = 'SERVER'
D_HOST = 'localhost'
D_PORT = 50803
# FORM -----------------------------------------------------------------
INFO = " > info-: "
WARN = " > warn-: "
SEVR = " > sevr-: "
DBUG = " > dbug-: "
SPCE = " > -----: "
# CONFIGURATION --------------------------------------------------------
# myFig
D_FIGNUM = 0 # default figure number
D_FIGSIZE = (8., 6.) # default figure size
D_REFORMAT = True # default reformat value
D_FORMATTED = False # default formatted value
D_RAWDATA = MplData() # default raw data
D_INPUTARG = 'current' # default Input argument
# myIOs
D_IPATH = '../' # default path to project
# print2file
D_OPATH = 'myplotlib/img/' # default path to ouput
D_OFORMAT = 'png' # default format for ouput
# Debug
D_DEBUG = True # default debug value
_D_PATH2_MYDESIGNS = './myplotlib/design/myDesigns/'
_D_PATH2_MYFIGURES = './myplotlib/design/myFigures/'
_D_PATH2_MYAXES = './myplotlib/design/myAxes/'
from .myDesignTool import getSectionFromDesign
from .myDesignTool import savePlot
from .axDesign import AxDesign
from .figDesign import FigDesign
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# ================= FILE HEADER ========================================
#
# myplotlib v3.0.1,
#
# @file myAxes.py
# @author Yori 'AGy' Fournier
# @licence CC-BY-SA
#
# MyAxes class: Overlay of matplotlib Axes class
# It is done such that the user can concentrate on
# the important aspect of the figure and not the
# technical part. It consists of a constructor,
# that requires a Figure, the ratio of the xaxis over
# the yaxis, and the frame in which the figure
# should be plotted.
#
# @Class MyAxes
#
# @Constructor(self, fig, ratio, frame, +user defined kw):
#
# @section Functions
#
# - plotting: this is the overwritten function
# from Axes. It is called by it's
# parent-figure's function .plot()
#
# - formatRawData: it computes out of the rawData
# given as argument some quantities that
# are returned as a dictionary and
# become accessable for plotting.
#
# @section History
#
# v 0.0.0 - MyAxes class for the myplotlib module, consists
# of a constructor, a pltting function and
# formatRawData.
#
# ======================================================================
#
#
# IMPORT ---------------------------------------------------------------
from .. import SEVR, DBUG, INFO
from .. import MyAxes
class AxDesign(MyAxes):
def __init__(self, fig, emulatedAxes, ratio, frameRect, *args, **kwargs):
self.emulatedAxes = emulatedAxes
MyAxes.__init__(self, fig, ratio, frameRect, *args, **kwargs)
def plotting(self):
exec(''.join(self.fig.designSections[self.emulatedAxes]['plotting']))
return(True)
def formatRawData(self, rawdata):
exec(''.join(self.fig.designSections[self.emulatedAxes]['formatRawData']))
return(True)