GithubHelp home page GithubHelp logo

galacticdynamics-oxford / agama Goto Github PK

View Code? Open in Web Editor NEW
71.0 71.0 34.0 44.3 MB

Action-based galaxy modeling framework

License: Other

Makefile 0.08% Python 11.74% C++ 66.06% C 0.22% Fortran 0.11% Jupyter Notebook 21.77%

agama's People

Contributors

eugvas avatar

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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

agama's Issues

Gadget-4 plugin

Hi Eugene,
I am considering using Gadget4 in the future at some point for its scalability. Gadget4 allows one to add external potential by editing grav_external.cc. It would be great to incorporate Agama into Gadget4 as the external potential (e.g., specified by an .ini file) in a similar way to the Agama NEMO plugin. Do you have any general suggestions for the implementation?
I haven't dived into it at the moment and might get back with more specific questions in the future.
Just wondering if you happen to have any plans for making a plugin for Gadget4 or be interested in making an example for incorporating agama into Gadget4.

Error when Importing Agama: dlopen symbol not found in flat namespace

I've tried installing agama a few different ways with varying success on an M1 Macbook Air running macOS 12.4 Monterey. The most recent attempts using pip install --user agama or python setup.py install --user appear to compile fine in an anaconda environment with python 3.8, but produce an error when attempting to import agama:

% python
Python 3.8.13 (default, Mar 28 2022, 06:13:39) 
[Clang 12.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import agama
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/jglad/Downloads/Agama-master/agama.so, 0x0002): symbol not found in flat namespace '__ZNKSt12__basic_fileIcE7is_openEv'

Any advice or help would be appreciated.

Problems of installing agama on mac osx

I have problems on installing Agama on my mac osx (10.15.7, Catalina)
When I do pip install agama
I get this message that openMP is not supported... -Any idea?

Thanks a lot for your feedback!
Mathias

Collecting agama
Using cached https://files.pythonhosted.org/packages/e4/41/e89578bc985f05166687f2500c0f522f2bfc732705c75400fb5a83ddc305/agama-1.00.tar.gz
Running /private/var/folders/d0/d081jvpd35j9s1wrjm5sjg280000gn/T/pip-install-otxxdm2v/agama/setup.py
Downloading the latest version of package from github
Building wheels for collected packages: agama
Building wheel for agama (setup.py) ...
==== Checking supported compiler options and available libraries ====

\Warning, OpenMP is not supported
If you're compiling on MacOS with clang, you'd better install another compiler such as GCC
Do you want to continue without OpenMP? [Y/N]

ld: symbol(s) not found for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
**** Trying the options provided by python3.7-config --ldflags ****
**** Trying the following options for linking against Python library ****
x86_64-apple-darwin13.4.0-clang++ -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -fPIC -Wall -O2 -std=c++11 -march=native -Wno-missing-field-initializers test.cpp -o ./agamatest.so -I"/Users/schultheis/opt/anaconda3/include/python3.7m" -I"/Users/schultheis/opt/anaconda3/lib/python3.7/site-packages/numpy/core/include" -shared -fPIC -L/Users/schultheis/opt/anaconda3/lib/python3.7/config-3.7m-darwin -lpython3.7m -ldl -framework CoreFoundation
ld: warning: -pie being ignored. It is only used when linking a main executable
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libdl.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libdl.tbd
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd
ld: symbol dyld_stub_binder not found (normally in libSystem.dylib). Needed to perform lazy binding to function _PyCapsule_GetPointer for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
error: Could not compile test program which uses libpython3.7

ERROR: Failed building wheel for agama

Add a getUnits() function in py_wrapper?

I'm working on some code that uses both Gala and Agama, but needs to construct an Agama potential on-the-fly and compare with unit-ful output from Gala, and so it would be useful if there was a way to retrieve the current units that are used by Agama. Is there a way to do this already that I missed? Since there is agama.setUnits() it might make sense to provide a agama.getUnits() to retrieve the current unit state?

Feature request: enclosed mass in Python interface

Hi Eugene,
In the C++ part of the documentation, you mentioned "Methods of the BaseDensity class include enclosedMass (compute the mass enclosed within a given spherical radius) and totalMass".
However, it seems only the totalMass being exposed to the Python density/potential object. I am wondering if it would be useful to add enclosedMass to the python interface as well.
(I ask here just in case it is simple to implement, please decide by your own priority of course! :)

In case it may be useful to someone facing the same task as mine, here are two workarounds,

  1. The function totalMass accepts a single radius as input, unfortunately, it does not support arrays.
  2. For a spherical system, one can use pot.force to get GM(<r)/r^2 and hence M(<r).

Installing on Intel Mac 10.15 w/ Anaconda Python 3.8

Hey Eugene,

This is not a bug report, but wanted to document a hiccup I ran into when building on a new laptop. Using the solutions from #3 got agama and the python wrapper to build, but when I imported from Python I would get:

>>> import agama
Fatal Python error: _PyInterpreterState_Get(): no current thread state
Python runtime state: unknown

[1]    83458 abort      python

After a bunch of googling, I found some relevant discussion here. Ultimately, the solution was to add (as suggested in that post)

LINK_FLAGS    += -undefined dynamic_lookup

🤷

NaN values for total energy in RAGA

Hi,
I was performing a simulation involving ~131k particles. It is a two component system with one set of particles have masses 0.1 times the other set of particles. I found that when I used a non-zero value for the coulomb logarithm, I found that the simulation starts reporting NaN values for energy after a few timesteps. Is this behavior expected? If not, how should one go about troubleshooting it?

Thank you.

Error in installation using pip

If I make AGAMA a package dependency in my requirements file it cannot be installed on a CI or ReadTheDocs because the new PIP version resolver checks Agama's metadata and doesn't like the difference between 1.0b and 1.0.

Collecting agama
  Downloading agama-1.0b.tar.gz (2.1 kB)
  WARNING: Requested agama from https://files.pythonhosted.org/packages/20/e5/a378745ddd3d06acdabf07dd05ead1df2a3bb972aadfe5f06f54c2edabce/agama-1.0b.tar.gz#sha256=01817ab0939dbe85f4e28a810841976e29f96805110c48aa02524ddc5422b4c4 (from test-package==0.1.dev31+ga4c0ef1), but installing version 1.0

central density of King profile

I found a strange behavior with King profile in agama:

import agama
den = agama.Density(type='King', W0=10)
den.density([0., 0, 0]), den.density([1e-100, 0, 0])
# output
# (inf, 0.007955322088520804)

I am sorry if it has already been resolved in recent updates. My agama version is '1.0 compiled on Jan 12 2022'.
Anyway, I would be fine with den.density([1e-100, 0, 0]) as a proxy for now :)

BTW, I wanted the density in the center because I am calculating the amplitude of the distribution function (Gieles & Zocchi 2015, eq. 1 and 30).

