Coder Social home page Coder Social logo

alejandrobll / py-sphviewer Goto Github PK

View Code? Open in Web Editor NEW
70.0 16.0 29.0 31.56 MB

Py-SPHViewer is a framework for rendering cosmological simulations in Python using the Smoothed Particle Hydrodynamics scheme.

Home Page: https://alejandrobll.github.com/py-sphviewer

License: GNU General Public License v3.0

C 4.04% Python 18.10% Shell 0.01% Jupyter Notebook 77.85%
py-sphviewer smoothed-particle-hydrodynamics particle-data python visualisation n-body rendering gas sph cosmological

py-sphviewer's Introduction

Py-SPHViewer DOI

Py-SPHViewer is a publicly available Python package to visualise and explore N-body + Hydrodynamics simulations using the Smoothed Particle Hydrodynamics (SPH) scheme. The code estimates the underlying density field (or any other property) traced by a finite number of particles, and produces not only beautiful, but also scientifically useful images. In addition, Py-SPHViewer enables the user to explore simulated volumes using different projections.

Although the package was conceived as a rendering tool for cosmological SPH simulations, it can be used in a number of applications.

Intensive calculations are all performed in parallel C code. However, the package can be used interactively in a Python shell, Ipython or Ipython notebook.

Installation

The latest stable version of Py-SPHViewer is usually available in the Python Package Index (or Pypi for short). This is the easiest method to get Py-SPHViewer running in your system and we encourage users to follow it:

pip install py-sphviewer --user

Py-SPHViewer can also be installed using conda:

conda install -c alejandrobll py-sphviewer

The development version can be cloned, compiled and installed using the lines below:

git clone https://github.com/alejandrobll/py-sphviewer.git
cd py-sphviewer
python setup.py install

Changelogs

Py-SPHViewer is in active development. We often add new features and fix bugs. We list below the update notes:

  • version 1.2.1

    • Bug with convergence for low-resolution images fixed. We thank Josh Borrow for pointing the fix. We note that there is still an ongoing issue that prevents image convergence to better than 3% for intermediate to low resolution (when the physical smoothing of most particles overlaps very few pixels). If you need to reconstruct the field to better than 3%, please perform a convergence test and indentify the resolution above which you feel safe.
    • Render.get_image() now returns the actual surface density as in version 1.1.0 (this was dropped in v1.2).
  • version 1.2.0

    • Major change in the way particle data is stored and accessed by Scene. The result is a significant speed up of the code
    • Particles data must be of shape [N,3], in constrast with [3,N] that was used in earlier versions.
  • version 1.1.0

    • Py-SPHViewer is now compatible with Python 3. We thank Elliott Sales de Andrade (@QuLogic) for making this possible.
    • Image returned by Render.get_image(), or QuickView.get_image() is normalized by the pixel area. This means that the value of each pixel, when smoothing the particle mass, can be regarded as the actual surface density.
  • version 1.0.5

    • Scipy.weave is deprecated in Scipy 0.19, so we removed all dependencies to it.
    • Minor bugs fixed.
  • version 1.0.4

    • New QuickView tool for making quick visualisations (see this post for instructions).
    • We added a new directory "examples" that contains hdf5 files with simulation outputs. These are useful to perform quick tests.
    • Minor bugs fixed.

Getting started

To get started with Py-SPHViewer please visit the official website:

alejandrobll.github.io/py-sphviewer

Acknowledging the code

Py-SPHViewer is under GNU GPL v3 licence, and was started by Alejandro Benitez-Llambay. This program is distributed in the hope that it will be useful, but without any warranty.

Individuals or organizations that use Py-SPHViewer are encouraged to cite the code.

If Py-SPHViewer has been significant for a research project that leads to a publication, please acknowledge by citing the project and using the following DOI as reference:

Alejandro Benitez-Llambay. (2015). py-sphviewer: Py-SPHViewer v1.0.0. Zenodo. 10.5281/zenodo.21703

