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