Thanks to visit codestin.com
Credit goes to github.com

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
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<!-- Name: Changelog -->
#Changelog
# Changelog

## Sckzor's Changes

I have moderized the Python API calls to allow Akhab to continue to function
with modern python interpreters.

## Changelog for v 0.18

Version 0.18 represents the culmination of almost two months of efforts, yet
another step in the current time-based release scheme.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The code should be easy to read and modify, the main language is Python -- 2 or
News
-----

- In order to allow the continued use of Akhab with modern versions of Python, I have updated the API calls.
- It's with a heavy heart that I write that @ggventurini passed away on September 15th, 2015, at the age of thirty-two. He will be remembered fondly as a friendly and helpful engineer, always excited about his work at CERN and his numerous labors to improve the accessibility of tools for science, research, and development.
- Ahkab v0.18 was released on July 12 2015, including new features, bugfixes and improved documentation. It is recommended to upgrade. Check out [the release notes](https://github.com/ahkab/ahkab/releases/tag/v0.18) for more!
- The whole codebase has been going through a (yet incomplete) refactoring and documenting effort. The [new documentation is available on RTD](http://ahkab.readthedocs.org/en/latest/).
Expand Down
4 changes: 2 additions & 2 deletions ahkab/ac.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def ac_analysis(circ, start, points, stop, sweep_type=None,
stype=sweep_type, op=x0, outfile=outfile)

# setup the initial values to start the iteration:
j = np.complex('j')
j = complex('j')

Gmin_matrix = dc_analysis.build_gmin_matrix(
circ, options.gmin, mna.shape[0], verbose)
Expand Down Expand Up @@ -393,7 +393,7 @@ def _generate_Nac(circ):
"""
n_of_nodes = circ.get_nodes_number()
Nac = np.zeros((n_of_nodes, 1), dtype=complex)
j = np.complex('j')
j = complex('j')
# process `ISource`s
for elem in circ:
if isinstance(elem, components.sources.ISource) and elem.abs_ac is not None:
Expand Down
7 changes: 5 additions & 2 deletions ahkab/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@
from __future__ import (unicode_literals, absolute_import,
division, print_function)

import importlib
import importlib.util

import copy
import math

Expand Down Expand Up @@ -982,8 +985,8 @@ def add_user_defined(self, module, label, param_dict):
if module_name in circuit.user_defined_modules_dict:
module = circuit.user_defined_modules_dict[module_name]
else:
fp, pathname, description = imp.find_module(module_name)
module = imp.load_module(module_name, fp, pathname, description)
fp, pathname, description = importlib.util.find_spec(module_name)
module = importlib.import_module(module_name, fp, pathname, description)
circuit.user_defined_modules_dict.update({module_name: module})

elem_class = getattr(module, label)
Expand Down
2 changes: 1 addition & 1 deletion ahkab/fourier.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import numpy.fft as fft

from scipy.interpolate import InterpolatedUnivariateSpline
from scipy.signal import (bartlett, hann, hamming, blackman,
from scipy.signal.windows import (bartlett, hann, hamming, blackman,
blackmanharris, gaussian, kaiser)

from . import options
Expand Down
8 changes: 5 additions & 3 deletions ahkab/netlist_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@
from __future__ import (unicode_literals, absolute_import,
division, print_function)


import sys
import imp
import importlib
import importlib.util
import math
import copy
import os
Expand Down Expand Up @@ -1140,8 +1142,8 @@ def parse_elem_user_defined(line, circ):
module = circuit.user_defined_modules_dict[module_name]
else:
try:
fp, pathname, description = imp.find_module(module_name)
module = imp.load_module(module_name, fp, pathname, description)
fp, pathname, description = importlib.util.find_spec(module_name)
module = importlib.import_module(module_name, fp, pathname, description)
except ImportError:
raise NetlistParseError("module " + module_name + " not found.")
circuit.user_defined_modules_dict.update({module_name: module})
Expand Down
2 changes: 1 addition & 1 deletion ahkab/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def save_figure(filename, fig=None):
fig = pylab.gcf()
fig.set_size_inches(*options.plotting_save_figsize)
pylab.savefig(filename, dpi=100, bbox_inches='tight',
format=options.plotting_outtype, pad=0.1)
format=options.plotting_outtype)
fig.set_size_inches(*options.plotting_display_figsize)

def _data_abs_arg_pass(res, label):
Expand Down
6 changes: 3 additions & 3 deletions ahkab/transient.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@

from __future__ import (unicode_literals, absolute_import,
division, print_function)

import sys
import imp

import numpy as np
import importlib
import importlib.util

from . import dc_analysis
from . import implicit_euler
Expand Down Expand Up @@ -657,7 +657,7 @@ def import_custom_df_module(method, print_out):
The df module or None if the module is not found.
"""
try:
df = imp.load_module(imp.find_module(method.lower()))
df = importlib.import_module(importlib.util.find_spec(method.lower()))
if print_out:
print("Custom df module "+method.lower()+" loaded.")
except:
Expand Down