Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions smithplot/smithaxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
parameters are array-like types (e.g. numpy.ndarray).
'''

from __future__ import division, print_function, unicode_literals

from collections import Iterable
from numbers import Number
from types import MethodType, FunctionType
Expand Down Expand Up @@ -558,7 +560,7 @@ def end_pan(self):
def drag_pan(self, button, key, x, y):
pass

def _moebius_z(self, *args, normalize=None):
def _moebius_z(self, *args, **kw):
'''
Basic transformation.

Expand All @@ -581,11 +583,12 @@ def _moebius_z(self, *args, normalize=None):
Performs w = (z - k) / (z + k) with k = 'axes.scale'
Type: Complex number or numpy.ndarray with dtype=complex
'''
normalize = kw.get('normalize', None)
normalize = self._normalize if normalize is None else normalize
norm = 1 if normalize else self._impedance
return smithhelper.moebius_z(*args, norm=norm)

def _moebius_inv_z(self, *args, normalize=None):
def _moebius_inv_z(self, *args, **kw):
'''
Basic inverse transformation.

Expand All @@ -608,6 +611,7 @@ def _moebius_inv_z(self, *args, normalize=None):
Performs w = k * (1 - z) / (1 + z) with k = 'axes.scale'
Type: Complex number or numpy.ndarray with dtype=complex
'''
normalize = kw.get('normalize', None)
normalize = self._normalize if normalize is None else normalize
norm = 1 if normalize else self._impedance
return smithhelper.moebius_inv_z(*args, norm=norm)
Expand Down Expand Up @@ -1005,7 +1009,7 @@ def draw_nonfancy(grid):
len_x, len_y = len(xticks) - 1, len(yticks) - 1

# 2. Step: calculate optimal gridspacing for each quadrant
d_mat = np.ones((len_x, len_y, 2))
d_mat = np.ones((len_x, len_y, 2), dtype=np.int)

# TODO: optimize spacing algorithm
for i in range(len_x):
Expand Down
8 changes: 6 additions & 2 deletions smithplot/smithhelper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
# last edit: 11.04.2018

from __future__ import division, print_function, unicode_literals

from collections import Iterable

import numpy as np
Expand Down Expand Up @@ -38,13 +40,15 @@ def z_to_xy(z):
return z.real, z.imag


def moebius_z(*args, norm):
def moebius_z(*args, **kw):
z = xy_to_z(*args)
norm = kw['norm']
return 1 - 2 * norm / (z + norm)


def moebius_inv_z(*args, norm):
def moebius_inv_z(*args, **kw):
z = xy_to_z(*args)
norm = kw['norm']
return norm * (1 + z) / (1 - z)


Expand Down