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

merge meep::quiet and fields::verbose into a single meep::verbosity #994

Merged
merged 2 commits into from
Aug 23, 2019

Conversation

stevengj
Copy link
Collaborator

The problem with fields::verbosity was that it was not available in structure etcetera, and meep::quiet is not fine-grained enough to specify ordinary output vs. extra debugging output. This PR merges both into a single meep::verbosity global integer: 0 is quiet mode, 1 (the default) is ordinary output, and 2 is extra debugging output.

The Python meep.quiet() function still works and sets verbosity to 0, and now there is a lower-level meep.verbosity(value) routine that you can use to set the verbosity level explicitly.

@stevengj stevengj merged commit 4e0e80d into master Aug 23, 2019
@stevengj stevengj deleted the verbosity branch August 23, 2019 16:02
@stevengj stevengj mentioned this pull request Aug 23, 2019
@oskooi
Copy link
Collaborator

oskooi commented Aug 23, 2019

The following error appears when I use mp.verbose(2) before sim.init_sim():

raceback (most recent call last):
  File "grating.py", line 159, in <module>
    main(args)
  File "grating.py", line 116, in main
    mp.verbose(2)
AttributeError: module 'meep' has no attribute 'verbose'
Traceback (most recent call last):
  File "grating.py", line 159, in <module>
    main(args)
  File "grating.py", line 116, in main
    mp.verbose(2)
AttributeError: module 'meep' has no attribute 'verbose'

Also, the following error appears whenever I use mp.quiet(True):

Traceback (most recent call last):
  File "grating.py", line 158, in <module>
    main(args)
  File "grating.py", line 116, in main
    mp.quiet(True)
  File "/usr/local/lib/python3.5/site-packages/meep/simulation.py", line 2927, in quiet
    mp.cvar.verbose = int(not quietval)
AttributeError: Unknown C global variable 'verbose'
Traceback (most recent call last):
  File "grating.py", line 158, in <module>
    main(args)
  File "grating.py", line 116, in main
    mp.quiet(True)
  File "/usr/local/lib/python3.5/site-packages/meep/simulation.py", line 2927, in quiet
    mp.cvar.verbose = int(not quietval)
AttributeError: Unknown C global variable 'verbose'

@stevengj
Copy link
Collaborator Author

The function is mp.verbosity(2), not mp.verbose(2).

quiet is fixed in 55a67ae, sorry.

@oskooi
Copy link
Collaborator

oskooi commented Aug 24, 2019

The same error occurs with mp.verbosity(2).

Using MPI version 3.0, 5 processes
Traceback (most recent call last):
  File "oled.py", line 99, in <module>
    mp.verbosity(2)
AttributeError: module 'meep' has no attribute 'verbosity'
Traceback (most recent call last):
  File "oled.py", line 99, in <module>
    mp.verbosity(2)
AttributeError: module 'meep' has no attribute 'verbosity'
Traceback (most recent call last):
  File "oled.py", line 99, in <module>
    mp.verbosity(2)
AttributeError: module 'meep' has no attribute 'verbosity'
```

mp.cvar.verbose = int(not quietval)

def verbosity(verbose_val):
mp.cvar.verbose = verbose_val
Copy link
Collaborator

@oskooi oskooi Aug 24, 2019

Choose a reason for hiding this comment

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

This should be mp.cvar.verbosity = verbose_val. Nevermind, this was also fixed by 55a67ae. However, the error persists even with this commit.

@stevengj
Copy link
Collaborator Author

@oskooi, the error about meep.verbosity should be fixed by 268183a

bencbartlett pushed a commit to bencbartlett/meep that referenced this pull request Sep 9, 2021
…anoComp#994)

* merge meep::quiet and fields::verbose into a single meep::verbosity

* fix Python references to cvar.quiet
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.

2 participants