Commit 0071c776 authored by Phil Jones's avatar Phil Jones

Added plotting stylesheets experiment

parent 285c1e00
......@@ -40,6 +40,7 @@ import pykat.finesse as finesse
import pykat.components as components
import pykat.detectors as detectors
import pykat.commands as commands
import pykat.style as style
Please register or sign in to reply
from pykat.optics.gaussian_beams import BeamParam
......@@ -89,4 +90,4 @@ SIlabel = {'yocto': 'y',# yocto
'giga': 'T',# giga
'tera': 'P',# tera
'peta': 'y',# peta
}
\ No newline at end of file
}
import os
import contextlib
import matplotlib.pyplot as plt
Please register or sign in to reply
__all__ = ["use", "context"]
# Get style directory and available styles
style_dir = os.path.split(os.path.realpath(__file__))[0]
available = [os.path.splitext(f)[0]
for f in os.listdir(style_dir) if f.endswith(".mplstyle")]
def get_style_path(style):
if isinstance(style, str) or hasattr(style, 'keys'):
# If name is a single str or dict, make it a single element list.
styles = [style]
else:
styles = style
styles = list(map((lambda s: os.path.join(style_dir, s + ".mplstyle")),
styles))
return styles
def use(style):
Please register or sign in to reply
plt.style.use(get_style_path(style))
def context(style, after_reset=False):
Please register or sign in to reply
return plt.style.context(get_style_path(style), after_reset)
# PATCHES
patch.facecolor: r
# FONT
font.size : 9
# TEXT
text.usetex : False
# AXES
axes.grid : True
axes.formatter.useoffset : False
axes.formatter.use_locale : False
axes.prop_cycle: cycler('color', ['0000FF', 'FF0000', '000000', '00FF00', 'FF00FF'])
# GRIDS
grid.color : 999999
grid.linestyle : :
grid.linewidth : 0.25
# FIGURES
figure.titlesize : 12
figure.figsize : 6.69291, 4.13645
figure.dpi : 96
# IMAGES
image.cmap : magma
image.origin : lower
# SAVING FIGURES
savefig.dpi : 300
savefig.bbox : tight
savefig.transparent : True
pdf.compression : 9
pdf.fonttype : 42
# AXES
axes.prop_cycle : cycler("color", ["000000", "2c2d2d", "525353", "888989", "d1d3d4"])
# IMAGES
image.cmap : gray
# FONT
font.family : serif
font.serif : ["Latin Modern"]
font.size : 9
# TEXT
text.usetex : True
figure.figsize : 7.33915, 4.53585
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 27 09:43:16 2013
@author: Daniel
"""
#from pykat import __version__ as version
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import os
import subprocess
# Fetch version from git tags, and write to version.py.
# Also, when git is not available (PyPi package), use stored version.py.
version_py = os.path.join(os.path.dirname(__file__), 'pykat', '_version.py')
try:
version_git = subprocess.check_output(["git", "describe","--long"]).decode('utf8').rstrip()
version_git = ".".join(version_git.split('-')[:2])
except:
with open(version_py, 'r') as fh:
version_git = open(version_py).read().strip().split('=')[-1].replace('"','')
version_msg = "# Do not edit this file, pipeline versioning is governed by git tags"
with open(version_py, 'w') as fh:
fh.write(version_msg + os.linesep + ("__version__=\"%s\"" % version_git))
print("!!!! Printing version to:", version_py)
REQUIREMENTS = [i.strip() for i in open("requirements.txt").readlines()]
try:
setup(
name='PyKat',
version=version_git,
author='Daniel Brown',
author_email='ddb@star.sr.bham.ac.uk',
packages=[x[0].replace("/",".") for x in os.walk("pykat") if "__" not in x[0]],
url='http://pypi.python.org/pypi/PyKat/',
license='GPL v2',
description='Python interface and tools for FINESSE',
long_description=open('README.md').read(),
install_requires=REQUIREMENTS,
package_data={'': ['optics/greedypoints/*.txt', 'ifo/aligo/files/*.kat']},
include_package_data=True
)
finally:
os.remove(version_py)
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 27 09:43:16 2013
@author: Daniel
"""
#from pykat import __version__ as version
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import os
import subprocess
# Fetch version from git tags, and write to version.py.
# Also, when git is not available (PyPi package), use stored version.py.
version_py = os.path.join(os.path.dirname(__file__), 'pykat', '_version.py')
try:
version_git = subprocess.check_output(["git", "describe","--long"]).decode('utf8').rstrip()
version_git = ".".join(version_git.split('-')[:2])
except:
with open(version_py, 'r') as fh:
version_git = open(version_py).read().strip().split('=')[-1].replace('"','')
version_msg = "# Do not edit this file, pipeline versioning is governed by git tags"
with open(version_py, 'w') as fh:
fh.write(version_msg + os.linesep + ("__version__=\"%s\"" % version_git))
print("!!!! Printing version to:", version_py)
REQUIREMENTS = [i.strip() for i in open("requirements.txt").readlines()]
try:
setup(
name='PyKat',
version=version_git,
author='Daniel Brown',
author_email='ddb@star.sr.bham.ac.uk',
packages=[x[0].replace("/",".") for x in os.walk("pykat") if "__" not in x[0]],
url='http://pypi.python.org/pypi/PyKat/',
license='GPL v2',
description='Python interface and tools for FINESSE',
long_description=open('README.md').read(),
install_requires=REQUIREMENTS,
package_data={'': ['optics/greedypoints/*.txt',
'ifo/aligo/files/*.kat', 'style/*.mplstyle']},
include_package_data=True
)
finally:
os.remove(version_py)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment