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

Using NDTAMR and retrieving a grid #3

Open
mzajd opened this issue Jul 27, 2020 · 3 comments
Open

Using NDTAMR and retrieving a grid #3

mzajd opened this issue Jul 27, 2020 · 3 comments

Comments

@mzajd
Copy link

mzajd commented Jul 27, 2020

Hello,

I followed along with the example and generated and refined a tree object over a 2d function. Once this is done, how can I get the grid object? The data that includes the points and values?

I tried accessing vis.convert_to_uniform(tree) but this gives me a TypeError


TypeError Traceback (most recent call last)
in
----> 1 vis.convert_to_uniform(t,dims=[0,1],func=lambda x: x,mask=lambda x: False,alpha_func=lambda x: 1,pad=None)

~\miniconda3\lib\site-packages\ndtamr\Vis.py in convert_to_uniform(tree, dims, slice_, q, func, mask, alpha_func, pad)
258 a = alpha_func(n)
259 if lvl == lmax:
--> 260 result[i,j] = d
261 alpha[i,j] = a
262 mask_arr[i,j] = m

TypeError: float() argument must be a string or a number, not 'Node'

@Interfluo
Copy link

@mzajd I am having the same issue, did you ever resolve this?

@mzajd
Copy link
Author

mzajd commented Apr 7, 2021 via email

@Interfluo
Copy link

@mzajd
I was able to extract the grid nodes and plot them, maybe this is helpful

`grid = vis.generate_grid(t)
print("\ninitial grid points:", grid)
coords = []
x = []
y = []
for i in range(len(grid)):
for j in range(len(grid[i])):
coords.append(grid[i][j])
x.append(grid[i][j][0])
y.append(grid[i][j][1])
print("coordinates:", coords)
print("x:", x)
print("y:", y)

plt.scatter(x, y, c='k', s=1)
plt.show()`

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