compilation fails on CentOS

Hi Eugene,

I'm installing agama on our computing cluster, which runs CentOS. The Python installation is via conda. I cloned the GitHub repository and ran the setup.py as instructed, after loading the GSL module. However, the compilation eventually throws this error and crashes: make: *** No rule to make target 'extras/include/Eigen/src/SparseCore/Spar', needed by 'obj/math_linalg.o'. Stop. error: Compilation failed

Have you seen this before? Apologies if I'm doing something wrong, I have minimal experience with C. The full trace is below:

python setup.py install --user
running install
running bdist_egg
running egg_info
writing agama.egg-info/PKG-INFO
writing dependency_links to agama.egg-info/dependency_links.txt
writing top-level names to agama.egg-info/top_level.txt
reading manifest file 'agama.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'agama.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
Makefile.local already exists, should we use it (Y) or generate a new one (N)? N

    ==== Checking supported compiler options and available libraries ====

c++ -fPIC -Wall -O2 test.cpp -o test.out 
c++ -fPIC -Wall -O2 test.cpp -o test.out -fopenmp -Werror -Wno-unknown-pragmas
c++ -fPIC -Wall -O2 -fopenmp test.cpp -o test.out -std=c++11
c++ -fPIC -Wall -O2 -fopenmp -std=c++11 test.cpp -o test.out -march=native
c++ -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native test.cpp -o test.out -qno-opt-dynamic-align
c++: error: unrecognized command line option ‘-qno-opt-dynamic-align’
c++ -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native test.cpp -o test.out -Werror -Wno-missing-field-initializers
c++ -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers test.cpp -o test.out -Werror -Wno-cast-function-type
    **** Trying the following options for linking against Python library ****
