Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3D processing issue #13

Open
KiranNutter opened this issue Jun 27, 2022 · 2 comments
Open

3D processing issue #13

KiranNutter opened this issue Jun 27, 2022 · 2 comments

Comments

@KiranNutter
Copy link

Using the functions for the 2D processing for vector fields, residence dist. and dynamic prob. works fine and I can get plots from them, but when I try to use the 3D functions, such as VectorField3D(), it starts step 1/3 but then just stops running without giving an error. I have tried to follow the point the where the code was stopping and it seems to be within the konigcell file ‘compute3d.py’ and specifically when it calls the ‘kc3d.dynamic3d’ function.

Should these 3D plots be working, or are they still being developed? But if they should work, do you have any ideas about what could be going wrong here, it might just be something on my end instead of an issue with the code?

@anicusan
Copy link
Member

Hi Kiran,

All rasterization routines are forwarded to KonigCell; there used to be a problem in konigcell-0.1.0 with skipping NaNs when they appear in specific orders - this might be it. Could you check this:

import konigcell as kc
print(kc.__version__)

Then could you install the in-development GitHub version of pept and run the code again? Install it with:

pip install git+ https://github.com/uob-positron-imaging-centre/pept

If the error still persists, please post your code in a comment and I'll try to figure it out.

Leonard

@KiranNutter
Copy link
Author

KiranNutter commented Jun 28, 2022

Hi Leonard,

Thanks for getting back to me, when I check the Konigcell version it says 0.2.0, and then after installing the Github version (which I think I should have already had) that still says 0.2.0 and I have the same problem. I have put the code I am running for my analysis below this, with first a 2D vector field that works ok, and then the 3D vector field that fails.

Kiran

import pept
from pept.tracking import *
from pept.processing import *
from pept.plots import PlotlyGrapher, PlotlyGrapher2D
import plotly.express as px
import numpy as np

import plotly
plotly.io.renderers.default = "browser"

filepath1 = "E:\GlobusFolder\Day3\4000\3_4000_1_0.lors"

lors_raw1 = np.fromfile(filepath1, np.float32).reshape(-1, 7)

lors = pept.LineData(
lors_raw1,
sample_size = 500,
overlap = 250, #for pure Birmingham method, use no overlap
)

filepath=filepath1.split(".lors")[0]

pipeline = pept.Pipeline([
BirminghamMethod(fopt = 0.4),

Condition("error<5"),
Condition("y>-20"),
Condition("y<30"),
Condition("x<150"),
Condition("x>-150"),  

Segregate(window = 20, cut_distance = 10),   

Condition("label>=0"),                                       

SplitAll("label"),
Interpolate(timestep = 0.2),
Velocity(window = 7),                       # Appends vx, vy, vz
Velocity(window = 7, absolute = True),                        

Stack(),

])

trajectories = pipeline.fit(lors)

field = VectorField2D(1, ["vx", "vz"], "xz").fit(trajectories)

scaling = 2
fig = field.quiver(scaling)
fig.write_html(filepath + "_500_4_5error_2dvector.html")

field = VectorField3D(1).fit(trajectories)

scaling = 1.5
fig = field.quiver(scaling)
fig.write_html(filepath + "_500_4_5error_3dvector.html")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants