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

how to export the field data to a txt file? #41

Closed
Vimim3 opened this issue Jan 11, 2022 · 4 comments
Closed

how to export the field data to a txt file? #41

Vimim3 opened this issue Jan 11, 2022 · 4 comments

Comments

@Vimim3
Copy link

Vimim3 commented Jan 11, 2022

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?

@momchilmm
Copy link
Member

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.

@Vimim3
Copy link
Author

Vimim3 commented Mar 23, 2022

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?

@momchil-flex
Copy link
Collaborator

Just write a for loop?

@Vimim3
Copy link
Author

Vimim3 commented Mar 24, 2022

Thank you! If there is no other simpler method, I will try this.

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

3 participants