GithubHelp home page GithubHelp logo

pyphs / pyphs Goto Github PK

View Code? Open in Web Editor NEW
44.0 8.0 18.0 182.33 MB

Modeling, simulation and code-generation of multiphysical Port-Hamiltonian Systems in Python.

Home Page: https://pyphs.github.io/pyphs

License: Other

Python 99.97% Shell 0.03%
port-hamiltonian-systems python simulation multiphysics code-generation c-plus-plus latex

pyphs's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyphs's Issues

matvecprod ShapeError in Typical use

New-user question here. I'm very interested in this package (and the port-hamiltonian approach to modelling in general) and started by running the example in ‘Typical use’.

(First, is this the place for such questions? I tried the Q&A Mailing list but found: « Vous n'êtes pas autorisé à accéder à ce contenu. (# 418 ) »)

The step

method = core.to_method()

raises, via pyphs.core.maths._matrices.matvecprod,

sympy.matrices.common.ShapeError: Dimensions incorrect for dot product: (4, 1), (1, 1)

The full error message: err.txt.

I suspect my SymPy 1.4 is too new; I installed it just now with conda.

Should I attempt to correct matvecprod or just revert to an older version of SymPy?

exploit symmetry in pwl functions

Within the dev branch:

>>> from pyphs.examples.pwl.pwl import graph
>>> print(graph.core.H.factor())
-1.0*(-19.52*xstor**2 - 3.33066907387547e-16*xstor*Abs(xstor) - 3.84*xstor*Abs(xstor - 3.2) - 2.88*xstor*Abs(xstor - 2.4) - 1.92*xstor*Abs(xstor - 1.6) - 0.960000000000001*xstor*Abs(xstor - 0.800000000000001) + 0.96*xstor*Abs(xstor + 0.8) + 1.92*xstor*Abs(xstor + 1.6) + 2.88*xstor*Abs(xstor + 2.4) + 3.84*xstor*Abs(xstor + 3.2) + 3.5527136788005e-15*xstor + 12.288*Abs(xstor - 3.2) + 6.912*Abs(xstor - 2.4) + 3.072*Abs(xstor - 1.6) + 0.768000000000001*Abs(xstor - 0.800000000000001) + 0.768*Abs(xstor + 0.8) + 3.072*Abs(xstor + 1.6) + 6.912*Abs(xstor + 2.4) + 12.288*Abs(xstor + 3.2) - 122.88)

We see the bottle-neck is the Absolute function. With a symmetric domain, half the evaluations can be saved!

Keep track of the changes in variables during the successive symbolic manipulations

Bonjour,

Au cours de la simulation à l'aide de l'instance simu = PHSSimulation(core, config), la réindexation des vecteurs pendant le processus entraine un affichage incohérant lors de l'appel à la fonction simu.data.plot().
Autrement dit, les graphes affichés ne correspondent pas à ce qui est indiqué, il y a une permutation entre les labels et les différentes courbes.
A l'aide de quelle instance peut-on récupérer la nouvelle indexation des vecteurs, ou toute autre donnée permettant de refaire coïncider graphes et labels?

De plus, lors de l'utilisation d'un x0 non nul dans PHSSimulation, est ce que l'indexation de ce x0 doit respecter l'ordre donné par la fonction core.x, ou un tout autre?

Merci

Discarding linear part of a quadratic Hamiltonian

Dear PyPHSers,
I have some troubles with PyPHS dealing with Hamiltonian such as
H = 1/2 * k * (x - x0)**2
with k some parameter (e.g., a stiffness), x the variable and x0 some offset value.
Calling obj the pyphs.Core instance, I got a difference between the gradient and the discrete gradient :
obj.dxH() -> k*(x-x0)
simu.method.dxH() -> k*(x+dx/2).

It appears to result from the splitting of the linear and nonlinear parts, the numerical method only considers the hessian Q: H is replaced by 1/2 x^T.Q.x which only retains the quadratic part of the Hamiltonian and discard its linear part (i.e. an constant offset in the gradient).

Is there some easy workaround ?

Issue when installing PyPHS

When running the command "pip install PyPHS", an old release is installed instead of the last one (see Terminal video).

install_pyphs.mov

'NodeView' object has no attribute 'index'

Hi (sorry for the font and size)
First thank you for all that work. I'm a hobbyist (C++ and juce) coding for fun as I love electric guitar a guitar pickups modeling application (a sort of Roland VG8ex ersatz for those who knows it).
I was VERY interested to play with PyPHS for the electric simulation of magnetic pickups in any configuration.
I'm on OS X 11.1 Big Sur. I installed Python 3.9.0, using also pyenv to switch to it. I piped PyPHS and tried to run the simplest exemple rlc.
I get an error "'NodeView' object has no attribute 'index'" when I run : python rlc.py (below)
As I'm a complete noob in python, must be a silly mistake I made.
Would you have a clue of what I'm doing wrong ?
I would greatly appreciate any help.
Regards. Luc

Read netlist rlc.net
from folder /Users/luc/pyphs/pyphs/examples/rlc/
read "electronics.source in ('#', 'n1'): type=voltage;"
read "electronics.resistor R ('n1', 'n2'): R=('R', 1e3);"
read "electronics.inductor L ('n2', 'n3'): L=('L', 0.05);"
read "electronics.capacitor C ('n3', '#'): C=('C', 2e-06)"
Build graph in...
Build graph R...
Build graph L...
Build graph C...
Build graph rlc...
Build core rlc...
Traceback (most recent call last):
File "/Users/luc/pyphs/pyphs/examples/rlc/rlc.py", line 22, in
core = netlist.to_core()
File "/Users/luc/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pyphs/graphs/netlists.py", line 223, in to_core
return graph.to_core(label=label)
File "/Users/luc/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pyphs/graphs/graph.py", line 101, in to_core
self._build_analysis(verbose=verbose, plot=plot)
File "/Users/luc/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pyphs/graphs/graph.py", line 64, in _build_analysis
self.analysis = GraphAnalysis(self, verbose=verbose, plot=plot)
File "/Users/luc/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pyphs/graphs/analysis.py", line 43, in init
index_datum = self.nodes.index(datum)
AttributeError: 'NodeView' object has no attribute 'index'

minor warnings related to manifest

To try out the patch suggested for #123, I had to reinstall pyphs from source (previous having merely done pip install pyphs). At the step python setup.py test, I received a couple of minor warnings

warning: no files found matching 'README'
warning: no files found matching 'LICENSE'

I suspect this will be easy to fix.

Implement constant inputs

It should be possible to specify a constant value when defining source components so that the associated input is automatically replaced at the simulation, thus reducing the effort of defining the system input vector. This shall be useful particularly for FAUST and JUCE targets.

simulation.init function does not update new length nt of input sequence

This script initializes simulation data from the example "RLC" of pyphs.
First, it creates an input zeros sequence u of length nt=L1, then another zeros sequence u of length nt=L2.

import os 
from pyphs import Netlist
os.chdir('C:/ProgramData/Anaconda3/Lib/site-packages/pyphs/examples/rlc')

my_netlist = Netlist('rlc.net')
my_simu = my_netlist.to_simulation(config = {'fs': 44100.,
          'split': True,
          'pbar': False,
          'timer': False,
          'lang': 'python'
          })

L1 = 100 #simulation length
L2 = 200 #another simulation length
        
my_simu.init(nt = L1)
print(len(list(my_simu.data.u()))) 
my_simu.init(nt = L2)
print(len(list(my_simu.data.u())))

However the generated data are both of length L1-1:

runfile('C:/Users/Tristan/Desktop/test_pyphs.py', wdir='C:/Users/Tristan/Desktop')
99
99

It seems that the first call of simulation.init sets the maximum length of the input sequence. Indeed, the script works for lengths less than L1:

L3 = 50
my_simu.init(nt = L3)
print(len(list(my_simu.data.u())))

50

Python 3.6, Windows 10, pyphs 0.2.0.1

Add rotary mechanical elements to PyPHS

Hi,
I want to use PyPHS in the rotary mechanical domain, so try to add _inertia.py, _stiffnessAngular.py, ... to PyPHS dictionary but in using both mass and inertia give this warning:
"warnings.warn(The storage components [xM_body, xJ_body] have been merged into xM_bodyJ body)"

Memory issues for huge number of samples

Hi,
investigating potential stability issues, we were looking the influence of the sampling rate on the apparent instability of C++ simulation results. For a quite high number of time samples, we can see that the memory used by the Python interpreter is exploding during the "Build data i/o" phase (and can even freeze the machine)

In fact, the initialization procedure (that prepares the input data to be stored in the HDF5 file) transforms the provided input values into a single numpy array.
This results in the interpreter (and the kernel) trying to allocate a huge contiguous block in memory (as expected by numpy) while it previously accepted python lists (that may be spread accross the memory) or generators (much more memory efficient, but deprecated in 5532261 ).

Moreover, the cast into a numpy array is possibly "performed" twice :
https://github.com/pyphs/pyphs/blob/master/pyphs/numerics/simulations/h5data/h5data.py#L341
https://github.com/pyphs/pyphs/blob/master/pyphs/numerics/simulations/h5data/h5data.py#L614
However, this has no performance impact, as no additional memory is allocated.

By now, h5py is not able to directly assign dataset from generators, but we can imagine some proxy function :

def set_dataset_from_generator(dataset, generator, chunksize=1024):
     offset, npt = 0, chunksize
     while npt:
         buffer = [el for ind, el in zip(range(chunksize), generator)]
         npt = len(buffer)
         dataset[offset: offset+npt] = buffer
         offset += npt

removing the memory issue when using generators.

Python 3 compatibility of module fraccalc.py

This regards the pyphs module located at pyphs/dictionary/fraccalc.py

The function fractionalIntegratorWeights(p=1, beta=0.5) runs on python 2.7 and provides

([1.749035908843339e-09,
  6.9595144826924863e-08,
  1.8630838378138305e-05,
  2.5524426185241214,
  30.823428129767155,
  359.65116239651917,
  10405809524.289852],
 [0.057174355022894495,
  0.23968633750938143,
  0.14935234505990999,
  5.0600536742396391,
  69.896011597466696,
  999.24983972175335,
  0.96100163823462381])

However, on python 3.5, it crashes at the scipy function minimize:
MuOpt = minimize(CostFunction, np.ones(NbPoles), bounds=bnds, tol=EPS) .
This seems to be related to the argument bounds, defined as
bnds = [(0, None) for n in range(NbPoles)] .

I found a workaround by defining a constraint instead of the argument bounds:
cons = {'type':'ineq', 'fun': lambda x: x}
and then calling the minimize function
MuOpt = minimize(CostFunction, np.ones(NbPoles), constraints=cons, tol=EPS).

This yields pretty close results on both python 2.7 and 3.5:

([5.2537955919623119e-10,
  8.7617674855431192e-08,
  4.248584273972994e-05,
  2.5524442241508281,
  30.823417010139337,
  359.65123662762471,
  10039015447.979877],
 [0.1903385814114813,
  0.19038402239644209,
  0.065493802706308585,
  5.0600504911897453,
  69.896036812634591,
  999.24963347911387,
  0.99611361809511623])

This needs to be checked (and maybe improved) on another plateform (I use Ubuntu 14.04).

pyphs '0.1.9.7.3'

Problem in write_netlist()

Problem occurs while running 'RLC' test. The 'add_path()' function works, then the script stops in 'write_netlist'.
The folder 'graphs' in pyphs might be not correctly added to pyphs package.

OS : Windows 10
VERSION : 3.5.1 |Anaconda 4.0.0 (64-bit)| (default, Feb 16 2016, 09:49:46) [MSC v.1900 64 bit (AMD64)]

runfile('C:/Users/trist/Documents/GitHub/pyphs/tests/RLC.py', wdir='C:/Users/trist/Documents/GitHub/pyphs/tests')
Reloaded modules: paths, pyphs, symbolics
Traceback (most recent call last):

File "", line 1, in
runfile('C:/Users/trist/Documents/GitHub/pyphs/tests/RLC.py', wdir='C:/Users/trist/Documents/GitHub/pyphs/tests')

File "C:\Users\trist\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 699, in runfile
execfile(filename, namespace)

File "C:\Users\trist\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 88, in execfile
exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)

