Skip to content

feat[FieldData]: export to ZBF #2397

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

Merged
merged 1 commit into from
May 6, 2025
Merged

feat[FieldData]: export to ZBF #2397

merged 1 commit into from
May 6, 2025

Conversation

bzhangflex
Copy link
Contributor

@bzhangflex bzhangflex commented Apr 22, 2025

  • Adds a to_zbf() method to FieldData for exporting E fields to a ZBF file.
  • Adds a from_zbf() method to FieldDataset for importing E fields from a ZBF file.
  • Adds a ZBFData class for reading ZBF files

Closes #2321

Copy link
Collaborator

@yaugenst-flex yaugenst-flex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, looks great! Only some minor comments.

Copy link
Collaborator

@tylerflex tylerflex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bzhangflex , this looks great! Will be super useful and a highly requested feature!

I had a few minor comments. I'm not familiar with zemax configuration so take what I say with a bit of a grain of salt.

@tomflexcompute
Copy link
Contributor

Since this is a bit experimental and largely untested, there might be cases that it will not work properly. Should we add a warning when it's called? Something like "This is an experimental feature. If you run into any issues, contact us at flexcompute.com/tidy3d/technical-support/"

@bzhangflex
Copy link
Contributor Author

Pushed quite a few changes

  • Created a read_zbf() utility function
    def read_zbf(filename: str):
  • Added FieldDataset.from_zbf() for creating a new FieldDataset from a zbf file
  • In to_zbf(), require the user to choose the # of field samples n_x and n_y separately. Checks that they are powers of two between 2^5 and 2^13 per Zemax manual
  • If freq in to_zbf() is not specified, default to the mean of the frequencies
  • units is now a kwarg
  • User has the option to specify pilot beam parameters. Defaults are 0
  • Updated changelog
  • Updated warning messages to include support url
  • use emulated_run in the pytests

@bzhangflex bzhangflex requested a review from tylerflex May 1, 2025 18:47
Copy link
Collaborator

@tylerflex tylerflex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking like it's almost there! mostly minor comments

@bzhangflex
Copy link
Contributor Author

Thanks @tylerflex!, let me know how it looks now

Copy link
Collaborator

@tylerflex tylerflex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, thanks @bzhangflex !

@bzhangflex bzhangflex force-pushed the bzhangflex/zbf-export branch from eb23a1f to be046e0 Compare May 6, 2025 16:56
@bzhangflex bzhangflex merged commit 6b0c432 into develop May 6, 2025
9 checks passed
@bzhangflex bzhangflex deleted the bzhangflex/zbf-export branch May 6, 2025 19:00
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

Successfully merging this pull request may close these issues.

Add zbf file export in 2.9
5 participants