how to export the field data to a txt file?
Vimim3 opened this issue · 4 comments
legume.viz.field can be used to plot the field pattern. Sometimes, we need to export the data to do further computation, such as integration. So, how to export the field data of some modes to a txt file or other file types?
You can use the get_field
functions, e.g. https://legume.readthedocs.io/en/latest/generated/legume.GuidedModeExp.get_field_xy.html
to get a cross-section of a given field as numpy array. From there you can manipulate as you wish, or export to file using the numpy in-built functions.
Thanks! I find get_field function can get the field data of one mode, is there any way to get the field data of all modes?
Just write a for loop?
Thank you! If there is no other simpler method, I will try this.