Giter Site home page Giter Site logo

Comments (5)

tchlux avatar tchlux commented on September 26, 2024

Hmm, I know exactly what's happening. The code is trying to parse the contents of the angle( ... ) and it is only prepared to see an integer or a reference to another variable there. A quick fix is to use angle(SIZE(n, 1), SIZE(n,2)) I believe, but I can look more into it this evening!

If you're interested in knowing how it works, the lines of code that parse out the assumed shapes of objects are here:
https://github.com/tchlux/fmodpy/blob/1.3.3/fmodpy/parsing/argument.py#L561-L591

from fmodpy.

koshMer avatar koshMer commented on September 26, 2024

Thanks for the fast reply :)
I went through the code a few times and i think i now have at least some understanding of what it does.
You seem to use "," as the identifier to differentiate between SIZE(array) and SIZE(array,axis). In the case above, there is "," in size() but no axis.
A quick fix (maybe?) could be to change

 if "," not in argument:

(L581) to

  if "," not in argument or ")," not in argument:

But that's not so general I think.

from fmodpy.

tchlux avatar tchlux commented on September 26, 2024

Good find! Yeah, but this code actually needs to translate the contents of SIZE(...) into viable Python code. That means wherever parentheses are used as indices they need to replaced by squared brackets. And any integer indices need to be shifted by -1. For efficiency's sake, if there are constant expressions then I should be actually computing their value and subtracting one from that (as in your case above).

So this is a little bit more involved of a fix to handle a reasonable number of cases. It might be a little while before I push a fix. For now, I would recommend using the SIZE(<array>, <axis>) formulation to make things work as is.

from fmodpy.

tchlux avatar tchlux commented on September 26, 2024

Okay, implemented a fix! 😁 Version 1.3.4 is now up and you can see the new logic in the code here:
https://github.com/tchlux/fmodpy/blob/1.3.4/fmodpy/parsing/argument.py#L570-L611

I tested it on the exact code block you have above and it appears to produce a correct result. However, I'll mention I think this is slightly less efficient on the Python wrapper side than doing SIZE(n, 1) and SIZE(n, 2), since accessing indices in the shape is faster than slicing and measuring the size.

from fmodpy.

koshMer avatar koshMer commented on September 26, 2024

Thanks! I'll have a look at it.
I switched to SIZE(n,1) etc. because I think that it also looks a bit cleaner and is faster to understand than SIZE(n(:,1)).

from fmodpy.

Related Issues (9)

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.