@@ -34,7 +34,7 @@ class LinearTransform:
34
34
a linear transformation.
35
35
"""
36
36
37
- def __init__ (self , in_start = None , in_end = None , out_start = None , out_end = None ):
37
+ def __init__ (self , in_start = 0.0 , in_end = None , out_start = 0.0 , out_end = None ):
38
38
"""
39
39
Sets up the transformation such that `in_start` gets mapped to
40
40
`out_start` and `in_end` gets mapped to `out_end`. The following
@@ -56,24 +56,19 @@ def __init__(self, in_start=None, in_end=None, out_start=None, out_end=None):
56
56
- both ends are missing: set ranges to 1.0
57
57
- one end is missing: set it to the other end
58
58
"""
59
- self ._in_offset = 0.0 if in_start is None else in_start
60
- self ._out_offset = 0.0 if out_start is None else out_start
61
-
62
- if in_end is None :
63
- if out_end is None :
64
- self ._in_scale = 1.0
65
- else :
66
- self ._in_scale = out_end - self ._in_offset
67
- else :
59
+ if in_end is not None :
68
60
self ._in_scale = in_end - self ._in_offset
69
-
70
- if out_end is None :
71
- if in_end is None :
72
- self ._out_scale = 1.0
73
- else :
74
- self ._out_scale = in_end - self ._out_offset
61
+ elif out_end is None :
62
+ self ._in_scale = 1.0
75
63
else :
64
+ self ._in_scale = out_end - self ._in_offset
65
+
66
+ if out_end not is None :
76
67
self ._out_scale = out_end - self ._out_offset
68
+ elif in_end is None :
69
+ self ._out_scale = 1.0
70
+ else :
71
+ self ._out_scale = in_end - self ._out_offset
77
72
78
73
def __call__ (self , x ):
79
74
"""
@@ -92,8 +87,7 @@ def __call__(self, x):
92
87
if counts .min () < 0 :
93
88
counts += counts .min ()
94
89
95
- fig = plt .figure ()
96
- ax1 = fig .add_subplot (111 )
90
+ fig , ax1 = plt .subplots ()
97
91
ax2 = fig .add_subplot (111 , sharex = ax1 , sharey = ax1 , frameon = False )
98
92
99
93
ax1 .plot (temp_C , counts , drawstyle = 'steps-mid' )
0 commit comments