NDTAMR icon indicating copy to clipboard operation
NDTAMR copied to clipboard

Using NDTAMR and retrieving a grid

Open mzajd opened this issue 5 years ago • 3 comments

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'

mzajd avatar Jul 27 '20 20:07 mzajd

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

Interfluo avatar Apr 07 '21 03:04 Interfluo

No....I ended up using gnuplot and matplotlib for the visualizations I needed.

On Tue., Apr. 6, 2021, 11:39 p.m. Interfluo, @.***> wrote:

@mzajd https://github.com/mzajd I am having the same issue, did you ever resolve this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/adamdempsey90/NDTAMR/issues/3#issuecomment-814576723, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQBJX2FSAFITRCVUR7D7GQLTHPHV7ANCNFSM4PJGZNVA .

mzajd avatar Apr 07 '21 12:04 mzajd

@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()`

Interfluo avatar Apr 07 '21 18:04 Interfluo