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