def declare_variables(self):
        self.log_file_name = datetime.now().strftime(
            '%Y-%m-%d %H:%M:%S') + 'logs.txt'

        self.indicators = [
            "label", "name", "style", "type", "interval", "position", "color",
            "width"
        ]

        self.dark_theme = RcParams({
            'axes.edgecolor':
            'white',
            'axes.facecolor':
            '#1F2A34',
            'axes.labelcolor':
            'white',
            'axes.prop_cycle':
            cycler('color', [
                '#8dd3c7', '#feffb3', '#bfbbd9', '#fa8174', '#81b1d2',
                '#fdb462', '#b3de69', '#bc82bd', '#ccebc4', '#ffed6f'
            ]),
            'figure.edgecolor':
            '#1F2A34',
            'figure.facecolor':
            '#1F2A34',
            'grid.color':
            '#504958',
            'lines.color':
            'white',
            'patch.edgecolor':
            'white',
            'savefig.edgecolor':
            '#1F2A34',
            'savefig.facecolor':
            '#1F2A34',
            'text.color':
            'white',
            'xtick.color':
            'white',
            'ytick.color':
            'white'
        })

        self.queryChartConfig = """query chartConfig {
          chartConfig(strategy:"%s") {
            panels {
              name,
              height,
              indicators {
                label,
                name,
                style,
                type,
                interval,
                position,
                color,
                width
              }
            }
          }
        }"""

        self.query_template_chartconfig = """query chartConfig {{
            {market}
            chartConfig({query}){{
                panels {{
                    name,
                    height,
                    indicators {{{indicators}}} }}}}}}"""

        self.queryChartData = """query chartData {
          marketIndicators(
            strategy:"%s",
            market:"%s",
            limit:%s,
            optimizeIndicatorValuesForCharting:true,
            index:1
          ) {
            id,
            timestamp,
            open,
            high,
            low,
            close,
            volume,
            indicators
          }
        }"""

        self.queryChartData_with_indicators = """query chartData {
Exemple #2
0
    rc('font', **{'family': 'sans-serif', 'sans-serif': ['arial'], 'size': fontsz})
    rc(('xtick.major', 'xtick.minor', 'ytick.major', 'ytick.minor'), pad=dist_tick_lab)


def figure(title, figs=None, figsize=(12, 10), **kwargs):
    fig = plt.figure(figsize=figsize, **kwargs)
    fig.canvas.set_window_title(title)
    if figs != None:
        figs.append(fig)
    fig.patch.set_facecolor('w')
    plt.suptitle(title, fontsize=16)
    fig.subplots_adjust(left=0.07, right=0.80, wspace=0.5)
    return fig


"""
RcParams


