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

Expose more ldos data #581

Merged
merged 2 commits into from
Nov 6, 2018
Merged

Expose more ldos data #581

merged 2 commits into from
Nov 6, 2018

Conversation

ChristopherHogan
Copy link
Contributor

A user on the mailing list wanted programmatic access to ldos data printed by the step function mp.dft_ldos. I added a public DftLdos function that returns a C++ dft_ldos that can then be

  1. passed to mp.dft_ldos
  2. passed to mp.get_ldos_freqs
  3. queried for dft_ldos::omega_min

@stevengj @oskooi

@coveralls
Copy link

coveralls commented Oct 25, 2018

Coverage Status

Coverage increased (+0.04%) to 82.014% when pulling ab87219 on ChristopherHogan:chogan/ldos into 350a75e on stevengj:master.

Compute the power spectrum of the sources (usually a single point dipole source), normalized to correspond to the LDOS, in a frequency bandwidth `df` centered at `fcen`, at `nfreq` frequency points.
Compute the power spectrum of the sources (usually a single point dipole source), normalized to correspond to the LDOS, in a frequency bandwidth `df` centered at `fcen`, at `nfreq` frequency points. One can also pass in an `ldos` created with `DftLdos` as `dft_ldos(ldos=my_ldos)`. This is useful for passing to `get_ldos_freqs` or accessing C++ properties like `ldos.omega_min`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe it should be ldos.freqs() instead of get_ldos_freqs(ldos)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@stevengj
Copy link
Collaborator

Probably omega should be freq here and elsewhere in the API. (Internally in C++, we call this "omega", but it is actually the frequency, not the angular frequency.)

@ChristopherHogan
Copy link
Contributor Author

For reference, here is the email that prompted this PR:

Now I have the ldos_data but I can't read the associated frequencies. They get outputted in the console but when I try to get them from my ldos object, I get the Error:

AttributeError:
'Simulation' object has no attribute 'omega_min'
or
'Source' object has no attribute 'omega_min'

What exactly is now my ldos object which the documentation is referring to?

@stevengj stevengj merged commit 8b36b2f into NanoComp:master Nov 6, 2018
@ChristopherHogan ChristopherHogan deleted the chogan/ldos branch November 9, 2018 21:12
bencbartlett pushed a commit to bencbartlett/meep that referenced this pull request Sep 9, 2021
* Expose more ldos data

* Rename omega to freqs and make get_ldos_freqs a method of Ldos
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.

3 participants