c++ -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type test.cpp -o ./agamatest.so -I"/n/home03/vchandra/.conda/envs/outerhalo/include/python3.8" -I"/n/home03/vchandra/.conda/envs/outerhalo/lib/python3.8/site-packages/numpy/core/include" -shared -fPIC /n/home03/vchandra/.conda/envs/outerhalo/lib/libpython3.8.so -lpthread -ldl -lutil -lrt -lm
c++ -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type test.cpp -o ./agamatest.exe ./agamatest.so
/usr/bin/ld: warning: libpython3.8.so.1.0, needed by ./agamatest.so, not found (try using -rpath or -rpath-link)
./agamatest.so: undefined reference to `PyObject_GetAttrString'
./agamatest.so: undefined reference to `PyCapsule_Type'
./agamatest.so: undefined reference to `PyRun_SimpleStringFlags'
./agamatest.so: undefined reference to `PyExc_AttributeError'
./agamatest.so: undefined reference to `PyErr_Format'
./agamatest.so: undefined reference to `Py_Finalize'
./agamatest.so: undefined reference to `_Py_Dealloc'
./agamatest.so: undefined reference to `PyImport_ImportModule'
./agamatest.so: undefined reference to `PyErr_SetString'
./agamatest.so: undefined reference to `PyCapsule_GetPointer'
./agamatest.so: undefined reference to `PyExc_RuntimeError'
./agamatest.so: undefined reference to `PyModule_Create2'
./agamatest.so: undefined reference to `PyExc_ImportError'
./agamatest.so: undefined reference to `Py_Initialize'
./agamatest.so: undefined reference to `PyErr_Print'
collect2: error: ld returned 1 exit status
Trying rpath
    **** Trying the following options for linking against Python library ****
c++ -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type test.cpp -o ./agamatest.so -I"/n/home03/vchandra/.conda/envs/outerhalo/include/python3.8" -I"/n/home03/vchandra/.conda/envs/outerhalo/lib/python3.8/site-packages/numpy/core/include" -shared -fPIC /n/home03/vchandra/.conda/envs/outerhalo/lib/libpython3.8.so -lpthread -ldl -lutil -lrt -lm -Wl,-rpath,/n/home03/vchandra/.conda/envs/outerhalo/lib
c++ -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type test.cpp -o ./agamatest.exe ./agamatest.so
    **** Successfully linked using these options ****
c++ -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type test.cpp -o ./agamatest.so -Iextras/include -DHAVE_PYTHON -I"/n/home03/vchandra/.conda/envs/outerhalo/include/python3.8" -I"/n/home03/vchandra/.conda/envs/outerhalo/lib/python3.8/site-packages/numpy/core/include" -Lextras/lib /n/home03/vchandra/.conda/envs/outerhalo/lib/libpython3.8.so -lpthread -ldl -lutil -lrt -lm -Wl,-rpath,/n/home03/vchandra/.conda/envs/outerhalo/lib -lgsl -lgslcblas -fPIC -shared
c++ -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type test.cpp -o ./agamatest.exe ./agamatest.so
c++ -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type test.cpp -o test.out -Iextras/include -DHAVE_PYTHON -I"/n/home03/vchandra/.conda/envs/outerhalo/include/python3.8" -I"/n/home03/vchandra/.conda/envs/outerhalo/lib/python3.8/site-packages/numpy/core/include"
c++ -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type test.cpp -o test.out -Iextras/include -DHAVE_PYTHON -I"/n/home03/vchandra/.conda/envs/outerhalo/include/python3.8" -I"/n/home03/vchandra/.conda/envs/outerhalo/lib/python3.8/site-packages/numpy/core/include" -DHAVE_EIGEN -Lextras/lib /n/home03/vchandra/.conda/envs/outerhalo/lib/libpython3.8.so -lpthread -ldl -lutil -lrt -lm -Wl,-rpath,/n/home03/vchandra/.conda/envs/outerhalo/lib -lgsl -lgslcblas
c++ -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type test.cpp -o ./agamatest.so -Iextras/include -DHAVE_PYTHON -I"/n/home03/vchandra/.conda/envs/outerhalo/include/python3.8" -I"/n/home03/vchandra/.conda/envs/outerhalo/lib/python3.8/site-packages/numpy/core/include" -DHAVE_EIGEN -DHAVE_CVXOPT -Lextras/lib /n/home03/vchandra/.conda/envs/outerhalo/lib/libpython3.8.so -lpthread -ldl -lutil -lrt -lm -Wl,-rpath,/n/home03/vchandra/.conda/envs/outerhalo/lib -lgsl -lgslcblas -lglpk -fPIC -shared
c++ -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type test.cpp -o ./agamatest.exe ./agamatest.so
c++ -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type test.cpp -o ./agamatest.so -Iextras/include -DHAVE_PYTHON -I"/n/home03/vchandra/.conda/envs/outerhalo/include/python3.8" -I"/n/home03/vchandra/.conda/envs/outerhalo/lib/python3.8/site-packages/numpy/core/include" -DHAVE_EIGEN -DHAVE_CVXOPT -DHAVE_GLPK -Lextras/lib /n/home03/vchandra/.conda/envs/outerhalo/lib/libpython3.8.so -lpthread -ldl -lutil -lrt -lm -Wl,-rpath,/n/home03/vchandra/.conda/envs/outerhalo/lib -lgsl -lgslcblas -lglpk -lunsio -lnemo -fPIC -shared
c++ -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type test.cpp -o ./agamatest.exe ./agamatest.so

    ==== Compiling the C++ library ====

c++ -c -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type -Isrc -Iextras/include -DHAVE_PYTHON -I"/n/home03/vchandra/.conda/envs/outerhalo/include/python3.8" -I"/n/home03/vchandra/.conda/envs/outerhalo/lib/python3.8/site-packages/numpy/core/include" -DHAVE_EIGEN -DHAVE_CVXOPT -DHAVE_GLPK -DHAVE_UNSIO -MMD -MP -o "obj/interface_c.o" "src/interface_c.cpp"
c++ -c -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type -Isrc -Iextras/include -DHAVE_PYTHON -I"/n/home03/vchandra/.conda/envs/outerhalo/include/python3.8" -I"/n/home03/vchandra/.conda/envs/outerhalo/lib/python3.8/site-packages/numpy/core/include" -DHAVE_EIGEN -DHAVE_CVXOPT -DHAVE_GLPK -DHAVE_UNSIO -MMD -MP -o "obj/interface_fortran.o" "src/interface_fortran.cpp"
c++ -c -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type -Isrc -Iextras/include -DHAVE_PYTHON -I"/n/home03/vchandra/.conda/envs/outerhalo/include/python3.8" -I"/n/home03/vchandra/.conda/envs/outerhalo/lib/python3.8/site-packages/numpy/core/include" -DHAVE_EIGEN -DHAVE_CVXOPT -DHAVE_GLPK -DHAVE_UNSIO -MMD -MP -o "obj/interface_nemo.o" "src/interface_nemo.cpp"
c++ -c -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type -Isrc -Iextras/include -DHAVE_PYTHON -I"/n/home03/vchandra/.conda/envs/outerhalo/include/python3.8" -I"/n/home03/vchandra/.conda/envs/outerhalo/lib/python3.8/site-packages/numpy/core/include" -DHAVE_EIGEN -DHAVE_CVXOPT -DHAVE_GLPK -DHAVE_UNSIO -MMD -MP -o "obj/interface_python.o" "src/interface_python.cpp"
c++ -c -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type -Isrc -Iextras/include -DHAVE_PYTHON -I"/n/home03/vchandra/.conda/envs/outerhalo/include/python3.8" -I"/n/home03/vchandra/.conda/envs/outerhalo/lib/python3.8/site-packages/numpy/core/include" -DHAVE_EIGEN -DHAVE_CVXOPT -DHAVE_GLPK -DHAVE_UNSIO -MMD -MP -o "obj/math_core.o" "src/math_core.cpp"
c++ -c -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type -Isrc -Iextras/include -DHAVE_PYTHON -I"/n/home03/vchandra/.conda/envs/outerhalo/include/python3.8" -I"/n/home03/vchandra/.conda/envs/outerhalo/lib/python3.8/site-packages/numpy/core/include" -DHAVE_EIGEN -DHAVE_CVXOPT -DHAVE_GLPK -DHAVE_UNSIO -MMD -MP -o "obj/math_fit.o" "src/math_fit.cpp"
c++ -c -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type -Isrc -Iextras/include -DHAVE_PYTHON -I"/n/home03/vchandra/.conda/envs/outerhalo/include/python3.8" -I"/n/home03/vchandra/.conda/envs/outerhalo/lib/python3.8/site-packages/numpy/core/include" -DHAVE_EIGEN -DHAVE_CVXOPT -DHAVE_GLPK -DHAVE_UNSIO -MMD -MP -o "obj/math_gausshermite.o" "src/math_gausshermite.cpp"
c++ -c -fPIC -Wall -O2 -fopenmp -std=c++11 -march=native -Wno-missing-field-initializers -Wno-cast-function-type -Isrc -Iextras/include -DHAVE_PYTHON -I"/n/home03/vchandra/.conda/envs/outerhalo/include/python3.8" -I"/n/home03/vchandra/.conda/envs/outerhalo/lib/python3.8/site-packages/numpy/core/include" -DHAVE_EIGEN -DHAVE_CVXOPT -DHAVE_GLPK -DHAVE_UNSIO -MMD -MP -o "obj/math_geometry.o" "src/math_geometry.cpp"
make: *** No rule to make target 'extras/include/Eigen/src/SparseCore/Spar', needed by 'obj/math_linalg.o'.  Stop.
error: Compilation failed

Sampling refinement procedure error

Hello,

I am trying to create a sample of N stars through the sample() method through the GalaxyModel object through the Python interface. However, I noticed that for some parameters of the distribution function or potential, I get the following error: RuntimeError: Error in sample(): Error in sampleNdim: refinement procedure did not converge.

I have seen in the math_sample.cpp source code that there exists a maxNumIter variable which limits the number of iterations in the recursive refinement loop. This is set to 50.

My question is: is there any way I could change that constant? Or if that is not possible/recommended what would you suggest to do instead to obtain a sample?

Thank you in advance!

Paula Gherghinescu
University of Surrey

Logarithmic potential energy

I was playing with the logarithmic potential in Agama and comparing to my implementation in Gala but found an inconsistency. The definition in Agama states that the potential corresponds to (1/2) \sigma^2 \ln[ r_c^2 + x^2 + (y/p)^2 + (z/q)^2 ], but it looks like the parameter it accepts isv0. Is that the same as \sigma? If so, I would expect this:

import agama
agama_pot = agama.Potential(
    type="logarithmic",
    v0=0.1,
    scaleradius=2.5,
    axisRatioY=1.,
    axisRatioZ=1.,
)
print(agama_pot.potential([5., 0., 0.]))
# 0.007210030031772178

to return the same as

import numpy as np
0.5 * 0.1**2 * np.log(2.5**2 + 5**2)
# 0.017210096880912056

Am I misunderstanding the input parameters?

Inner cutoff radius for spherical models

Hello,
I was trying to construct isotropic spherical N-body models using mkspherical. For the purposes of my simulations, I need spherical models where there are no particles present inside some inner cutoff radius. Is this possible to do with Agama? If so, how?

Thank you.

Error during installation: relocation R_X86_64_32 against

I installed python 2.7.18 in my local directory /software/jwu549/myPy2/ on a HPC cluster using the source code downloaded from python.org. (I did not use the default python on the cluster because the corresponding python-dev was not installed. )To install agama, I used the following command:
/software/jwu549/myPy2/bin/python -m pip install agama

I got many messages like this:
relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC

Below is a screenshot of the message output
image

The same error occurred when trying to install agama from the source code using setup.py.

Installing on Mac with Python 3.7

Hey Eugene --

I'm trying to install Agama on a new machine running Mac 10.14.6 with an Anaconda installed Python 3.7.

I would rather not install a new C compiler and have to re-install Python and many other things, so I'm trying to roll with Clang and no OpenMP. I have gsl installed, but also into the Anaconda path. I created and edited a Makefile.local to add:

COMPILE_FLAGS += -I/Users/apricewhelan/anaconda/include/
LINK_FLAGS    += -L/Users/apricewhelan/anaconda/lib/ -lgsl -lgslcblas

and removed -fopenmp. I have gfortran installed, but also ran into issues compiling the Fortran code, so I commented out the Fortran compile lines in Makefile - they look like they only run a test file, so it didn't seem crucial, but maybe this is a problem?

In any case, running make does succeed, and it produces the agama.so shared library. However, when I try to import with Python, I get:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define module export function (PyInit_agama)

Any ideas?

Generating randomized N-body initial conditions with Agama

Hi,
I was using the python interface to agama to take the output from phaseflow to generate N-body initial conditions. I was wondering if there was a way to set a random seed to generate randomized initial conditions. So far I have used np.random.seed() and random.seed() but they seem to have no effect.

Thank you.

Generating rotating star clusters

Hello,
I was wondering if there was any way to generate rotating (uniform mass) king profile models in Agama? I read through the Agama handbook but was still a bit confused. I assume you would have to add an angular momentum component in the z-direction to the distribution function and sample from that but I am not sure how to do that in Agama.

Thank you for your help!

Example python scripts do not work on newer python versions

When I was going through the example python scripts in the py folder, I noticed that some scripts do not work on newer python versions specifically python 3.10.

For example the script example_actions_nbody.py fails because it tries to use time.clock(). The function time.clock() has been deprecated since python 3.3 and was removed in python 3.8. The alternative function is time.perf_counter() released in python 3.3.

In order to support the newer versions of python, the scripts need to be changed to avoid using deprecated/removed functions.

Should the scripts be updated to only use the newer functions or should the use of the older functions be supported still via something like try: tbegin = time.clock() except AttributeError: tbegin = time.perf_counter()?

It might be nice to use updated f-strings for string formatting as well instead of the old % string formatting.

Windows Installation not working

I am trying to install Agama on my Windows 10x64 machine, however the setup.py script seems to have issues, making it crash on the GSL installation step :

  • the variable commitname is undefined (used on line 542), which I am guessing should be set to the same value as the variable archivename as that will be the way the folder in the git archive will be named.
  • the hash de1c175ee239ea0f243bf72016bad2e53338e830 does not resolve to a valid commit on the https://github.com/BrianGladman/gsl/ repository, making the retrieval of the gsl archive fail.
  • Even after fixing these issues (by using the latest commit of the gsl repo), line 558, os.chdir(dirname+'\\build.vc') crashes because no such directory exists in the uncompressed archive of the gsl repository, which I am not sure how to fix. My only guess is that this directory was part of an older commit and was later removed so that it is not present in the up to date repo of gsl ?

Kernel dies when using AGAMA after importing sklearn

I know this is probably totally anecdotal and not useful for anyone but I was so baffled by this that I thought it was worth reporting it.

Apparently, the kernel on my Jupyter Notebook (jupyter-lab) dies whenever I try to run AGAMA functions (with Torus Mapper it works fine; I did not do an exhaustive test of all the functions) if I have imported first sklearn.

This kind of interaction never happened to me before with AGAMA for any package. I just happened to be copy-pasting the import list from another Notebook that had the sklearn import.

I attach a snapshot of the bug and here is the version list of my conda environment (I installed AGAMA like a year ago and have not update it):
agama 1.0 pypi_0 pypi
aiosignal 1.3.1 pypi_0 pypi
anyio 3.5.0 py310hca03da5_0
appnope 0.1.2 py310hca03da5_1001
argon2-cffi 21.3.0 pyhd3eb1b0_0
argon2-cffi-bindings 21.2.0 py310h1a28f6b_0
astropy 5.1 py310h96f19d2_0
astropy-healpix 0.7 py310hf1a086a_2 conda-forge
asttokens 2.0.5 pyhd3eb1b0_0
attrs 21.4.0 pyhd3eb1b0_0
babel 2.9.1 pyhd3eb1b0_0
backcall 0.2.0 pyhd3eb1b0_0
beautifulsoup4 4.11.1 py310hca03da5_0
blas 1.0 openblas
bleach 4.1.0 pyhd3eb1b0_0
boost 1.74.0 py310hd0bb7a8_5 conda-forge
boost-cpp 1.74.0 h32e41df_4 conda-forge
bottleneck 1.3.5 py310h96f19d2_0
brotli 1.0.9 h1a28f6b_7
brotli-bin 1.0.9 h1a28f6b_7
brotlipy 0.7.0 py310h1a28f6b_1002
bzip2 1.0.8 h620ffc9_4
c-ares 1.19.1 hb547adb_0 conda-forge
ca-certificates 2023.7.22 hf0a4a13_0 conda-forge
cairo 1.16.0 h302bd0f_3
certifi 2023.7.22 pyhd8ed1ab_0 conda-forge
cffi 1.15.1 py310h22df2f2_0
cfitsio 4.2.0 h2f961c4_0 conda-forge
charset-normalizer 2.0.4 pyhd3eb1b0_0
click 8.1.7 pypi_0 pypi
colorama 0.4.6 pyhd8ed1ab_0 conda-forge
comm 0.2.0 pypi_0 pypi
cryptography 38.0.1 py310h834c97f_0
cycler 0.11.0 pyhd3eb1b0_0
cython 3.0.0 py310h80987f9_0
debugpy 1.5.1 py310hc377ac9_0
decorator 5.1.1 pyhd3eb1b0_0
defusedxml 0.7.1 pyhd3eb1b0_0
dustmaps 1.0.12 py310hbe9552e_1 conda-forge
eigen 3.4.0 hc021e02_0 conda-forge
entrypoints 0.4 py310hca03da5_0
exceptiongroup 1.1.1 pyhd8ed1ab_0 conda-forge
executing 0.8.3 pyhd3eb1b0_0
expat 2.5.0 hb7217d7_1 conda-forge
extension-helpers 1.0.0 pyhd8ed1ab_0 conda-forge
fftw 3.3.9 h1a28f6b_1
filelock 3.13.1 pypi_0 pypi
fontconfig 2.14.2 h82840c6_0 conda-forge
fonttools 4.25.0 pyhd3eb1b0_0
freetype 2.12.1 h1192e45_0
frozenlist 1.4.0 pypi_0 pypi
gala 1.6.2.dev40+g953cae09 pypi_0 pypi
geos 3.11.2 hb7217d7_0 conda-forge
gettext 0.21.0 h826f4ad_0
giflib 5.2.1 h1a28f6b_0
glib 2.69.1 h98b2900_1
gmp 6.2.1 hc377ac9_3 anaconda
gmpy2 2.1.2 py310h8c48613_0 anaconda
graphite2 1.3.14 hc377ac9_1
gst-plugins-base 1.14.1 hf0a386a_0
gstreamer 1.14.1 he09cfb7_0
h5py 3.9.0 py310haafd478_0
harfbuzz 4.3.0 he9eebac_1
hdbscan 0.8.33 py310ha11ecec_1 conda-forge
hdf5 1.12.1 nompi_hd9dbc9e_104 conda-forge
healpy 1.16.2 py310h25f8736_0 conda-forge
icu 68.1 hc377ac9_0
idna 3.4 py310hca03da5_0
iniconfig 2.0.0 pyhd8ed1ab_0 conda-forge
ipykernel 6.15.2 py310hca03da5_0
ipython 8.4.0 py310hca03da5_0
ipython_genutils 0.2.0 pyhd3eb1b0_1
ipywidgets 8.1.1 pypi_0 pypi
jedi 0.18.1 py310hca03da5_1
jinja2 3.1.2 py310hca03da5_0
joblib 1.1.0 pyhd3eb1b0_0 anaconda
jpeg 9e h1a28f6b_0
json5 0.9.6 pyhd3eb1b0_0
jsonschema 4.16.0 py310hca03da5_0
jupyter 1.0.0 py310hca03da5_8
jupyter_client 7.3.5 py310hca03da5_0
jupyter_console 6.4.3 pyhd3eb1b0_0
jupyter_core 4.11.1 py310hca03da5_0
jupyter_server 1.18.1 py310hca03da5_0
jupyterlab 3.5.0 pyhd8ed1ab_0 conda-forge
jupyterlab-widgets 3.0.9 pypi_0 pypi
jupyterlab_pygments 0.1.2 py_0
jupyterlab_server 2.15.2 py310hca03da5_0
kiwisolver 1.4.2 py310hc377ac9_0
krb5 1.20.1 h69eda48_0 conda-forge
lcms2 2.12 hba8e193_0
lerc 3.0 hc377ac9_0
libbrotlicommon 1.0.9 h1a28f6b_7
libbrotlidec 1.0.9 h1a28f6b_7
libbrotlienc 1.0.9 h1a28f6b_7
libclang 12.0.0 default_hc321e17_4
libcurl 8.1.2 h912dcd9_0 conda-forge
libcxx 14.0.6 h848a8c0_0
libdeflate 1.8 h1a28f6b_5
libedit 3.1.20210910 h1a28f6b_0
libev 4.33 h642e427_1 conda-forge
libexpat 2.5.0 hb7217d7_1 conda-forge
libffi 3.4.2 hc377ac9_4
libgfortran 5.0.0 11_3_0_hca03da5_28
libgfortran5 11.3.0 h009349e_28
libiconv 1.16 h1a28f6b_2
libllvm12 12.0.0 h12f7ac0_4
libnghttp2 1.52.0 hae82a92_0 conda-forge
libopenblas 0.3.21 h269037a_0
libpng 1.6.37 hb8d0fd4_0
libpq 12.15 h02f6b3c_1
libsodium 1.0.18 h1a28f6b_0
libsqlite 3.42.0 hb31c410_0 conda-forge
libssh2 1.11.0 h7a5bd25_0 conda-forge
libtiff 4.4.0 had003b8_1
libwebp 1.2.4 h68602c7_0
libwebp-base 1.2.4 h1a28f6b_0
libxml2 2.9.14 h8c5e841_0
libxslt 1.1.35 h9833966_0
libzlib 1.2.13 h53f4e23_5 conda-forge
llvm-openmp 14.0.6 hc6e5704_0
lz4-c 1.9.3 hc377ac9_0
markupsafe 2.1.1 py310h1a28f6b_0
matplotlib 3.5.3 py310hca03da5_0
matplotlib-base 3.5.3 py310hc377ac9_0
matplotlib-inline 0.1.6 py310hca03da5_0
matplotlib-venn 0.11.9 pypi_0 pypi
mistune 0.8.4 py310h1a28f6b_1000
mpc 1.1.0 h8c48613_1 anaconda
mpfr 4.0.2 h695f6f0_1 anaconda
mpmath 1.2.1 pypi_0 pypi
msgpack 1.0.7 pypi_0 pypi
munkres 1.1.4 py_0
nbclassic 0.3.5 pyhd3eb1b0_0
nbclient 0.5.13 py310hca03da5_0
nbconvert 6.4.4 py310hca03da5_0
nbformat 5.5.0 py310hca03da5_0
ncurses 6.4 h7ea286d_0 conda-forge
nest-asyncio 1.5.5 py310hca03da5_0
notebook 6.4.12 py310hca03da5_0
nspr 4.33 hc377ac9_0
nss 3.74 h142855e_0
numexpr 2.8.3 py310h5a06f4b_0
numpy 1.23.3 py310h220015d_1
numpy-base 1.23.3 py310h742c864_1
opencv 4.6.0 py310he2359d5_2
openssl 3.1.1 h53f4e23_0 conda-forge
packaging 21.3 pyhd3eb1b0_0
pandas 1.4.4 py310hc377ac9_0
pandocfilters 1.5.0 pyhd3eb1b0_0
parso 0.8.3 pyhd3eb1b0_0
pcre 8.45 hc377ac9_0
pexpect 4.8.0 pyhd3eb1b0_3
pickleshare 0.7.5 pyhd3eb1b0_1003
pillow 9.2.0 py310h4d1bdd5_1
pip 22.2.2 py310hca03da5_0
pixman 0.40.0 h27ca646_0 conda-forge
pluggy 1.0.0 pyhd8ed1ab_5 conda-forge
ply 3.11 py310hca03da5_0
progressbar2 4.2.0 pyhd8ed1ab_0 conda-forge
prometheus_client 0.14.1 py310hca03da5_0
prompt-toolkit 3.0.20 pyhd3eb1b0_0
prompt_toolkit 3.0.20 hd3eb1b0_0
protobuf 4.25.1 pypi_0 pypi
psutil 5.9.0 py310h1a28f6b_0
psycopg2 2.8.6 py310hf27765b_1 anaconda
ptyprocess 0.7.0 pyhd3eb1b0_2
pure_eval 0.2.2 pyhd3eb1b0_0
pycparser 2.21 pyhd3eb1b0_0
pyerfa 2.0.0 py310h1a28f6b_0
pygments 2.11.2 pyhd3eb1b0_0
pyopenssl 22.0.0 pyhd3eb1b0_0
pyparsing 3.0.9 py310hca03da5_0
pyqt 5.15.7 py310hc377ac9_0
pyqt5-sip 12.11.0 pypi_0 pypi
pyrsistent 0.18.0 py310h1a28f6b_0
pysocks 1.7.1 py310hca03da5_0
pytest 7.4.0 pyhd8ed1ab_0 conda-forge
pytest-runner 6.0.0 pyhd8ed1ab_0 conda-forge
python 3.10.12 h01493a6_0_cpython conda-forge
python-dateutil 2.8.2 pyhd3eb1b0_0
python-fastjsonschema 2.16.2 py310hca03da5_0
python-utils 3.8.1 pyhd8ed1ab_0 conda-forge
python_abi 3.10 3_cp310 conda-forge
pytz 2022.1 py310hca03da5_0
pywavelets 1.3.0 py310h1a28f6b_0
pyyaml 6.0 pypi_0 pypi
pyzmq 23.2.0 py310hc377ac9_0
qt-main 5.15.2 ha2d02b5_7
qt-webengine 5.15.9 h2903aaf_4
qtconsole 5.3.2 py310hca03da5_0
qtpy 2.2.0 py310hca03da5_0
qtwebkit 5.212 h0f11f3c_4
ray 2.8.0 pypi_0 pypi
readline 8.2 h1a28f6b_0
requests 2.28.1 py310hca03da5_0
scikit-learn 1.0.2 py310h59830a0_1 anaconda
scipy 1.9.3 py310h20cbe94_0
send2trash 1.8.0 pyhd3eb1b0_1
setuptools 65.5.0 py310hca03da5_0
shapely 2.0.1 py310h605c0e7_1 conda-forge
sip 6.6.2 py310hc377ac9_0
six 1.16.0 pyhd3eb1b0_1
sniffio 1.2.0 py310hca03da5_1
soupsieve 2.3.2.post1 py310hca03da5_0
sqlite 3.39.3 h1058600_0
stack_data 0.2.0 pyhd3eb1b0_0
sympy 1.10.1 py310hca03da5_0 anaconda
terminado 0.13.1 py310hca03da5_0
testpath 0.6.0 py310hca03da5_0
threadpoolctl 2.2.0 pyh0d69192_0 anaconda
tk 8.6.12 hb8d0fd4_0
toml 0.10.2 pyhd3eb1b0_0
tomli 2.0.1 pyhd8ed1ab_0 conda-forge
tornado 6.2 py310h1a28f6b_0
traitlets 5.1.1 pyhd3eb1b0_0
typing-extensions 4.3.0 py310hca03da5_0
typing_extensions 4.3.0 py310hca03da5_0
tzdata 2022f h04d1e81_0
urllib3 1.26.12 py310hca03da5_0
wcwidth 0.2.5 pyhd3eb1b0_0
webencodings 0.5.1 py310hca03da5_1
websocket-client 0.58.0 py310hca03da5_4
wheel 0.37.1 pyhd3eb1b0_0
widgetsnbextension 4.0.9 pypi_0 pypi
xz 5.2.6 h1a28f6b_0
yaml 0.2.5 h1a28f6b_0
zeromq 4.3.4 hc377ac9_0
zlib 1.2.13 h53f4e23_5 conda-forge
zstd 1.5.2 h8574219_0

Screenshot 2023-12-14 at 11 05 15

document of Einasto profile

Hi Eugene,
I am using the Einasto profile and want to make sure I understand the document correctly. The "eta" mentioned here
image
is the same "eta" in the following?
image
Or is it a typo of "xi=1/n"?

Thanks!

Logarithmic potential does support ActionFinder

Hi Eugene,

Hope you are doing well!

I'm exploring the functionalities of actions in Agama. Runing the following code,

import agama
pot = agama.Potential(type='Logarithmic', scaleRadius=1, v0=1)
af = agama.ActionFinder(pot, interp=False)

I got such error,

ValueError: Error in ActionFinder initialization: Interpolator: can only work with potentials that tend to zero as r->infinity

I guess I can understand the interpolation won't work for infinitely deep potential like Logarithmic, since it is hard to define an appropriate interpolation table. However, I'm a bit surprised, because, naively, I thought we only need interpolation when interp=True is specified. Is this behavior expected? Thanks.

Best regards,

Zhaozhou

galpypot.py

Hi everyone,

I'm trying to run galpypot.py, unfortunately, I faced the following problem in lines 156 - 165, where I have to create an array of initial conditions

ic is the array of initial conditions: R, z, phi, vR, vz, vphi
def compare(ic, inttime, numsteps): times = _numpy.linspace(0, inttime, numsteps)

integrate the orbit in galpy using MWPotential2014 from galpy
g_orb_obj = galpy.orbit.Orbit([ic[0],ic[3],ic[5],ic[1],ic[4],ic[2]]) dt = time.time() g_orb_obj.integrate(times, g_pot) g_orb = g_orb_obj.getOrbit() print('Time to integrate orbit in galpy: %.4g s' % (time.time()-dt))

Now, I have two questions:
1- How to create this array?
2- I had created an arbitrary array ic=[11.1, 12.24, 7.25, 11.1, 12.24, 7.25], then I got the following problem
`---------------------------------------------------------------------------
NameError Traceback (most recent call last)
in ()
1 g_orb_obj = galpy.orbit.Orbit([mar[0],mar[3],mar[5],mar[1],mar[4],mar[2]])
2 dt = time.time()
----> 3 g_orb_obj.integrate(times, g_pot)
4 g_orb = g_orb_obj.getOrbit()
5 print('Time to integrate orbit in galpy: %.4g s' % (time.time()-dt))

