Debian Codegraph @

skrf/__init__.py

raw symbols SCIP
1 """
2 skrf is an object-oriented approach to microwave engineering,
3 implemented in Python.
4 """
5
6 __version__ = '1.10.0'
7 ## Import all module names for coherent reference of name-space
8 #import io
9
10
11 from . import (
12 calibration,
13 circuit,
14 constants,
15 frequency,
16 instances,
17 io,
18 mathFunctions,
19 media,
20 network,
21 networkSet,
22 qfactor,
23 taper,
24 tlineFunctions,
25 util,
26 vectorFitting,
27 )
28 from .calibration import *
29 from .circuit import *
30 from .constants import *
31
32 # Import contents into current namespace for ease of calling
33 from .frequency import *
34 from .instances import *
35 from .io import *
36 from .mathFunctions import *
37 from .network import *
38 from .networkSet import *
39 from .qfactor import *
40 from .taper import *
41 from .tlineFunctions import *
42 from .util import *
43 from .vectorFitting import *
44
45 # Try to import vi, but if except if pyvisa not installed
46 try:
47 import vi
48 from vi import *
49 except ImportError:
50 pass
51
52 # try to import data but if it fails whatever. it fails if some pickles
53 # dont unpickle. but its not important
54 try:
55 from . import data
56 except Exception:
57 pass
58
59 def __getattr__(name: str):
60 return getattr(instances._instances, name)
61
62 ## built-in imports
63 from copy import deepcopy as copy
64
65 ## Shorthand Names
66 F = Frequency
67 N = Network
68 NS = NetworkSet
69 C = Circuit
70 lat = load_all_touchstones
71 # saf = save_all_figs
72 saf = None
73 stylely = None
74
75
76 def setup_pylab() -> bool:
77 try:
78 import matplotlib
79 except ImportError:
80 print("matplotlib not found while setting up plotting")
81 return False
82
83 from . import plotting
84
85 global saf, stylely
86 saf = plotting.save_all_figs
87 stylely = plotting.stylely
88 return True
89
90
91 def setup_plotting():
92 plotting_environment = os.environ.get('SKRF_PLOT_ENV', "pylab").lower()
93
94 if plotting_environment == "pylab":
95 setup_pylab()
96 elif plotting_environment == "pylab-skrf-style":
97 if setup_pylab():
98 stylely()
99 # elif some different plotting environment
100 # set that up
101
102 plotting_available = setup_plotting()