Comments (9)
Hi Stevens,
try making it a pointer. In the cuba manual (cuba.pdf) it is defined as a (void *)
For instance
n = 0.5
p = ctypes.POINTER(c_int)(n)
Avoid this trap: #5 and this is the appropriate manual for ctypes: http://python.net/crew/theller/ctypes/tutorial.html
For debugging it can also useful to set the environment variable CUBACORES=1 disabling parallel execution.
Regarding separating pycuba out, I don't really see a benefit. Its a tiny package, and separation would triple the maintenance effort (e.g. creating the documentation) although the package might be more visible. I don't see the harm in having the other packages installed. Combining the packages also means that people might like to try out the other algorithms or switch between them. I see the package similar to scipy.integrate or a kind of scikit-integrate.
Cheers, Johannes
from pymultinest.
Hi Johannes,
Sorry it has been a while for me to get back to this project. I have tried what you suggest (except that I use c_double rather than c_int), and neither does it work. I think the problem is that when the userdata variable is passed to the Integrand function, in which it should be of type c_void_p, it is actually of type "int". I'm assuming this int is the address of the memory at which the userdata is stored, but I can't quite figure out more than that.
Cheers,
Steven
from pymultinest.
That is correct. Hopefully I will have time to look into the problem. I usually put my extra variables into a global variable and access them from the function. Maybe you can do that in the meantime?
from pymultinest.
Yes if you have time it would be nice to have this sorted. In the meantime I have been doing as you suggest and putting my extra variables as globals.
Cheers,
Steven
from pymultinest.
If you or someone else seriously needs this functionality in python, please re-open.
from pymultinest.
Hi Johannes,
I'm dealing with the same problem by putting my extra variables into a global variable, but I was wondering if there is any update for this issue and passing the userdata as a ctype variable?
Best,
Farnik
from pymultinest.
I don't really see the need to mangle it into C and then back out. You don't even need a global variable either, you can use a class with a method that accesses the classes attributes, or you could create a function that returns a function.
from pymultinest.
I agree with the approach @JohannesBuchner suggests -- wrapped functions or classes would be much easier.
from pymultinest.
Yeah I got it, thanks a lot!
from pymultinest.
Related Issues (20)
- Incorrect value in 2nd column of post_separate.dat file HOT 1
- Why does the eigenvalue decomposition in nested sampling program differ from the actual eigenvalue decomposition result? HOT 2
- Why does the eigenvalue decomposition in nested sampling program differ from the actual eigenvalue decomposition result?
- Why does the eigenvalue decomposition in nested sampling program differ from the actual eigenvalue decomposition result?
- Why does the eigenvalue decomposition in nested sampling program differ from the actual eigenvalue decomposition result?
- Why does the eigenvalue decomposition in nested sampling program differ from the actual eigenvalue decomposition result?
- pypi version of Pymultinest breaks HOT 7
- PyMultiNest crashes with Python 3.11 HOT 12
- Installing PyMultiNest on arm64 HOT 12
- Q: why is n_params necessary? HOT 2
- libcuba.so is not made HOT 2
- MPI parallelization not working HOT 11
- Increasing the number of equal weight posterior samples HOT 2
- Errors during installation of PyMultiNest HOT 1
- Nosetests failing for isochrones HOT 2
- Getting the total number of likelihood evaluations HOT 2
- Screen output during simulation and interrupting a run HOT 4
- ModuleNotFoundError HOT 5
- cannot create regular file '/usr/lib/libmultinest_mpi.so': Permission denied HOT 5
- macOS pymultinest installation HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pymultinest.