Belle II Software  release-05-01-25
settings.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 """Settings file
5 
6 The logger for all classes in the distribution is defined here.
7 
8 """
9 __author__ = 'swehle'
10 
11 import logging
12 import matplotlib.pyplot as plt
13 
14 logging.basicConfig(level=logging.DEBUG,
15  format='%(name)-18s \t %(levelname)-8s %(message)s',
16  datefmt='%m-%d %H:%M',
17  )
18 
19 
20 class ProTool(object):
21 
22  """
23  All pro tools inherit form this class.
24  For now each class get a logger.
25 
26  Attributes
27  ----------
28  name : str
29  Name of the Class.
30  io : function
31  Returns the logger
32 
33  """
34 
35  def __init__(self, name):
36  """ init function
37  :param name: Name of the class
38  """
39 
40  self.name = name
41 
42  @property
43  def io(self):
44  """
45  Logging function
46  :return: logger
47  """
48  return logging.getLogger(self.name)
49 
50 
51 def create_figure(self, width=None, square=False, ratio=None):
52  """
53  Create a new figure
54  :param self:
55  :param width:
56  :param square:
57  :param ratio:
58  :return:
59  """
60  if ratio is None:
61  ratio = 1.618
62  if width is None:
63  width = 9
64  height = width if square else width / ratio
65  return plt.subplots(figsize=(width, height))
alignment.fancystuff.settings.ProTool.io
def io(self)
Definition: settings.py:43
alignment.fancystuff.settings.ProTool.__init__
def __init__(self, name)
Definition: settings.py:35
alignment.fancystuff.settings.ProTool.name
name
Name of the class.
Definition: settings.py:40
alignment.fancystuff.settings.ProTool
Definition: settings.py:20