NameError: name 'times' is not defined
`

Kindly advise me.

Use of new models

Hi!

I noticed that you published about the new distribution functions exponential model some time ago(James Binney and Eugene Vasiliev 2022), but when I quoted it,it return "Error in creating distribution function: Unknown type of distribution function". I have tried to reinstall Agama, but there are still error. So, how should I use the new model?

Thank you very much!

Memory leak?

Hi!

I have been using the ActionMapper method heavily and I noticed that, whenever I use it, the memory pressure only increases (and very fast). Even when it is finished, or even if I delete the ActionMapper object and create it again when I move from one set of actions to the next set in the 3D grid I am using, the allocated memory does not go down.

I am wondering if I am doing something wrong or not but a simple call like

%%timeit -n 1000
am = agama.ActionMapper(pot, np.array([240.00000066666666, 1e-01, 360.0]))

made python consume 1Gb of RAM in seconds, which I cannot get back until I restart my Jupyter kernel. Could it be this the issue? That I work with Jupyter notebooks?

Thank you in advance!

Installing Agama Windows 10 / Python 3.9.0

Hello there,
I'm trying to install Agama on my Windows 10 as follows:

python setup.py install --user

The following error occurs:

...
copying .\Doxyfile -> build\lib.win-amd64-3.9\agama
copying .\INSTALL -> build\lib.win-amd64-3.9\agama
copying .\LICENSE -> build\lib.win-amd64-3.9\agama
copying .\README -> build\lib.win-amd64-3.9\agama
running build_ext

    ==== Checking supported compiler options and available libraries ====

g++ -Wall test.cpp -o /dev/null
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: cannot open output file /dev/null.exe: No such file or directory
collect2.exe: error: ld returned 1 exit status
error: Could not locate a compiler (set CXX=... environment variable to override)

It seems this error is general for windows 10 devices, as I also tried in my colleague's laptop and the same issue occurs.

Could someone please assist?
Thank you!

Wrong Potential for Gas and DarkMatter particles

Hi!
I'm using Agama with python 2 (anaconda/2/2019.03) to evaluate the vertical action of MW-like galaxies in the IllustrisTNG simulation.
I'm having problems in evaluating the potentials of stars and gas particles.

  • The input data are x,y,z and mass of particles in kpc and Msun, respectively
  • I'm using agama.setUnits(mass=1, length=1, velocity=1)

The code runs but when I plot the circular velocity profile of gas and stars, it goes like crazy, and compared within the ones evaluated with the mass enclosed they are completely wrong.

Do you have any idea of what can be the problem?

About the tolerance of the Torus Mapper fitting

This is probably an out-of-place question but... is there a way to set the tolerance of the fitting process happening in the Torus Mapper routine?

Well, in reality, what I want to know is the default tolerance in case the referee asks me jeje I did not find it in the documentation and digging into the C code looks time consuming, so I thought I should ask first before starting in case it was written somewhere.

Thanks in advance!

artificial density oscillations in the outskirt of Spheroid potential

Hi Eugene,

I noticed that the density profile of agama spheroid potential sometimes shows oscillations in the outskirt, see e.g., the blue curve below. It is generated by the following code.

pot1 = agama.Potential(
    type='Spheroid',
    densityNorm=1, scaleRadius=1,
    alpha=1, beta=3, gamma=1,
    outerCutoffRadius=4, cutoffStrength=2,
)

In the beginning, I was surprised, because I thought the density profile is analytical. Later, I realized it is because of the limited grid number of multipole decomposition (right?).

For potential directly generated by specifying a density function with type=Multipole, we may use keywords rmin, rmax, gridSizeR etc to specify the desired precision (see the orange curve with gridSizeR=2000).
But these keywords seem to not work for the Spheroid potential object, as I have tried. It is a bit wired since Spheroid is implemented by Multipole as well (right?).

While I understand people usually do not care about the very low-density region, it might be good to allow users to control the precision of Spheroid (and maybe other default available potentials) when strange behavior appears.

image

Simulation with binary SMBH and two component mass function crashing after some timesteps

Hi,
I was running a simulation with 131072 particles consisting of a two component mass function with a binary SMBH at the center (I am attaching the initial conditions inside). I used a value of Coulomb logarithm = ln (0.3 * M_{SMBH} / M_{\odot} = 13.8 when I noticed that after a few timesteps I get the following error

terminate called after throwing an instance of 'std::invalid_argument'
  what():  BaseInterpolator2d: fvalues must be finite (fvalues[234,0]=inf)
Stack trace (11 functions, starting from the most recent one):
/hildafs/projects/phy200019p/diptajym/p3_final_sims/raga_tests/lowres_q_0.1_seg_stellar/agama.so(+0x1be281) [0x1483a9861281]
/hildafs/projects/phy200019p/diptajym/p3_final_sims/raga_tests/lowres_q_0.1_seg_stellar/agama.so(math::BaseInterpolator2d::BaseInterpolator2d(std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&, math::IMatrixDense<double> const&)+0x187) [0x1483a98642d7]
/hildafs/projects/phy200019p/diptajym/p3_final_sims/raga_tests/lowres_q_0.1_seg_stellar/agama.so(math::CubicSpline2d::CubicSpline2d(std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&, math::IMatrixDense<double> const&, bool, double, double, double, double)+0x3b) [0x1483a986439b]
/hildafs/projects/phy200019p/diptajym/p3_final_sims/raga_tests/lowres_q_0.1_seg_stellar/agama.so(galaxymodel::SphericalIsotropicModelLocal::SphericalIsotropicModelLocal(potential::PhaseVolume const&, math::IFunction const&, math::IFunction const&, std::vector<double, std::allocator<double> > const&)+0x1897) [0x1483a98ee187]
/hildafs/projects/phy200019p/diptajym/p3_final_sims/raga_tests/lowres_q_0.1_seg_stellar/agama.so(+0x2b04b9) [0x1483a99534b9]
/hildafs/projects/phy200019p/diptajym/p3_final_sims/raga_tests/lowres_q_0.1_seg_stellar/agama.so(raga::RagaTaskRelaxation::finishEpisode()+0x2dd) [0x1483a9953b9d]
/hildafs/projects/phy200019p/diptajym/p3_final_sims/raga_tests/lowres_q_0.1_seg_stellar/agama.so(raga::RagaCore::doEpisode(double)+0xb31) [0x1483a99432a1]
./raga.exe() [0x401215]
/lib64/libc.so.6(__libc_start_main+0xf3) [0x1483a85377b3]
./raga.exe() [0x4012ee]

I checked the energy conservation and potential at the center and they seemed reasonable to me. I also used a triaxial symmetry like you suggested previously. What could be the source of this error?

Thank you for your help!
raga_smbhb.zip

Versioned tag or release plan

Hi!

I am preparing your project for inclusion in Guix's Astronomical packages collection and have noticed that the code has never been released and there are no versioned tags in Git. Having a release version would help package maintainers to update it downstream.

I would use the latest commit of the current master branch.

Thanks,
Oleg.

GOMP version issue via python 3.9.8 (agama 1.0)

I am trying to install and run Agama on the clusters here in Surrey and for some reason I get the following issue:

IPython 8.18.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import agama

ImportError Traceback (most recent call last)
Cell In[1], line 1
----> 1 import agama

File /vol/ph/astro_code/dhendriks/pyenv/versions/3.9.8/envs/agama3.9.8/lib/python3.9/site-packages/agama/init.py:1
----> 1 from .agama import * # import everything from the C++ library
2 from .agama import version, doc # these two are not automatically imported
3 from .py.pygama import * # and everything from the Python extension submodule

ImportError: /usr/lib/x86_64-linux-gnu/libgomp.so.1: version `GOMP_4.5' not found (required by /vol/ph/astro_code/dhendriks/pyenv/versions/3.9.8/envs/agama3.9.8/lib/python3.9/site-packages/agama/agama.so)

