miepython icon indicating copy to clipboard operation
miepython copied to clipboard

2D Mie Resonances of Disk

Open wblumberg opened this issue 1 year ago • 5 comments

Hi there,

I am a longtime fan of this package - I use it for my Atmospheric Radiative Transfer class at Millersville University. I was wondering if your package can reproduce the Mie Resonances vs. Radius images I have found on the Wikipedia page (link below). It's a different software package, but I'm wondering if you have a way to do this. I like the visuals and would like to reproduce them for my class.

Thank you very much!

Greg Blumberg

https://commons.wikimedia.org/wiki/File:Mie_resonances_vs_Radius.gif

wblumberg avatar Dec 03 '24 19:12 wblumberg

@wblumberg Glad to hear you like miepython.

The visuals in the wikipedia image use a completely different approach to solving the scattering problem. I don't think it fits into the miepython package. That said, the gif for the figure includes Mathematica code. ChatGPT readily converted this to python.

I added a notebook about Mie resonances. Don't know if this will help any.

Perhaps over the winter break I will be able to find time to add more visualization support for the electric and magnetic fields.

However, your request for visualization made it clear that miepython does not directly support electric or magnetic field plots.

scottprahl avatar Dec 15 '24 16:12 scottprahl

@scottprahl I just tried out your code for the Mie resonances. However, the code fails with "AttributeError: module 'miepython' has no attribute 'mie_coefficients'". I am using miepython 2.5.5 which is in all other aspects running really fine.

Cheers, Uli Krieger

UliKrieger avatar Jan 23 '25 13:01 UliKrieger

sorry, not quite enough to go on. Are you using the released version of miepython or the current code in the repository (which unfortunately is in an indeterminate state as I add support for e-fields inside the sphere) ?

confirm you are using the released version and give me a short snippet of code to show your problem.

Thanks

scottprahl avatar Jan 23 '25 16:01 scottprahl

Hi Scott,

to explain in more detail what I was trying to do: I am using the release version and just tried out the function "resonant_wavelengths" given in the example (https://miepython.readthedocs.io/en/latest/13_resonance.html) , using these parameters: "resonant_wavelengths(1, 5.0, (1.45+0j), (0.765, 0.782), n_env=1.0)"

Upon executing this line of the example code: a, _ = miepython.mie_coefficients(mm, x, n_pole) I get the error: " AttributeError: module 'miepython' has no attribute 'mie_coefficients'"

Thanks, Uli

UliKrieger avatar Jan 29 '25 10:01 UliKrieger

Everything should be working with the new release. I was hoping to finish testing the E-fields near the sphere before releasing, but the disconnect between the documentation for the new version and the old version being installed by pip or conda was not helping anyone.

I will just release a new version when the E-field stuff is finished.

scottprahl avatar Mar 16 '25 21:03 scottprahl