You may also use the the following BibTex:

 @misc{alejandro_benitez_llambay_2015_21703,
 author       = {Alejandro Benitez-Llambay},
 title        = {py-sphviewer: Py-SPHViewer v1.0.0},
 month        = jul,
 year         = 2015,
 doi          = {10.5281/zenodo.21703},
 url          = {http://dx.doi.org/10.5281/zenodo.21703}
 }

Some of the scientific papers that used Py-SPHViewer are listed here

Contributing

Users are encouraged to contribute with ideas, codes or by reporting (and fixing) bugs.

Issues and bugs should be reported by creating issues in the main repository. If you would like to contribute with code that adds new feature, tool, or that fixes a bug, you are very welcome to do so by submitting a pull request.

If you plan to work on a major improvement, or on a new feature that requires a significant effort from your side, please contact me at [email protected] first so that we can sort out the technical aspects prior starting the development.

py-sphviewer's People

Contributors

alejandrobll avatar christopherlovell avatar jborrow avatar qulogic 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

py-sphviewer's Issues

hsv colormap tutorial

Hi, i'm trying to create a plot like the one in your gallery but i cant figure out how do make a 2D colormap that shows 2 different features at ones. I was hoping you had an example of how did you make the hsv_sigma2_density2 image.

ImportError: cannot import name 'scene'

Hi,

I am a new user of this useful package~ I installed it by command

conda install -c alejandrobll py-sphviewer

I meet the following error message

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/KunFang/anaconda/envs/py-sphviewer/lib/python3.6/site-packages/sphviewer/Scene.py", line 114, in __init__
    self._x, self._y, self._hsml, self._kview = self.__compute_scene()
  File "/Users/KunFang/anaconda/envs/py-sphviewer/lib/python3.6/site-packages/sphviewer/Scene.py", line 160, in __compute_scene
    from .extensions import scene
ImportError: cannot import name 'scene'

when I tried to run codes:

x = np.random.randn(1000)
y = np.random.randn(1000)
xmin = np.min(x)
xmax = np.max(x)
ymin = np.min(y)
ymax = np.max(y)
x0 = (xmin+xmax)/2.
y0 = (ymin+ymax)/2.
pos = np.zeros([len(x),3])
pos[:,0] = x
pos[:,1] = y
w = np.ones(len(x))
P = sph.Particles(pos, w, nb=32)

I was wondering if there is anyway to solve it, thanks!

Kun

spy-viewer does not install on mac osx 10.8.5

Hi, I've tries all the installation options as described on the main page (pip install, git build-it-yourself) but I didn't succeed. A long list of errors is generated, of which I shall include the main ones below. But the part that struck me most was one of the first lines:
"creating build/lib.macosx-10.5-x86_64-2.7"
while I have 10.8. Are you sure this should work on modern iMacs?

I hope you can help. If needed, I can send you the complete log file from the installation.

Kind regards,

Hermen

Some snippets from the log-file:
...
fatal error: 'omp.h' file not found
Failed building wheel for py-sphviewer
Running setup.py bdist_wheel for pykdtree

In file included from /Users/hermen/anaconda/envs/sph/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1728:
/Users/hermen/anaconda/envs/sph/lib/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"

35 warnings generated.

ld: library not found for -lgomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1

ValueError: Data and query points must have same dimensions

Hello

I have the following method:

def sphviewer_plot(x, y, nb=32, xsize=500, ysize=500):   
    xmin = np.min(x)
    xmax = np.max(x)
    ymin = np.min(y)
    ymax = np.max(y)

    x0 = (xmin+xmax)/2.
    y0 = (ymin+ymax)/2.

    pos = np.zeros([3, len(x)])
    pos[0,:] = x
    pos[1,:] = y
    w = np.ones(len(x))

    P = sph.Particles(pos, w, nb=nb)
    S = sph.Scene(P)
    S.update_camera(r='infinity', x=x0, y=y0, z=0, 
                    xsize=xsize, ysize=ysize)
    R = sph.Render(S)
    R.set_logscale()
    img = R.get_image()
    extent = R.get_extent()
    for i, j in zip(xrange(4), [x0,x0,y0,y0]):
        extent[i] += j
    return img, extent

I'm now calling this method with img, extent = sphviewer_plot(df_touch_main["x"].values, df_touch_main["y"].values, 16, xsize=1000, ysize=1000) where df_touch_main is a DataFrame. Both df_touch_main["x"].values and df_touch_main["y"].values are of size 645019. The detailed error I get is the following:


ValueError Traceback (most recent call last)
in
23 print(len(df_touch_main["x"]))
24 print(len(df_touch_main["y"]))
---> 25 img, extent = sphviewer_plot(df_touch_main["x"].values, df_touch_main["y"].values, 16, xsize=1000, ysize=1000)
26 img = np.flipud(img)
27 ax.imshow(img, extent=extent, origin='lower', cmap=mycmap)

in sphviewer_plot(x, y, nb, xsize, ysize)
24 w = np.ones(len(x))
25
---> 26 P = sph.Particles(pos, w, nb=nb)
27 S = sph.Scene(P)
28 S.update_camera(r='infinity', x=x0, y=y0, z=0,

~\AppData\Local\Continuum\anaconda3\lib\site-packages\py_sphviewer-1.2.0-py3.7-win-amd64.egg\sphviewer\Particles.py in init(self, pos, mass, hsml, nb, verbose, sort)
86
87 if(hsml is None):
---> 88 hsml = self.__det_hsml(pos,nb)
89
90 if(sort):

~\AppData\Local\Continuum\anaconda3\lib\site-packages\py_sphviewer-1.2.0-py3.7-win-amd64.egg\sphviewer\Particles.py in __det_hsml(self, pos, nb)
182 def __det_hsml(self, pos, nb):
183 tree = self.__make_kdtree(pos)
--> 184 hsml = self.__nbsearch(pos, nb, tree)
185 return hsml
186

~\AppData\Local\Continuum\anaconda3\lib\site-packages\py_sphviewer-1.2.0-py3.7-win-amd64.egg\sphviewer\Particles.py in __nbsearch(self, pos, nb, tree)
176
177 def __nbsearch(self, pos, nb, tree):
--> 178 d, idx = tree.query(pos, k=nb)
179 hsml = d[:,nb-1]
180 return hsml

pykdtree/kdtree.pyx in pykdtree.kdtree.KDTree.query()

ValueError: Data and query points must have same dimensions

The difference between python2 and python3

Hi Alejandro,

When I want to add the colorbar to image made by py-sphviewer, I find there is a large difference between python2 and python3. It's a difference of several orders of magnitude. So, which version shall I believe?

Speed up code with GPU?

Hi there.

I'm regularly using this code to generate thousands of images and the computation time is a limiting factor and requires significant resources. Does Scene() or Render() support GPU processing? Would using a GPU help? Any other suggestions for speeding up the code in general?

Thanks very much.

What do colors of image refer to?

Hi, @alejandrobll

I find that many figures on display have no colorbar, so that I don't know colors of these images refer to what.
For example, you said that this figure below shows the resulting density field. Does this "density" refer to mass density or number density? And what is the unit of this density field?

Screenshot

empty plots with large number of particles

Hi! I'm trying to plot a DM-only simulation using py-sphviewer. The simulation consists of 2048^3 particles. However, the result I'm getting is either a completely white or black plot. Below is the code, which I've taken from the examples.

Particles = sph.Particles(pos, mass, nb=4)
hsml      = Particles.get_hsml()
Scene     = sph.Scene(Particles)

fig = plt.figure(1, figsize=(15,7))
ax1 = fig.add_subplot(111)
ax1.imshow(qv_perspective.get_image(), extent=qv_perspective.get_extent(),
           origin='lower', cmap=cmaps.twilight(), 
           vmin=-0.5)
plt.show()

When I plot smaller simulations, everything works fine, and I get pretty plots. I suspect this issue might not be related to py-sphviewer but rather to matplotlib. I've noticed that when I create a simple 2D scatter plot with matplotlib for the 2048^3 particles (x, y), it results in an empty figure. So, I do not get errors, only empty plots.

Have you ever faced a similar issue when plotting large amounts of data? do you have any hint on what could be causing the problem?
thanks,

Installation of py-sphviewer for python on windows 7 fails

It should be simple: pip install py-sphviewer

But the installation fails:

Command ""c:\program files (x86)\python\python35-32\python.exe" -u -c "import setuptools, tokenize;file='C:\Users\Adis\AppData\Local\Temp\pip-build-t933z7vh\pykdtree\setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record C:\Users\Adis\AppData\Local\Temp\pip-766djyup-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Adis\AppData\Local\Temp\pip-build-t933z7vh\pykdtree\

Im running Python 3.5.2 (x86)
Windows 7 (64-bit)

Projections in different planes

Hi,

I'm trying to make projections of sightlines projected along the z axis and hence the projections need to be in the xz plane. How do I change the plane of projection? I see there are options to plot the Particles and Camera in different planes but I'm quite confused as to how do I render a scene in a different plane.

Thanks!

Heat map of 3 values (x,y,z) in 2D plane

Hello

I'm using the following method to create a 2D histogram:

def sphviewer_plot(x, y, nb=32, xsize=500, ysize=500):   
    xmin = np.min(x)
    xmax = np.max(x)
    ymin = np.min(y)
    ymax = np.max(y)

    x0 = (xmin+xmax)/2.
    y0 = (ymin+ymax)/2.

    pos = np.zeros([len(x), 3])
    pos[:,0] = x
    pos[:,1] = y
    w = np.ones(len(x))

    P = sph.Particles(pos, w, nb=nb)
    S = sph.Scene(P)
    S.update_camera(r='infinity', x=x0, y=y0, z=0, 
                    xsize=xsize, ysize=ysize)
    R = sph.Render(S)
    R.set_logscale()
    img = R.get_image()
    extent = R.get_extent()
    for i, j in zip(range(4), [x0,x0,y0,y0]):
        extent[i] += j
    return img, extent

I'm creating the histogram using the following lines of code:


fig = plt.figure(figsize=(15,15))
ax = fig.add_subplot(111)
img, extent = sphviewer_plot(df["x"].values, df["y"].values, 16, xsize=300, ysize=300)
img = np.flipud(img)
ax.imshow(img, extent=extent, origin='lower', cmap=mycmap)
ax.set_xlim(0,1080)
ax.set_ylim(0,1920)
plt.show()

df is a Pandas DataFrame. This works great but now I would like to create a 2D heat map using three values x, y and z, i.e. for each pair of x and y values I have an additional value z. I could create such a heatmap by using binned_statistic_2d() as follows:

heatmap, xedges, yedges, binnumber = stats.binned_statistic_2d(x, y, values=z, statistic='mean', bins=1000, range=[[0, 1080], [0, 1920]])
heatmap[np.isnan(heatmap)] = 0
heatmap = gaussian_filter(heatmap, sigma=s)

Is it possible to adapt sphviewer_plot() to also support 3 values x and and z? Moreover, is it possible to also provide the range to the method as done in binned_statistic_2d above?

Using py-sphviewer to visualize high-dimensional data

Hi Alejandro,

I found your project very interesting. I can see that it offers plenty of opportunities to try new things. I am very interested in founding a way to use the visualization capabilities in py-sphviewer to display high-dimensional data.

At this moment, the workflow that I have in mind is: high-dimensional data -> projected to a 3d subspace using a dimensionality reduction technique -> generate a file compatible with py-sphviewer -> and produce amazing graphic displays.

Unfortunately, I am not in expert in SPH. So, I don't know what are the required components to build the required information to use py-sphviewer. At this moment, I have high-dimensional data in ASCII format.

So, I am hoping that you could guide me in this process.

I thank you in advance for the attention you pay to my request.

Ivan

Installation fails on Windows 10

Hello

I have tried to install py-sphviewer on Windows 10 64 bit. I'm running Python 3.9.5 and I'm getting the following errors message :
unknown

I have tried to change the fopenmp to -openmp, but I still have errors, do you know how could I get py-sphviewer in my case ?

Surface density error

The surface density is dependent on both the xsize and ysize which, I believe, should just define how many pixels we use,
e.g,

import h5py
from sphviewer.tools import QuickView
from pykdtree.kdtree import KDTree
import matplotlib.pyplot as plt
import numpy as np

def calculate_smoothing_lengths(coords, neigh=32):
    tree = KDTree(coords)
    d, idx = tree.query(coords, k=neigh)
    hsml = d[:, neigh - 1]
    return hsml


halo = h5py.File('dm_halo.h5py', 'r')
pos  = halo['Coordinates'].value
hsml = calculate_smoothing_lengths(pos)

qv = QuickView(pos, r='infinity', hsml=hsml, nb=8, xsize=100, ysize=100, plot=False,
               logscale=False).get_image()

qv2 = QuickView(pos, r='infinity', hsml=hsml, nb=8, xsize=500, ysize=500, plot=False,
               logscale=False).get_image()

qv3 = QuickView(pos, r='infinity', hsml=hsml, nb=8, xsize=1500, ysize=1500, plot=False,
               logscale=False).get_image()


fig, axes = plt.subplots(1, 3, figsize=(15, 5), dpi=300)

axes[0].imshow(np.log10(qv + 1e-12), vmin=0, vmax=3)
axes[1].imshow(np.log10(qv2 + 1e-12), vmin=0, vmax=3)
axes[2].imshow(np.log10(qv3 + 1e-12), vmin=0, vmax=3)

for ax in axes:
    ax.set_xticklabels([])
    ax.set_yticklabels([])

plt.tight_layout()
plt.savefig("resolution_test.png", dpi=300)
plt.show()

which gives

resolution_test

but I believe the surface density should be constant. The bug is in rendermodule.c

spherical coordinate transformation

I'm a bit confused as to the spherical coordinate transformation in Camera.py (here):

x0 = -self.__params['r']*(np.sin(self.__params['p']*np.pi/180.) *
                                       np.cos(self.__params['t']*np.pi/180.))
z0 = self.__params['r']*(np.cos(self.__params['p']*np.pi/180.) *
                                     np.cos(self.__params['t']*np.pi/180.))
y0 = self.__params['r']*np.sin(self.__params['t']*np.pi/180.)

Why is x0 multiplied by -1? theta (t) and phi (p) also seem to have been mixed up.

As a demonstration, here's a short script that simply calculates the x,y,z components of three orthogonal vectors in spherical coordinates. The first transformation is the one I am more familiar with, and below is the transformation used here, but corrected (no -1, and phi and theta swapped). They now give identical results.

import numpy as np 

phi   = np.array([0, 0,       np.pi/2])
theta = np.array([0, np.pi/2, np.pi/2])

x = np.sin(theta) * np.cos(phi) 
y = np.sin(theta) * np.sin(phi) 
z = np.cos(theta) 

print("Result 1:\n",np.round([x,y,z],2).T,"\n") 

x_b = np.sin(theta) * np.cos(phi)  
y_b = np.sin(phi) 
z_b = np.cos(phi) * np.cos(theta) 

print("Result 2:\n", np.round([x_b,y_b,z_b],2).T, "\n")   

Output:

Result 1:
 [[0. 0. 1.]
 [1. 0. 0.]
 [0. 1. 0.]] 

Result 2:
[[0. 0. 1.]
 [1. 0. 0.]
 [0. 1. 0.]]

Unless I'm making some silly mistake I think this should be corrected to avoid confusion. I've made the change here and can push if you want.

Installation fails on Windows 7

Hello

I have tried to install py-sphviewer on Windows 7 64 bit. I'm running Python 3.7.1 with Anaconda. I'm getting the following error message. What is the problem?

C:\Users\myName>pip install py-sphviewer --user
Collecting py-sphviewer
Using cached https://files.pythonhosted.org/packages/52/a6/bf35362179adcb8390f
fd534a9efdd86713289e0f1d9974bd159f86d296c/py-sphviewer-1.2.0.tar.gz
Requirement already satisfied: pykdtree in c:\users\myName\appdata\roaming\pyth
on\python37\site-packages (from py-sphviewer) (1.3.1)
Requirement already satisfied: numpy in c:\users\myName\appdata\local\continuum
\anaconda3\lib\site-packages (from pykdtree->py-sphviewer) (1.15.4)
Building wheels for collected packages: py-sphviewer
Running setup.py bdist_wheel for py-sphviewer ... error
Complete output from command C:\Users\myName\AppData\Local\Continuum\anaconda
3\python.exe -u -c "import setuptools, tokenize;file='C:\Users\myName\Ap
pData\Local\Temp\pip-install-ycx64p33\py-sphviewer\setup.py';f=getattr(toke
nize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec
(compile(code, file, 'exec'))" bdist_wheel -d C:\Users\myName\AppData\Local
\Temp\pip-wheel-9i6bx7_k --python-tag cp37:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\sphviewer
copying sphviewer\Camera.py -> build\lib.win-amd64-3.7\sphviewer
copying sphviewer\Particles.py -> build\lib.win-amd64-3.7\sphviewer
copying sphviewer\Render.py -> build\lib.win-amd64-3.7\sphviewer
copying sphviewer\Scene.py -> build\lib.win-amd64-3.7\sphviewer
copying sphviewer\version.py -> build\lib.win-amd64-3.7\sphviewer
copying sphviewer_init_.py -> build\lib.win-amd64-3.7\sphviewer
creating build\lib.win-amd64-3.7\sphviewer\extensions
copying sphviewer\extensions_init_.py -> build\lib.win-amd64-3.7\sphviewer
extensions
creating build\lib.win-amd64-3.7\sphviewer\tools
copying sphviewer\tools\Blend.py -> build\lib.win-amd64-3.7\sphviewer\tools
copying sphviewer\tools\camera_tools.py -> build\lib.win-amd64-3.7\sphviewer\t
ools
copying sphviewer\tools\cmaps.py -> build\lib.win-amd64-3.7\sphviewer\tools
copying sphviewer\tools\hsv_tools.py -> build\lib.win-amd64-3.7\sphviewer\tool
s
copying sphviewer\tools\QuickView.py -> build\lib.win-amd64-3.7\sphviewer\tool
s
copying sphviewer\tools_init_.py -> build\lib.win-amd64-3.7\sphviewer\tools

copying sphviewer\c_code.c -> build\lib.win-amd64-3.7\sphviewer
copying sphviewer\extra_code.c -> build\lib.win-amd64-3.7\sphviewer
copying sphviewer\README.txt -> build\lib.win-amd64-3.7\sphviewer
running build_ext
building 'sphviewer/extensions/scene' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\sphviewer
creating build\temp.win-amd64-3.7\Release\sphviewer\extensions
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c
/nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\myName\AppData\Local\Continuum\ana
conda3\lib\site-packages\numpy\core\include -IC:\Users\myName\AppData\Local\Con
tinuum\anaconda3\include -IC:\Users\myName\AppData\Local\Continuum\anaconda3\in
clude "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\P
rogram Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program File
s (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits
8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcsph
viewer/extensions/scenemodule.c /Fobuild\temp.win-amd64-3.7\Release\sphviewer/ex
tensions/scenemodule.obj -fopenmp -w -std=c99
cl : Command line warning D9025 : overriding '/W3' with '/w'
cl : Command line warning D9002 : ignoring unknown option '-fopenmp'
cl : Command line warning D9002 : ignoring unknown option '-std=c99'
scenemodule.c
c:\users\myName\appdata\local\continuum\anaconda3\lib\site-packages\numpy\cor
e\include\numpy\npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated Num
Py API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe
/nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH
:C:\Users\myName\AppData\Local\Continuum\anaconda3\libs /LIBPATH:C:\Users\wrafa
el\AppData\Local\Continuum\anaconda3\PCbuild\amd64 "/LIBPATH:C:\Program Files (x
86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)
Windows Kits\10\lib\10.0.10240.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Wind
ows Kits\8.1\lib\winv6.3\um\x64" /EXPORT:PyInit_sphviewer/extensions/scene build
\temp.win-amd64-3.7\Release\sphviewer/extensions/scenemodule.obj /OUT:build\lib.
win-amd64-3.7\sphviewer/extensions/scene.cp37-win_amd64.pyd /IMPLIB:build\temp.w
in-amd64-3.7\Release\sphviewer/extensions\scene.cp37-win_amd64.lib -lgomp
LINK : warning LNK4044: unrecognized option '/lgomp'; ignored
LINK : error LNK2001: unresolved external symbol PyInit_sphviewer/extensions/s
cene
build\temp.win-amd64-3.7\Release\sphviewer/extensions\scene.cp37-win_amd64.lib
: fatal error LNK1120: 1 unresolved externals
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN
\x86_amd64\link.exe' failed with exit status 1120


Failed building wheel for py-sphviewer
Running setup.py clean for py-sphviewer
Failed to build py-sphviewer
Installing collected packages: py-sphviewer
Running setup.py install for py-sphviewer ... error
Complete output from command C:\Users\myName\AppData\Local\Continuum\anacon
da3\python.exe -u -c "import setuptools, tokenize;file='C:\Users\myName\
AppData\Local\Temp\pip-install-ycx64p33\py-sphviewer\setup.py';f=getattr(to
kenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();ex
ec(compile(code, file, 'exec'))" install --record C:\Users\myName\AppData\L
ocal\Temp\pip-record-aeg0kk7s\install-record.txt --single-version-externally-man
aged --compile --user --prefix=:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\sphviewer
copying sphviewer\Camera.py -> build\lib.win-amd64-3.7\sphviewer
copying sphviewer\Particles.py -> build\lib.win-amd64-3.7\sphviewer
copying sphviewer\Render.py -> build\lib.win-amd64-3.7\sphviewer
copying sphviewer\Scene.py -> build\lib.win-amd64-3.7\sphviewer
copying sphviewer\version.py -> build\lib.win-amd64-3.7\sphviewer
copying sphviewer_init_.py -> build\lib.win-amd64-3.7\sphviewer
creating build\lib.win-amd64-3.7\sphviewer\extensions
copying sphviewer\extensions_init_.py -> build\lib.win-amd64-3.7\sphviewe
r\extensions
creating build\lib.win-amd64-3.7\sphviewer\tools
copying sphviewer\tools\Blend.py -> build\lib.win-amd64-3.7\sphviewer\tools
copying sphviewer\tools\camera_tools.py -> build\lib.win-amd64-3.7\sphviewer
\tools
copying sphviewer\tools\cmaps.py -> build\lib.win-amd64-3.7\sphviewer\tools
copying sphviewer\tools\hsv_tools.py -> build\lib.win-amd64-3.7\sphviewer\to
ols
copying sphviewer\tools\QuickView.py -> build\lib.win-amd64-3.7\sphviewer\to
ols
copying sphviewer\tools_init_.py -> build\lib.win-amd64-3.7\sphviewer\too
ls
copying sphviewer\c_code.c -> build\lib.win-amd64-3.7\sphviewer
copying sphviewer\extra_code.c -> build\lib.win-amd64-3.7\sphviewer
copying sphviewer\README.txt -> build\lib.win-amd64-3.7\sphviewer
running build_ext
building 'sphviewer/extensions/scene' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\sphviewer
creating build\temp.win-amd64-3.7\Release\sphviewer\extensions
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\myName\AppData\Local\Continuum\a
naconda3\lib\site-packages\numpy\core\include -IC:\Users\myName\AppData\Local\C
ontinuum\anaconda3\include -IC:\Users\myName\AppData\Local\Continuum\anaconda3
include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:
\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Fi
les (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kit
s\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcs
phviewer/extensions/scenemodule.c /Fobuild\temp.win-amd64-3.7\Release\sphviewer/
extensions/scenemodule.obj -fopenmp -w -std=c99
cl : Command line warning D9025 : overriding '/W3' with '/w'
cl : Command line warning D9002 : ignoring unknown option '-fopenmp'
cl : Command line warning D9002 : ignoring unknown option '-std=c99'
scenemodule.c
c:\users\myName\appdata\local\continuum\anaconda3\lib\site-packages\numpy\c
ore\include\numpy\npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated N
umPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.ex
e /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPA
TH:C:\Users\myName\AppData\Local\Continuum\anaconda3\libs /LIBPATH:C:\Users\wra
fael\AppData\Local\Continuum\anaconda3\PCbuild\amd64 "/LIBPATH:C:\Program Files
(x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86
)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Wi
ndows Kits\8.1\lib\winv6.3\um\x64" /EXPORT:PyInit_sphviewer/extensions/scene bui
ld\temp.win-amd64-3.7\Release\sphviewer/extensions/scenemodule.obj /OUT:build\li
b.win-amd64-3.7\sphviewer/extensions/scene.cp37-win_amd64.pyd /IMPLIB:build\temp
.win-amd64-3.7\Release\sphviewer/extensions\scene.cp37-win_amd64.lib -lgomp
LINK : warning LNK4044: unrecognized option '/lgomp'; ignored
LINK : error LNK2001: unresolved external symbol PyInit_sphviewer/extensions
/scene
build\temp.win-amd64-3.7\Release\sphviewer/extensions\scene.cp37-win_amd64.l
ib : fatal error LNK1120: 1 unresolved externals
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\B
IN\x86_amd64\link.exe' failed with exit status 1120

----------------------------------------

Command "C:\Users\myName\AppData\Local\Continuum\anaconda3\python.exe -u -c "im
port setuptools, tokenize;file='C:\Users\myName\AppData\Local\Temp\pi
p-install-ycx64p33\py-sphviewer\setup.py';f=getattr(tokenize, 'open', open)(__
file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, _file
_, 'exec'))" install --record C:\Users\myName\AppData\Local\Temp\pip-record-aeg
0kk7s\install-record.txt --single-version-externally-managed --compile --user --
prefix=" failed with error code 1 in C:\Users\myName\AppData\Local\Temp\pip-ins
tall-ycx64p33\py-sphviewer\

No use of `-ffast-math`

Using -ffast-math in the extra compile arguments speeds up the code by about 5x; is there any reason why this isn't used?

Render.get_image() units

Hi there,

I saw the previous post here asking about the units of the final image, but still could use some clarification. If my input mass is in units of solar masses, is the image a surface density in solar masses per pixel area?

For some reason, the sum of the image output is larger in a smaller FOV cutout than a larger one and neither seem particularly close to the total mass of the halo found in the catalogues (IllustrisTNG100-1).

Thanks very much for your time.

Scott

Request: could you make available the Python code for the blending tutorial?

HI @alejandrobll ,

I am following the tutorial examples shown in the main webpage of Py-SPHViewer. Could you make available the Python code for the animated image shown at the bottom of the blending tutorial page?

It will help me to better understand how to use the camera, scene, and rotations. So then, I can follow better the instructions for the smooth camera tutorial. Also, could you make available the data to simulate gas particles, which is used for the tutorial on blending images?

Many thanks,
Ivan

"segmentation fault (core dumped) " after run QuickView

Hi @alejandrobll,

I wrote a python script to test the functionalities of QuickView after installing py-sphviewer on the Linux server of my team.

The code snippet is shown below

import numpy as np
import matplotlib as mpl
mpl.use("Agg")
import matplotlib.pyplot as plt
from sphviewer.tools import QuickView

with open("/home2/TNG100-1/postprocessing/dm_poscut_z0_alpha.dat") as ff:
    dm_pos = np.fromfile(ff, dtype='float32').reshape((3,80727093), order="F")

dm_pos = (dm_pos.transpose()) / 1000.0

QuickView(dm_pos, r="infinity", plot=False)
projection.imsave("test_sphviewer.png", bbox_inches="tight")

After typing ipython test_sphviewer.py on the command line, It returned to me Segmentation fault (core dumped).
Can you help me with this issue?

setup error on mac OS X EI Captain

I am using Anaconda 2.4.1 and tried to install the package sphviewer. However, pip, easy_install or python setup.py install gives the similar error shown below:
$easy_install py-sphviewer

Searching for py-sphviewer
Reading https://pypi.python.org/simple/py-sphviewer/
Best match: py-sphviewer 1.0.2
Downloading https://pypi.python.org/packages/source/p/py-sphviewer/py-sphviewer-1.0.2.tar.gz#md5=69f62232ace350307455afacd44bcb8e
Processing py-sphviewer-1.0.2.tar.gz
Writing /var/folders/xw/z2t4jxbj5zbg1w06wc97gc140000gn/T/easy_install-WhEmOm/py-sphviewer-1.0.2/setup.cfg
Running py-sphviewer-1.0.2/setup.py -q bdist_egg --dist-dir /var/folders/xw/z2t4jxbj5zbg1w06wc97gc140000gn/T/easy_install-WhEmOm/py-sphviewer-1.0.2/egg-dist-tmp-IfFrW8
clang: error: unsupported option '-fopenmp'

Request: Combine gas and stars

It would be great to combine the gas and stars in the same render, is this possible? If not, any plans to include it?

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.