The problem likely lies on the side of the server not having the correct libraries, but I wonder if this issue has been encountered before.

Cannot install Agama on my Apple Silicon Monterey

I am not sure if this has been asked before (could not find it) but I am having problems installing Agama on the new Apple M1 chips. I will try to solve it myself but thought better to report it here so that anyone can find it.

First of all, I created a conda environment with python 3.9. Then, I run python setup.py install --user --yes on the terminal and it failed. Here is the relevant part of the log:

==== Checking supported compiler options and available libraries ====
c++ -fPIC -Wall -O2 test.cpp -o test.out
c++ -fPIC -Wall -O2 test.cpp -o test.out -fopenmp -Werror -Wno-unknown-pragmas
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
c++ -fPIC -Wall -O2 test.cpp -o test.out -lgomp -Xpreprocessor -fopenmp -Werror -Wno-unknown-pragmas
test.cpp:1:10: fatal error: 'omp.h' file not found
#include <omp.h>
^~~~~~~
1 error generated.
c++ -fPIC -Wall -O2 test.cpp -o test.out -lomp -Xpreprocessor -fopenmp -Werror -Wno-unknown-pragmas
test.cpp:1:10: fatal error: 'omp.h' file not found
#include <omp.h>
^~~~~~~
1 error generated.
Warning, OpenMP is not supported
If you're compiling on MacOS with clang, you'd better install another compiler such as GCC
Do you want to continue without OpenMP? [Y/N] y
c++ -fPIC -Wall -O2 test.cpp -o test.out -std=c++11
c++ -fPIC -Wall -O2 -std=c++11 test.cpp -o test.out -march=native
clang: error: the clang compiler does not support '-march=native'
c++ -fPIC -Wall -O2 -std=c++11 test.cpp -o test.out -march=core2
clang: error: the clang compiler does not support '-march=core2'
c++ -fPIC -Wall -O2 -std=c++11 test.cpp -o test.out -qno-opt-dynamic-align
clang: error: unknown argument: '-qno-opt-dynamic-align'
c++ -fPIC -Wall -O2 -std=c++11 test.cpp -o test.out -Werror -Wno-missing-field-initializers
c++ -fPIC -Wall -O2 -std=c++11 -Wno-missing-field-initializers test.cpp -o test.out -Werror -Wno-cast-function-type
**** Trying the options provided by python3.9-config --ldflags ****
**** Trying the following options for linking against Python library ****
c++ -fPIC -Wall -O2 -std=c++11 -Wno-missing-field-initializers -Wno-cast-function-type test.cpp -o ./agamatest.so -I"/Users/pauramos/miniconda3/envs/python3_agama/include/python3.9" -I"/Users/pauramos/miniconda3/envs/python3_agama/lib/python3.9/site-packages/numpy/core/include" -shared -fPIC -L/Users/pauramos/miniconda3/envs/python3_agama/lib/python3.9/config-3.9-darwin -ldl -framework CoreFoundation
Undefined symbols for architecture arm64:
"_PyCapsule_GetPointer", referenced from:
_PyInit_agamatest in test-90ec7c.o
"_PyCapsule_Type", referenced from:
_PyInit_agamatest in test-90ec7c.o
"_PyErr_Format", referenced from:
_PyInit_agamatest in test-90ec7c.o
"_PyErr_Print", referenced from:
_PyInit_agamatest in test-90ec7c.o
"_PyErr_SetString", referenced from:
_PyInit_agamatest in test-90ec7c.o
"_PyExc_AttributeError", referenced from:
_PyInit_agamatest in test-90ec7c.o
"_PyExc_ImportError", referenced from:
_PyInit_agamatest in test-90ec7c.o
"_PyExc_RuntimeError", referenced from:
_PyInit_agamatest in test-90ec7c.o
"_PyImport_ImportModule", referenced from:
_PyInit_agamatest in test-90ec7c.o
"_PyModule_Create2", referenced from:
_PyInit_agamatest in test-90ec7c.o
"_PyObject_GetAttrString", referenced from:
_PyInit_agamatest in test-90ec7c.o
"_PyRun_SimpleStringFlags", referenced from:
bla() in test-90ec7c.o
run() in test-90ec7c.o
_PyInit_agamatest in test-90ec7c.o
"_Py_Finalize", referenced from:
run() in test-90ec7c.o
"_Py_Initialize", referenced from:
run() in test-90ec7c.o
"__Py_Dealloc", referenced from:
_PyInit_agamatest in test-90ec7c.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: Could not compile test program which uses libpython3.9

