aaren / pharminv Goto Github PK
View Code? Open in Web Editor NEWPython interface to harminv
Python interface to harminv
I had difficulties installing pharminv...
Semms like Cython is a requirement. Can you include that into the documentation?
Edit: the errors below have to do with the settings in the example code. Changing fmin or setting dt helps. Not I'm getting the real sinusoid divided up into two entries, one with the same frequence but negative, both at half the amplitude. Is there some setting I'm missing?
Using Ubuntu 14.04, I installed harminv from apt-get, and pharminv using pip.
The example provided here runs without error, but does not appear to return the correct answer. The output of >> inversion is:
rec.array([ (-8.6253957423602e-11, 2.0112201361652824, 4.0738465133229765e-10, -0.009925186956024614, -2.7301732469689393e-08, 0.5000000012106294)],
dtype=[('frequency', '<f8'), ('amplitude', '<f8'), ('phase', '<f8'), ('decay', '<f8'), ('Q', '<f8'), ('error', '<f8')])
I tried removing one of the sinusoids and the result is similar.
By the way, thanks for writing what looks like a very useful tool.
I'm not sure is this the right place to let you know but the package on
https://pypi.python.org/pypi/pharminv
is broken: Readme.md is not included and therefore the module cannot be installed using pip install pharminv
There seems to be some issues with the output calculation of frequency and decay rate. The "number" coming out of the code are correct, but with a 10^3 order of magnitude mistake. The fact that both the (real) frequency and decay rate comes wrong with the same order of magnitude makes sense, since:
complex frequency = real frequency + i * decay rate
I have a test code that I'm sending over through your email if you want to see!
Best regards,
Alex
harminv does not import in python 3.5 (ubuntu 16.04) with error
In [1]: import harminv
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-2da652359f4a> in <module>()
----> 1 import harminv
/usr/local/lib/python3.5/dist-packages/pharminv-0.3-py3.5-linux-x86_64.egg/harminv/__init__.py in <module>()
----> 1 from harminv import Harminv, invert
ImportError: cannot import name 'Harminv'
This can be fixed by the following patch
From 5bd2352cf4a055fee6b4e19849e99395e1614dab Mon Sep 17 00:00:00 2001
From: Stepan Roucka <[email protected]>
Date: Wed, 12 Oct 2016 10:54:57 +0200
Subject: [PATCH] Fix imports for python3
---
harminv/__init__.py | 2 +-
harminv/harminv.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/harminv/__init__.py b/harminv/__init__.py
index a234b26..45f4fb2 100644
--- a/harminv/__init__.py
+++ b/harminv/__init__.py
@@ -1 +1 @@
-from harminv import Harminv, invert
+from .harminv import Harminv, invert
diff --git a/harminv/harminv.py b/harminv/harminv.py
index f56cc1f..c00cbce 100644
--- a/harminv/harminv.py
+++ b/harminv/harminv.py
@@ -1,6 +1,6 @@
import numpy as np
-import charminv
+from . import charminv
class Harminv(charminv.Harminv):
--
2.7.4
But it may break python 2 compatibility.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.