File "C:/Users/trist/Documents/GitHub/pyphs/tests/RLC.py", line 124, in
write_netlist()

File "C:/Users/trist/Documents/GitHub/pyphs/tests/RLC.py", line 47, in write_netlist
from pyphs.graphs.netlists import Netlist

ImportError: No module named 'pyphs.graphs'; 'pyphs' is not a package

C++ code feature: CMakeLists.txt template

Hi pyphs users!

I've been having some troubles with th C++ simulation feature.

Informations

  • pyphs version: master branch on GitHub
  • cmake version: 3.5.1
  • Ubuntu version: 16.04.4 LTS Xenial Xerus

Everything is explained in the attached notebook.

Issue

Me and my colleagues had problems with the C++ code feature.
After some research I've determined that the CMakeLists.txt was responsible.

When the C++ 11 feature is activated:


   target_compile_features(<project_name> PUBLIC cxx_std_11)

CMake throws an error: this feature is unknown:


    -- The CXX compiler identification is GNU 5.4.0
    -- Check for working CXX compiler: /usr/bin/c++
    -- Check for working CXX compiler: /usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    CMake Error at CMakeLists.txt:31 (target_compile_features):
      target_compile_features specified unknown feature "cxx_std_11" for target
      "l".
    ```

    -- Configuring incomplete, errors occurred!
    See also "/home/victorw/git/vocal-phs/python/output/l/CMakeFiles/CMakeOutput.log".

Fix

I've changed the CMakeLists.txt template. Here is the link to the commit, on my own fork of pyphs:

https://github.com/WetzelVictor/pyphs/commit/badbc7cf396f9d4cf8f991bc07dea4c9e3f34f1e

I've replaced the target_compile_features(<project_name> PUBLIC cxx_std_11) by set (CMAKE_CXX_STANDARD 11)

What are your insights on this matter? Did I forget to mention some informations?

Thank you all
cpp_code_genration_example.tar.gz

Improve time to plot data

The data object in current master branch takes a lot of time for plots despite the data.nplots attribute is set to 200 which indicates it is not accounted. On the other hand, specifying the 'tslice' kwargs (e.g. simu.data.plot(tslice=slice(0,1000,200))) works well...

Cannot use greek letter with the LaTeX format

I need to use LaTeX character, and I tried to use greek letters for physical values (spring stiffness, damping coefficient) and python returns this error:

  File "/home/victorw/anaconda/envs/pyphs/lib/python3.6/site-packages/sympy/utilities/lambdify.py", line 434, in lambdify
    func = eval(lstr, namespace)

  File "<string>", line 1
    lambda \pi_i,\xi_i,d\pi_i,d\xi_i: ([276.45816*\xi_i, -10.0*\pi_i, -10.0*\pi_i])
                                                                                  ^
SyntaxError: unexpected character after line continuation character

Here is a simple code (damped mass-spring system)

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from pyphs import Core
import os

# Main system
label = 'issue_test'
core = Core(label)


#%% Adding storage components
# Masse m
pii = core.symbols('\\pi_i')
m = core.symbols('m')
Hm = pii**2/(2.*m)
core.add_storages(pii,Hm)

# Spring
xk, k = core.symbols([ '\\xi_i','k' ])
Hk = k*xk**2/2.
core.add_storages(xk, Hk)


#%% Adding dissipative component
wa, a = core.symbols(['w_a','a'])
za = a * wa
core.add_dissipations(wa, za)

#%% Add connections
core.set_Jxx([[0, -1 ],
              [+1, 0 ]])
core.set_Jxw([ [-1],
               [0]])

core.pprint()

#%% Initializing our system
m_g = 0.1
f0 = 440 #fundamental frequency (Hz)
k_Npm = m_g*(2*3.14157*f0)
kappa_Npm = 5
a_Nspm = 1.

vals = {m:m_g,
        k:k_Npm,
        a: a_Nspm}
core.subs.update(vals)

#%% Simulation
config = {'fs':44100,
          'path':os.path.join(os.getcwd(), label)
         }
T = 1.
nt = int(T*config['fs'])
simu = core.to_simulation(config=config)

I'm running PyPHS 0.2.0.1, on anaconda with Python 3.6.4, every dependencies is up-to-date.

Parametric analysis

Is there a way to efficiently perform a parametric analysis ?
In other words, perform simulations for a parameter taking sequentially a set of values (one for each simulation) avoiding building objects, methods and generating code for each value ?

Apply_connector needed between two add_connector calls in some cases

When using a connector-like element (like a 0 or 1 junction), I need to apply the first connector defined before I can add another connection
See test case where two connections are added to a PHS core defined as the combination of three simple PHS. Whether apply_connectors is called between the two add_connector changes the resulting PHS.

In this case, the connective ports can be manually eliminated, and the result shows that apply_connector has to be called at intermediate step.

Any idea about why this occurs ?

C++ generation fails on Windows

pyphs v0.2pre0rc0

with
simu.config['eigen_path'] = 'F:\afalaize\eigen'

the "include eigen" line in the generated core.h reads:
#include <F:�falaize\eigen/Eigen/Dense>

Rhodes Example: TypeError: can't convert expression to float

As mentioned in PR #128 I'm trying to fix the rhodes example. With the develop branch I'm getting this error now.

Traceback (most recent call last):
File "rhodes_new.py", line 95, in
inits={'x': x0})
File "/home/nils/Development/pyphs/pyphs/numerics/numerical_method/_method.py", line 311, in to_simulation
return Simulation(self, inits=inits, config=config, erase=erase)
File "/home/nils/Development/pyphs/pyphs/numerics/simulations/simulation.py", line 182, in init
self.init_numericalCore(erase=erase)
File "/home/nils/Development/pyphs/pyphs/numerics/simulations/simulation.py", line 250, in init_numericalCore
config=self.config_numeric())
File "/home/nils/Development/pyphs/pyphs/numerics/cpp/method2cpp.py", line 233, in method2cpp
parameters_files = parameters(subs, objlabel)
File "/home/nils/Development/pyphs/pyphs/numerics/cpp/method2cpp.py", line 289, in parameters
_append_subs(subs, files)
File "/home/nils/Development/pyphs/pyphs/numerics/cpp/method2cpp.py", line 331, in _append_subs
files['cpp'] += str(float(s[k])) + ', '
File "/home/nils/.local/lib/python3.7/site-packages/sympy/core/expr.py", line 280, in float
raise TypeError("can't convert expression to float")
TypeError: can't convert expression to float

implement python dictionary

implement a module so that netlists are described by python scripts which contain one module for each component (as done in test RLC.py)

Python doesn't raise errors if the C++ compilation fails

Hi PyPHS users!

I've been having troubles, related to the issue #99.

Summary

If an error occurs while running the run.sh for C++ compilation, Python doesn't raise any error and continues running.
Moreover, It displays older simulations results (obtained with the Python simulation method) if they exists, which could make you believe that it worked.


Minimal example

Informations
  • pyphs version: master branch on GitHub
  • cmake version: 3.5.1
  • Ubuntu version: 16.04.4 LTS Xenial Xerus

I took the same example as the one described on the issue #99, and specified a wrong cmake path to make the compilation fail:

import sys
sys.path.append('/home/victorw/anaconda/envs/dev_pyphs/workspace/lib_pyphs_dev/')
from pyphs import Core    # import the pyphs.Core class

label = 'dampedosc'       # system's label
core = Core(label)        # instanciate a Core object

xm = core.symbols('xm')    # mass state symbol
m = core.symbols('m')      # mass parameter symbol
hm = xm**2/(2.*m)          # kinetic energy expression
core.add_storages(xm, hm)  # add mass to Core

xk, k = core.symbols(['xk', 'K0']) # stiffness symbols
hk = k*xk**2/2.                    # potential energy expression
core.add_storages(xk, hk)          # add stiffness to Core 


wa, a = core.symbols(['w_a', 'a'])       # damper symbols
za = a*wa                                # damper expression
core.add_dissipations(wa, za)            # add damper to core

core.set_Jxx([[0, -1],
             [+1, 0]])
core.set_Jxw([[-1], 
             [0]])    

# ==================================
# ======= VALUES ===================
m_value = 0.1                         # mass value (kg)
F = 5e2                               # natural frequency (HZ)
k_value = m_value*(2*3.14157*F)**2    # stiffness value (N/m)
a_value = 1.                          # damper value (N.s/m)

mysubs = {m: m_value, 
        k: k_value,
        a: a_value}
core.subs.update(mysubs)                


# ==================================
# ========== SIMULATIONS ===========
import os                                
config = {'fs': 1e4,                                 # sample rate (Hz)
          'path': os.path.join(os.getcwd(), label),   # folder for output results
          'lang':'c++',
          'cmake':'usr/cmake' # <<<<<<<<<< It will fail on my machine
         }
T = 1.                                               # simulation time (s)
nt = int(T*config['fs'])                             # number of time steps (int)

simu = core.to_simulation(config=config)   # `Simulation` object.
simu.method.x                              # get state ordering


inits = {'x': [0.1, 0.]}                  # initial values
simu.init(nt=nt, inits=inits)             # initialize `Data` object

simu.process()                            # process

This script doesn't show any errors.


Fix

This PR #102 proposes a fix, based on a temp file. Everything is explained, step by step.

With this fix, Python raises this error:

Traceback (most recent call last):
  File "damped_osc.py", line 58, in <module>
    simu.process()                            # process
  File "/home/victorw/anaconda/envs/dev_pyphs/workspace/lib_pyphs_dev/pyphs/numerics/simulations/simulation.py", line 261, in process
    self._process_cpp()
  File "/home/victorw/anaconda/envs/dev_pyphs/workspace/lib_pyphs_dev/pyphs/numerics/simulations/simulation.py", line 367, in _process_cpp
    self._check_cpp_runtime_errors()
  File "/home/victorw/anaconda/envs/dev_pyphs/workspace/lib_pyphs_dev/pyphs/numerics/simulations/simulation.py", line 388, in _check_cpp_runtime_errors
    + os.path.join(self.cpp_path, stdError[-1]))
RuntimeError: Bash/Cmake error while trying to compile cpp simulation: see file /home/victorw/anaconda/envs/dev_pyphs/workspace/dampedosc/dampedosc/stderr: step 2 - Cmake Build

Thoughts

I'm really not sure this is the best way of fixing it, but I tested it a little, and it performs well and stops the execution of the Python script if something goes wrong.

We can discuss implementation on the PR #102. I raised more questions about this.

Thank you for your insights on this matter :)

Victor W.

Simulation path

Hi PyPHSers
In the current develop branch, I have some troubles to configure a path. When adding a path key/value in the config dictionary, I have complains about files not found, H5file not reachable, etc... I managed to solve for some of the troubles, but maybe the trouble is that I did not find some help about the expected organisation of a given simulation path.
Can you give some clues about which folder/subfolder are required to be created before the simulation ?

Best regards (and nice job with the HDF5 pull request)

Missing module in pyphs package for windows

Windows 10
Python v2.7

Script :
import pyphs
PHS = pyphs.PortHamiltonianObject(label='label', path='path')

Error message
File "xxxx/.spyder/temp.py", line 9, in
PHS = pyphs.PortHamiltonianObject(label='label', path='path')

File "xxxx\Anaconda2\lib\site-packages\pyphs\pyphs.py", line 93, in init
from symbolics.symbols import Symbols

ImportError: No module named symbolics.symbols

MPZ TypeError in graph analysis

pyphs 0.1.9.7.3
python 2.7.9
sympy 1.0

Error occurs while running the DLC described in the tutorial
https://afalaize.github.io/pyphs/#graphanalysis2016

  • Script
import pyphs
netlist = pyphs.PHSNetlist('dlc.net')
graph = pyphs.PHSGraph(netlist)
core = graph.buildCore()
  • Output

  File /pyphs/graphs/graph.py", line 53, in buildCore
    core.apply_connectors()

  File "/pyphs/core/core.py", line 516, in apply_connectors
    self.M = M[:nxwy, :nxwy] + M_connectors

  File "/sympy/core/decorators.py", line 118, in binary_op_wrapper
    return func(self, other)

  File "/sympy/matrices/dense.py", line 539, in __add__
    return super(DenseMatrix, self).__add__(_force_mutable(other))

  File "/sympy/matrices/matrices.py", line 579, in __add__
    ret[i] = [j + k for j, k in zip(alst[i], blst[i])]

  File "/sympy/core/decorators.py", line 77, in __sympifyit_wrapper
    return func(a, b)

  File "/sympy/core/numbers.py", line 930, in __add__
    return Float._new(mlib.mpf_add(self._mpf_, rhs, prec, rnd), prec)

  File "/mpmath/libmp/libmpf.py", line 768, in mpf_add
    return normalize1(ssign, sman, sexp, sbc, prec or sbc, rnd)

TypeError: argument is not an mpz


Module signal.SIGALRM does not exist on windows plateform

Hi,
A little issue while running pyphs on windows :

Script

import pyphs
dlc = pyphs.PortHamiltonianObject(label='dlc', path='label')
dlc.build_from_netlist('dlc_netlist.net')
dlc.texwrite()

Output

  File "...\pyphs\misc\timer.py", line 22, in timeout
    signal.signal(signal.SIGALRM, handler)

AttributeError: 'module' object has no attribute 'SIGALRM'

This error occurs in texwrite(). I think there might be the solution here.

Cheers,

Tristan

pyphs.__version__
'0.1.9c0_DEV'

redefinition of symbols are not allowed

Hi,
Thank you for such a great library.
I'm just stuck trying compiling Faust code generated by pyPHS.
I have this error stdfaust.lib:34 ERROR : redefinition of symbols are not allowed : vl

Maybe you have an idea ?
best,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.