Commit c300c6c3 authored by Daniel Toyra's avatar Daniel Toyra

Merge branch 'master' of git.ligo.org:finesse/pykat

parents 770f9428 0e12c39b
......@@ -40,10 +40,12 @@ 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
from pykat.optics.gaussian_beams import BeamParam
from pykat.plotting import init_pykat_plotting
from pykat.style import use as set_plot_style
from .SIfloat import SIfloat
......@@ -89,4 +91,4 @@ SIlabel = {'yocto': 'y',# yocto
'giga': 'T',# giga
'tera': 'P',# tera
'peta': 'y',# peta
}
\ No newline at end of file
}
......@@ -372,11 +372,21 @@ class AbstractMirrorComponent(Component):
self._default_fsig_param = self.__phi
def setRTL(self, R=None, T=None, L=None):
"""
Sets the R, T, and/or L properties. At least two values should be specfified
as the the third can be assumed as:
R+T+L = 1
By setting one of the properties to None will set whether an m/m1/m2 (bs/bs1/bs2)
command is used with Finesse.
"""
if R is not None: self.R = R
if T is not None: self.T = T
if L is not None: self.L = L
def completeRTL(self, R=None, T=None, L=None):
setValues = sum(x is not None for x in [R,T,L])
if setValues == 3:
self.setRTL(R,T,L)
......
......@@ -63,13 +63,18 @@ def init_pykat_plotting(mode="display", dpi=100):
mpl.rcParams['axes.color_cycle'] = ['b', 'r', 'k', 'g', 'c', 'm', 'y']
else:
mpl.rcParams['axes.prop_cycle']=mpl.cycler('color', ['b', 'r', 'k', 'g', 'c', 'm', 'y'])
mpl.rcParams['lines.linewidth'] = 1.2
mpl.rcParams.update({"figure.figsize": (6, 3.708)})
mpl.rcParams.update({'font.size': 12})
mpl.rcParams.update({'font.size': 11})
mpl.rcParams.update({'figure.dpi': __DPI__})
mpl.rcParams.update({'savefig.dpi': __DPI__})
mpl.rcParams.update({'font.family': "serif"})
mpl.rcParams.update({'axes.grid': True})
mpl.rcParams.update({'axes.titlesize': "medium"})
mpl.rcParams.update({'axes.xmargin': 0})
mpl.rcParams.update({'legend.fontsize': "small"})
mpl.rcParams.update({'axes.axisbelow': True})
mpl.rcParams.update({'grid.linewidth': 0.25})
mpl.rcParams.update({'grid.linestyle': ":"})
......@@ -78,7 +83,7 @@ def init_pykat_plotting(mode="display", dpi=100):
mpl.rcParams.update({'savefig.pad_inches': 0.05})
mpl.rcParams.update({'xtick.labelsize': "small"})
mpl.rcParams.update({'ytick.labelsize': "small"})
mpl.rcParams.update({'axes.formatter.useoffset': False})
mpl.rcParams.update({'axes.formatter.useoffset': True})
def figure(width="full", height=0.618, textwidth=6, **kwargs):
"""
......
import os
import contextlib
__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):
import matplotlib.pyplot as plt
plt.style.use(get_style_path(style))
def context(style, after_reset=False):
import matplotlib.pyplot as plt
return plt.style.context(get_style_path(style), after_reset)
# PATCHES
patch.facecolor: r
# FONT
font.size : 11
# TEXT
text.usetex : False
# AXES
axes.grid : True
axes.formatter.useoffset : True
axes.formatter.use_locale : False
axes.prop_cycle: cycler('color', ['0000FF', 'FF0000', '000000', '00FF00', 'FF00FF'])
#TICKS
xtick.labelsize : 9
ytick.labelsize : 9
# GRIDS
grid.color : 999999
grid.linestyle : :
grid.linewidth : 0.25
# FIGURES
figure.titlesize : 12
figure.figsize : 6, 3.708
figure.dpi : 96
# IMAGES
image.cmap : magma
image.origin : lower
# SAVING FIGURES
savefig.dpi : 300
savefig.bbox : tight
pdf.compression : 9
pdf.fonttype : 42
# AXES
axes.prop_cycle : cycler("color", ["000000", "2c2d2d", "525353", "888989", "d1d3d4"]) + cycler("linestyle", ["-", "--", ":", "-.", "-"])
# IMAGES
image.cmap : gray
# FONT
font.family : serif
font.size : 9
# FIGURE
figure.figsize : 6.69291, 4.13645
# TEXT
text.usetex : True
# -*- 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',
'ifo/adv/files/*.kat',
'ifo/voyager/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