I do think the problem is that Xcode does not support OpenMP now. Then, reading the error I realised that the code can be compiled with GCC, but since I set '--yes' I did not get to change the compiler. I will try again without this before trying to install a second Clang compiler with brew.

explicitly including G in the calculation of Toomre Q in the example?

In the example code example_self_consistent_model3.py, the author calculates the Toomre Q values with:
ToomreQ = sigma[:,0]**0.5 * kappa / 3.36 / Sigma
This formula works fine with the default Agama unit system, in which G=1.
However, if one revises this code for their models and changes the unit system, the code will then give wrong Toomre Q values.
I would suggest explicitly including G in the formula and updating it to be
ToomreQ = sigma[:,0]**0.5 * kappa / 3.36 / Sigma / agama.G
It is a tiny issue but solving it may provide some tiny benefits.

Thanks!

Installing Agama

Hi everyone,
I'm trying to install Agama by its default mode, so I ran
python setup.py install --user

Then I got the following error:

Received: dyld: Library not loaded: @rpath/libpython3.6m.dylib
Referenced from: /Users/mardini/phd_research/Agama-master/pytest42.so
Reason: image not found
From py: Fatal Python error: PyThreadState_Get: no current thread

I would appreciate if you help me with this issue?

Discrepancy with Galpy when using agama.GalpyPotential