RcParams({u'agg.path.chunksize': 0,
          u'animation.avconv_args': [],
          u'animation.avconv_path': u'avconv',
          u'animation.bitrate': -1,
          u'animation.codec': u'mpeg4',
          u'animation.convert_args': [],
          u'animation.convert_path': u'convert',
          u'animation.ffmpeg_args': [],
          u'animation.ffmpeg_path': u'ffmpeg',
          u'animation.frame_format': u'png',
          u'animation.html': u'none',
          u'animation.mencoder_args': [],
Exemple #3
0
# -- custom rc ----------------------------------------------------------------

# set default params
GWPY_RCPARAMS = RcParams(**{
    # axes boundary colours
    'axes.edgecolor': 'gray',
    # grid
    'axes.grid': True,
    'axes.axisbelow': False,
    'grid.linewidth': .5,
    # ticks
    'axes.formatter.limits': (-3, 4),
    'axes.formatter.use_mathtext': True,
    # fonts
    'axes.titlesize': 'large',
    'axes.labelsize': 'large',
    'font.family': ['sans-serif'],
    'font.sans-serif': [
        'FreeSans',
        'Helvetica Neue',
        'Helvetica',
        'Arial',
    ] + rcParams['font.sans-serif'],
    'font.size': 12,
    # legend (revert to mpl 1.5 formatting in parts)
    'legend.numpoints': 2,
    'legend.handlelength': 1,
    'legend.fancybox': False,
})

# set parameters only supported in matplotlib >= 1.5
# https://matplotlib.org/1.5.1/users/whats_new.html#configuration-rcparams
Exemple #4
0
dark_theme = RcParams({
    'axes.edgecolor':
    'white',
    'axes.facecolor':
    '#1F2A34',
    'axes.labelcolor':
    'white',
    'axes.prop_cycle':
    cycler('color', [
        '#8dd3c7', '#feffb3', '#bfbbd9', '#fa8174', '#81b1d2', '#fdb462',
        '#b3de69', '#bc82bd', '#ccebc4', '#ffed6f'
    ]),
    'figure.edgecolor':
    '#1F2A34',
    'figure.facecolor':
    '#1F2A34',
    'grid.color':
    '#504958',
    'lines.color':
    'white',
    'patch.edgecolor':
    'white',
    'savefig.edgecolor':
    '#1F2A34',
    'savefig.facecolor':
    '#1F2A34',
    'text.color':
    'white',
    'xtick.color':
    'white',
    'ytick.color':
    'white'
})
Exemple #5
0
import numpy as np
import os
from os import listdir
from os.path import isfile, join
import matplotlib.pyplot as plt
import matplotlib.tri as mtri
from matplotlib import RcParams

## =============================================================================
## Plot font
## =============================================================================
#
fig, ax = plt.subplots(figsize=(6 * 0.9, 5 * 0.9))
latex_style_times = RcParams({
    'font.family': 'serif',
    'font.serif': ['cmr10'],
    'text.usetex': True,
    'font.size': 15
})

# =============================================================================
# Reads the data
# =============================================================================
file_name = "results/solution.txt"
dir_path = os.path.dirname(os.path.realpath(__file__))
path = os.path.join(dir_path, file_name)
results = np.loadtxt(path)

file_name = "results/nodes_coordinates.txt"
dir_path = os.path.dirname(os.path.realpath(__file__))
path = os.path.join(dir_path, file_name)
coordinates = np.loadtxt(path)
Exemple #6
0
import torch
import torch.nn as nn
import matplotlib

matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import os
import torch.nn.functional as F
from matplotlib import RcParams
latex_style_times = RcParams({
    'font.family': 'serif',
    'font.serif': ['Times'],
    'text.usetex': True,
})

plt.style.use(latex_style_times)
plt.rcParams['font.size'] = 12


def plot_feature(net,
                 args,
                 plotloader,
                 device,
                 dirname,
                 epoch=0,
                 plot_class_num=10,
                 plot_quality=150,
                 testmode=False):
    plot_features = []
    plot_labels = []
Exemple #7
0
GWPY_RCPARAMS = RcParams(
    **{
        # axes boundary colours
        'axes.edgecolor':
        'gray',
        # grid
        'axes.grid':
        True,
        'axes.axisbelow':
        False,
        'grid.linewidth':
        .5,
        # ticks
        'axes.formatter.limits': (-3, 4),
        'axes.formatter.use_mathtext':
        True,
        # fonts
        'axes.titlesize':
        'large',
        'axes.labelsize':
        'large',
        'font.family': ['sans-serif'],
        'font.sans-serif': [
            'FreeSans',
            'Helvetica Neue',
            'Helvetica',
            'Arial',
        ] + rcParams['font.sans-serif'],
        'font.size':
        12,
        # legend (revert to mpl 1.5 formatting in parts)
        'legend.numpoints':
        2,
        'legend.handlelength':
        1,
        'legend.fancybox':
        False,
    })
Exemple #8
0
import pandas as pd
from matplotlib import RcParams
import matplotlib.pyplot as plt

# Plot style
latex_style_cm = RcParams({
    "font.family": "serif",
    "font.serif": ["Computer Modern Roman"],
    "font.size": 10,
    "text.usetex": True,
    # 'text.latex.unicode': True,
    "text.latex.preamble": ["\\usepackage{siunitx}"],
    "axes.linewidth": 0.4,
    "xtick.major.width": 0.2,
    "xtick.minor.width": 0.2,
    "ytick.major.width": 0.2,
    "ytick.minor.width": 0.2,
    "grid.linestyle": "-",
    "grid.linewidth": 0.3,
    "grid.color": [0.5] * 3,
})
plt.style.use(latex_style_cm)

# Loading data
log_data = pd.read_csv("log", sep=" ").to_numpy()
t = log_data[:, 0]
depth_min = log_data[:, 1]
depth_max = log_data[:, 2]

# Plot
plt.figure()