skuschel / postpic

The open-source particle-in-cell post-processor.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get the real grid of field data?

MerlinPendragon opened this issue · comments

Please tell us which version of postpic you are using by adding the output of

import postpic as pp
print(pp.__version__)
'v0.4+54.g66bc0f4'

Please also add if you are using python2 or python3. You can find out using

import sys
print(sys.version)
'3.6.6 |Anaconda custom (64-bit)| (default, Jun 28 2018, 17:14:51) \n[GCC 7.2.0]'

Guys, I wonder if there is a way to directly get real grid of field data from a dump reader? Now I'm using like gr = dr.data('Grid/Grid_mid'). I hope that there is a method of Dumpreader class (gr = dr.Grid()) like the one with EM field dr.Ex().

If there is currently no such method, could you briefly tell me how to implement this into postpic? Thanks :)

By the way, I'm using EPOCH.

There is dr.gridnode(key, axis), where key is the key to some data, to which you want to know the grid of. axis obviously specifies the axis you want to know.

The general problem is, that different data in the dump may use different grids:
Imagine you are using the skip option of EPOCH or assembling you own output using the dist_fn block: That data will use a very different grids.

postpic will return a Field when you do field = dr.Ex() or field = dr.createfieldfromkey(key) or field = ms.createField('x', 'gamma'). The best practice is probably to use the axis description of the field to get your grid: field.extent will give the extent in a way that imshow understands ist. field.axis is a list of axis descriptions, try field.axis[0].name or field.axis[0].grid or field.axis[0].grid_node.

Is that what you are looking for? What for are you using the grid?

Cheers
Stephan

PS: Thanks a lot for offering you support! The easiest is probably to add more examples or even a tutorial at this repository: https://github.com/skuschel/postpic-examples
So In case you have some nice jupyter notebooks, it may be worth adding them there. Unfortunately, many issues are probably quite advanced, I believe. However, docstrings, documentation, examples are always welcome!

Yes, this is what I am looking for! I'm using grid for pcolormesh of fields.