Hi!

Not sure if this issue has been already reported, it might just be my problem jeje

The thing is that I was checking things and tried to create and NFW profile using the PyGaia potential. The result is that when I tried to use the agama.GalpyPotential interface, the resulting AGAMA potential differs from what it should be.

If I then create a native AGAMA NFW with the same parameters I get the right answer. So my first instinct is to suspect that the agama.GalpyPotential interface is not converting the Galpy potential correctly. (see attached image)
Screenshot 2022-09-21 at 17 28 51

I just installed Galpy before doing this, so it is in its most recent version, 1.8.0. For AGAMA, I am using the setup we put together in the other issue: python 3.8 with the AGAMA version I have in my fork.

It is probably nothing but I just thought I should report it.

Cheers,

Number of sampling points of an orbit not equal to the requested value.

Code

Tested using Python 3.6.5, Agama 1.0 and Numpy 1.19.5.

Issue

I want to integrate the orbit of an object (taken from an N-body simulation) and sample its position along the orbit N times. However, I find that depending on the specified integration time range, you might obtain N-1 sampling points.

I suspect this is related to rounding, since whether I get the expected behaviour or not is dependent on whether I use times as directly measured from the simulation, copying the values printed in the console when I call print(simulation_times) or if I set the starting integration time equal to 0. A screenshot showing this behaviour is shown below for the example of N = 2.
image

Example code

I have attached the script used to generate the outputs shown above, as well as the potential, object ICs and time range values.
example.tar.gz

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.