alexruiz95 / PTV_SYN

Branch Gen3 is the current version. Codes for generating synthetic particle images for multi-camera systems, configured for use for PyPTV
Other
2 stars 2 forks source link

pyJHTDB install python #1

Open alexruiz95 opened 5 years ago

alexruiz95 commented 5 years ago

I was able to install it in Linux but in windows, there are a lot of errors due to Microsoft VScode.

alexlib commented 5 years ago

I have no idea about Windows installations - but recommend to start with Anaconda - it usually helps me to isolate the problems.

alexlib commented 5 years ago

see https://github.com/idies/pyJHTDB/issues/26

alexlib commented 5 years ago

so it failed on my Windows 10 64 bit as well. I suggest to use WSL for Windows if you have to.

alexruiz95 commented 5 years ago

That error is exactly what I got. I tried multiple versions of python (anaconda and standalone) and uninstalling and reinstalling the Microsoft build tools (versions 2017 - 2019). In my experience, WSL is pretty annoying to work with since you have to do everything in the console. I.e cant copy and paste and access the host computer files. Correct me if that isn't true.

alexlib commented 5 years ago

If you have a linux machine it is better. Otherwise WSL is a better option than virtualbox I think

On Thu, Oct 3, 2019, 17:32 Alex Ruiz notifications@github.com wrote:

That error is exactly what I got. I tried multiple versions of python (anaconda and standalone) and uninstalling and reinstalling the Microsoft build tools (versions 2017 - 2019). In my experience, WSL is pretty annoying to work with since you have to do everything in the console. I.e cant copy and paste and access the host computer files. Correct me if that isn't true.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/alexruiz95/PTV_SYN/issues/1?email_source=notifications&email_token=AAFWMZWC26FV57AGBEI6P53QMX675A5CNFSM4I42FK6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAIMZVQ#issuecomment-537971926, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFWMZR2EHSLFMHWHH6SEJTQMX675ANCNFSM4I42FK6A .

alexruiz95 commented 5 years ago

I currently use VMworkstation and it allows for high bandwidth connection, much better than VirtualBox and WSL. I wish windows wasnt so buggy

alexlib commented 5 years ago

see their answer - I checked and it works on Windows 10. Don't know yet how to implement it to get trajectoreis, but it seems not too complex

`I see. Thank you for pointing this out. seems the problem is a bit complex. I have no idea how to fix it at the moment. but would you mind trying zeep python package (https://python-zeep.readthedocs.io/en/master/)?

import zeep

client = zeep.Client('http://turbulence.pha.jhu.edu/service/turbulence.asmx?WSDL') ArrayOfPoint3 = client.get_type('ns0:ArrayOfPoint3') SpatialInterpolation = client.get_type('ns0:SpatialInterpolation') TemporalInterpolation = client.get_type('ns0:TemporalInterpolation')

Point3 = client.get_type('ns0:Point3') temp1=Point3(x=0.1, y=0.1, z=0.1) temp2=Point3(x=1.1, y=1.1, z=1.1) temp3=Point3(x=2.1, y=2.1, z=2.1) point = ArrayOfPoint3([temp1,temp2,temp3])

print(point) print(client.service.GetVelocity("jhu.edu.pha.turbulence.testing-200711","isotropic1024coarse", 0.6, SpatialInterpolation("None"), TemporalInterpolation("None"), point, ""))`

alexlib commented 5 years ago

https://github.com/idies/pyJHTDB/issues/27

alexruiz95 commented 5 years ago

This worked on my system as well

alexlib commented 5 years ago

So we need to convert this:

import numpy as np
import pyJHTDB
from pyJHTDB.dbinfo import isotropic1024coarse
info = isotropic1024coarse
# 20 seed nodes in 3D, x,y,z
ind = np.random.randint(45,1024-45,size=(20,3))

eta = 0.002 # Kolmogorov
positions = []

for i in range(20):
    tmp = 128*eta*(np.random.random((400,3))-0.5) # 20 particles around the selected node within 128 \eta
    positions.append((info['xnodes'][ind[i,0]],info['ynodes'][ind[i,1]],info['znodes'][ind[i,2]]) + tmp)

positions = np.vstack(positions).astype(np.float32)
lJHTDB = pyJHTDB.libJHTDB()

lJHTDB.initialize()

u = lJHTDB.getData(
               0.0,
               positions,
               sinterp = 4,
               getFunction='getVelocity')

x, t = lJHTDB.getPosition(
    starttime = 0.0,
    endtime = 4.0,
    dt = 0.0004,
    point_coords = positions,
    steps_to_keep = 150)

lJHTDB.finalize()

np.savez('trajectories',u=u,x=x,t=t)

using

import zeep

client = zeep.Client('http://turbulence.pha.jhu.edu/service/turbulence.asmx?WSDL')
ArrayOfPoint3 = client.get_type('ns0:ArrayOfPoint3')
SpatialInterpolation = client.get_type('ns0:SpatialInterpolation')
TemporalInterpolation = client.get_type('ns0:TemporalInterpolation')

Point3 = client.get_type('ns0:Point3')
temp1=Point3(x=0.1, y=0.1, z=0.1)
temp2=Point3(x=1.1, y=1.1, z=1.1)
temp3=Point3(x=2.1, y=2.1, z=2.1)
point = ArrayOfPoint3([temp1,temp2,temp3])

print(point)
print(client.service.GetVelocity("jhu.edu.pha.turbulence.testing-200711","isotropic1024coarse", 0.6,
SpatialInterpolation("None"), TemporalInterpolation("None"), point, ""))`

and this

StartTime=0.1
EndTime=0.2
dt=0.02
print(client.service.GetPosition("uk.ac.manchester.zhao.wu-ea658424","isotropic1024coarse", StartTime, EndTime, dt, SpatialInterpolation("None"), point, ""))
alexlib commented 5 years ago

see https://github.com/idies/pyJHTDB/blob/master/examples/Use_JHTDB_in_windows.ipynb